Martin Bargl Posted June 14, 2017 Share Posted June 14, 2017 Hello everyone, I have a question, about right solution. I need to show manufacturer image on product list, but there's only manufacturer ID. Normally, I would override CategoryController.php and extended it by: $manufacturers = Manufacturer::getManufacturers(true, $this->context->language->id, true, $this->p, $this->n, false); $manufacturers_for_display = array(); foreach ($manufacturers as $manufacturer) { $manufacturers_for_display[$manufacturer['id_manufacturer']] = $manufacturer; $manufacturers_for_display[$manufacturer['id_manufacturer']]['text'] = $manufacturer['short_description']; $manufacturers_for_display[$manufacturer['id_manufacturer']]['image'] = $this->context->link->getManufacturerImageLink($manufacturer['id_manufacturer'], 'medium_default'); } $this->context->smarty->assign(array( 'manufacturer' => $manufacturers_for_display, ... But override for CategoryPresenter.php is not working anymore in PS 1.7. Any ideas? Thanks a lot, Martin Link to comment Share on other sites More sharing options...
Trafiquant Posted June 23, 2017 Share Posted June 23, 2017 (edited) Hi, I tried this on my shop : {if isset($product.id_manufacturer)} <div class="product-brand"> {block name='product_brand'} <a href="{$link->getManufacturerLink($product.id_manufacturer)}" title="{$product.manufacturer_name|escape:html:'UTF-8'}"> <img src="{$link->getManufacturerImageLink($product.id_manufacturer, 'small_default')}" alt="{$product.manufacturer_name|escape:html:'UTF-8'}"> </a> {/block} </div> {/if} I applied this code on the /themes/MYTHEME/templates/catalog/_partials/miniatures/product.tpl file. Display seems good, but I'm not sure about code integrity: I tried to adapt some code founded on topics related to Prestashop 1.6. Edited June 23, 2017 by Trafiquant (see edit history) 2 Link to comment Share on other sites More sharing options...
Trafiquant Posted June 23, 2017 Share Posted June 23, 2017 Hi, Use this module it's simpler: https://www.prestashop.com/forums/topic/538667-manufacturer-logo-adding-manufacturer-logo-in-product-list-page/ @ndiaga I tried your module, and manufacturer logo doesn't display on my products lists pages... Is your addon compatible with Prestashop 1.7.1.2 ? Link to comment Share on other sites More sharing options...
Trafiquant Posted June 23, 2017 Share Posted June 23, 2017 (edited) @ndiaga I tried your module, and manufacturer logo doesn't display on my products lists pages... Is your addon compatible with Prestashop 1.7.1.2 ? OK, I didn't see this little detail: NB: To finish the module installation copy the manufacturerlogo.tpl file to your theme's product_list.tpl file before the image tag. Or in any place you wish. For further details read this tutorial. But I have a question about link generated: how can I do to get the rewritten link instead of /index.php?id_manufacturer=13&controller=manufacturer&id_lang= This kind of link is not good for SEO and indexation by search engines. Edited June 23, 2017 by Trafiquant (see edit history) Link to comment Share on other sites More sharing options...
Trafiquant Posted June 23, 2017 Share Posted June 23, 2017 This is for 1.6, I didn't test it for 1.7 . But you can do it yourself, the code is not that difficult to understand. The topic name mentions that we're looking for a solution for Prestashop 1.7 ! 1 Link to comment Share on other sites More sharing options...
Trafiquant Posted June 26, 2017 Share Posted June 26, 2017 Hi @ndiaga, Thanks for your reply : Ok, use this one: {$link->getmanufacturerLink($manufacturer.id_manufacturer, $manufacturer.link_rewrite)|escape:'html'} Unfortunatly, this one doesn't work. Seems that the correct function is getManufacturerLink instead of getmanufacturerLink, but same result. Seems that $manufacturer is not initialized. 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