stef2015 Posted June 27, 2017 Share Posted June 27, 2017 (edited) We use a 1.6 version of Prestashop and we have installed customized warranty pictograms (1 year warranty, 2 years, etc.) for our electronic products. These pictograms are displayed on the product-list.tpl template. Each electronic product has a feature called "Guarantee" and a value such as "1 year", "2 years", etc... With this information retrieved in the Product.php (override) class, we can define the url leading to the correct pictogram. Here is an excerpt of the code in CategoryController.php (override) to retrieve this url : <?php class CategoryController extends CategoryControllerCore { public function initContent() { parent::initContent(); ... foreach ($products as &$product) { $product['warranty'] = Product::getProductWarrantyUrl((int)$product['id_product']); } ... $this->context->smarty->assign('products', $products); } } Product :: getProductWarrantyUrl () retrieves the url of the pictogram and is found in Product.php (override) And here is the code placed in product-list.tpl: {if isset($product.warranty)} <div class="df-warranty" style="background-image:url({$base_dir}themes/wt_furniture/img/icon/warranty_{$product.warranty}.png);"></div> {/if} This code works well and the pictograms are displayed correctly in the view. However, when clicking on the checkboxes of the blocklayered module, and after an AJAX load, the pictograms disappear, it seems that the {$product.warranty} variable is no longer filled in. Could this module use its own controller or use another way to generate new Smarty variables ? Do you have any suggestions ? Thank you for your help. Edited June 27, 2017 by stef2015 (see edit history) 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