Jump to content

Manufacturer image on product list (PS 1.7)


Martin Bargl

Recommended Posts

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

  • 2 weeks later...

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 by Trafiquant (see edit history)
  • Like 2
Link to comment
Share on other sites

@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 by Trafiquant (see edit history)
Link to comment
Share on other sites

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...