luqa19 Posted December 20, 2016 Share Posted December 20, 2016 Witam mam za zadanie zmiane wyświatlających sie produktów na stronie głównej nowego kupionego szablonu: https://tonny.gr/ Produkty z kategorii pobiera od najstarszych. W Konfiguracji modułu nie da się zmieniać. Ma ktoś jakiś pomysł na wybieranie produktów wyświetlanych na stronie głównej ? Za pomocą nadanych funkcji może ? Pozdrawiam. Link to comment Share on other sites More sharing options...
Przemysław Suszek Posted December 20, 2016 Share Posted December 20, 2016 Pytanie z innej strony. Jak chcesz ustawiać kolejność ? Link to comment Share on other sites More sharing options...
luqa19 Posted December 20, 2016 Author Share Posted December 20, 2016 Fajnie by było gdybym sobie mógł sam je wybierać. Ale w ostateczności od najnowszych wstawionych. Link to comment Share on other sites More sharing options...
Przemysław Suszek Posted December 20, 2016 Share Posted December 20, 2016 Jeżeli od najnowszych to pozostaje zmian w kodzie. To chyba będzie najprostsze. Pozdrawiam Link to comment Share on other sites More sharing options...
luqa19 Posted December 20, 2016 Author Share Posted December 20, 2016 Kod wyświetlający te produkty : <div id="cs_filter_categories" class="cs-filter-categories cs-accordion-template" data-animate="fadeInDown" data-delay="100"> <div class="container"> <div class="row"> {if isset($cs_categories) && $cs_categories|@count > 0} {foreach from=$cs_categories item=item_category name=cs_categories} {assign var=category value=$item_category.category} <div class="cs-row-categories {if $smarty.foreach.cs_categories.iteration mod 2 == 0}even{else}old{/if}"> <div class="title title-category col-xs-12 col-sm-6"> <div class="left-cate"> <div class="image-category"> <a href="{$link->getCategoryLink($category->id_category, $category->link_rewrite)|escape:'html':'UTF-8'}"><img src="{$link->getCatImageLink($category->link_rewrite, $category->id_image,'category_default')|escape:'html':'UTF-8'}" alt="{$category->name|escape:'html':'UTF-8'}" /></a> </div> <div class="title-cate"> <h2 class="title_block"> <a href="{$link->getCategoryLink($category->id_category, $category->link_rewrite)|escape:'html':'UTF-8'}"> {$category->name|escape:'html':'UTF-8'} </a> </h2> <a class="shop-now" href="{$link->getCategoryLink($category->id_category, $category->link_rewrite)|escape:'html':'UTF-8'}"><span>{l s='Shop now' mod='csfeaturecategory'}</span></a> </div> </div> </div> <div id="cs_category_{$smarty.foreach.cs_categories.iteration|intval}" class="cs-filter-category content-category col-xs-12 col-sm-6 {if $smarty.foreach.cs_categories.first} in{/if}"> {if isset($item_category.big_product) || isset($item_category.product_list)} <div class="cs-filter-content"> <!--big product--> {if isset($item_category.big_product) && $item_category.big_product} {assign var=big_product value=$item_category.big_product} <div class="cs_big_product cs-big-product" style="width:{$w_big_product|floatval}%"> <div class="cs-item" itemscope itemtype="http://schema.org/Product"> {include file="$tpl_dir./product-section-cs.tpl" product=$big_product image_size='home_default'} </div> </div> {/if} <!--product list--> {if isset($item_category.product_list) && $item_category.product_list} {assign var=product_list value=$item_category.product_list} {assign var=w_product_list value=100-$w_big_product} <div class="cs_product_list cs-product-list" style="width:{$w_product_list|floatval}%"> <div class="row{if $cs_config->used_slider == 0} cs-{$cs_config->number_product_aline}-items-aline{/if}"> <div class="cs_section_product_grid cs-container-list{if $cs_config->used_slider == 0} cs-no-slider{/if}"> {foreach from=$product_list item=product name=product_list} {if isset($cs_config) && (($smarty.foreach.product_list.iteration % $cs_config->number_line == 1 && $cs_config->used_slider == 1) || $cs_config->used_slider == 0 || $cs_config->number_line == 1)} <div class="cs-item"> {/if} {include file="$tpl_dir./product-section-cs.tpl" product=$product image_size='home_default'} {if isset($cs_config) && ((($smarty.foreach.product_list.last || $smarty.foreach.product_list.iteration % $cs_config->number_line == 0) && $cs_config->used_slider == 1 ) || $cs_config->used_slider == 0 || $cs_config->number_line == 1)} </div> {/if} {/foreach} </div> </div> </div> {if isset($cs_config->used_slider) && $cs_config->used_slider == 1} <script type="text/javascript"> jQuery(document).ready(function($) { initOwlCarousel('#cs_category_{$smarty.foreach.cs_categories.iteration|intval}',{$cs_config->number_product_aline|intval},{$w_big_product|floatval},{$cs_config->pagination|intval},{$cs_config->navigation|intval}); }); </script> {/if} {else} <p class="alert alert-warning">{l s='No product at this time' mod='csproductsincategory'}</p> {/if} </div> {/if} </div> </div> {/foreach} {else} <p class="alert alert-warning">{l s='There is no category' mod='csproductsincategory'}</p> {/if} </div> </div> </div> Mógłby ktoś pomóc go przerobić tak aby pokazywał produkty od najnowszych ? byłbym bardzo wdzięczny. Link to comment Share on other sites More sharing options...
e_com Posted December 20, 2016 Share Posted December 20, 2016 Templatka to wyświetla co jej kontroler wyśle, jak wysyła 10 starych produktów to nowych już nie zobaczysz. W kontrolerze modułu szukaj funkcji getProducts. Jeśli jest to standardowa funkcja z klasy Product to sortowanie jest jako 5 parametr: getProducts($id_lang, $start, $limit, $order_by, $order_way, $id_category = false, $only_active = false, Context $context = null) czyli wstawiasz DESC i masz od najnowszych i $order_by powinno być 'date_add' A jak moduł pobiera produkty jakąś własną funkcją to byś musiał pokazać ją. Link to comment Share on other sites More sharing options...
luqa19 Posted December 20, 2016 Author Share Posted December 20, 2016 @e_com dziękuję za odpowiedź, znalazłem coś takiego : * Assigns product list template variables */ public function assignProductList() { $hook_executed = false; Hook::exec('actionProductListOverride', array( 'nbProducts' => &$this->nbProducts, 'catProducts' => &$this->cat_products, 'hookExecuted' => &$hook_executed, )); // The hook was not executed, standard working if (!$hook_executed) { $this->context->smarty->assign('categoryNameComplement', ''); $this->nbProducts = $this->category->getProducts(null, null, null, $this->orderBy, $this->orderWay, true); $this->pagination((int)$this->nbProducts); // Pagination must be call after "getProducts" $this->cat_products = $this->category->getProducts($this->context->language->id, (int)$this->p, (int)$this->n, $this->orderBy, $this->orderWay); } // Hook executed, use the override else { // Pagination must be call after "getProducts" $this->pagination($this->nbProducts); } $this->addColorsToProductList($this->cat_products); Hook::exec('actionProductListModifier', array( 'nb_products' => &$this->nbProducts, 'cat_products' => &$this->cat_products, )); foreach ($this->cat_products as &$product) { if (isset($product['id_product_attribute']) && $product['id_product_attribute'] && isset($product['product_attribute_minimal_quantity'])) { $product['minimal_quantity'] = $product['product_attribute_minimal_quantity']; } } $this->context->smarty->assign('nb_products', $this->nbProducts); } /** * Returns an instance of the current category * * @return Category */ public function getCategory() { return $this->category; } } Link to comment Share on other sites More sharing options...
e_com Posted December 20, 2016 Share Posted December 20, 2016 Zamień: $this->nbProducts = $this->category->getProducts(null, null, null, $this->orderBy, $this->orderWay, true); na: $this->nbProducts = $this->category->getProducts(null, null, null, 'date_add', 'DESC', true); 1 Link to comment Share on other sites More sharing options...
luqa19 Posted December 20, 2016 Author Share Posted December 20, 2016 Zamień: $this->nbProducts = $this->category->getProducts(null, null, null, $this->orderBy, $this->orderWay, true); na: $this->nbProducts = $this->category->getProducts(null, null, null, 'date_add', 'DESC', true); Zmieniłem wyczyściłem cache, ale nie działa to chyba nie ta. Link to comment Share on other sites More sharing options...
e_com Posted December 20, 2016 Share Posted December 20, 2016 Nie zauważyłem niżej: $this->cat_products = $this->category->getProducts($this->context->language->id, (int)$this->p, (int)$this->n, $this->orderBy, $this->orderWay) zamień na: $this->cat_products = $this->category->getProducts($this->context->language->id, (int)$this->p, (int)$this->n, 'date_add', 'DESC') 1 Link to comment Share on other sites More sharing options...
luqa19 Posted December 20, 2016 Author Share Posted December 20, 2016 Też nie działa ten moduł pewnie pobiera z innego pliku poszukam może coś znajdę dzięki za pomoc. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now