Jump to content
Martin Bargl

Manufacturer image on product list (PS 1.7)

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

Share this post


Link to post
Share on other sites

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)

Share this post


Link to post
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 ?

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.

Share this post


Link to post
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)

Share this post


Link to post
Share on other sites

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 ! :o

Share this post


Link to post
Share on other sites

OK, I didn't see this little detail:

 

 

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.

Ok, use this one:

{$link->getmanufacturerLink($manufacturer.id_manufacturer, $manufacturer.link_rewrite)|escape:'html'}

The topic name mentions that we're looking for a solution for Prestashop 1.7 ! :o

Yes, but we are the same platform, PrestaShop.

And it's the same places.

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Hi @ndiaga,

 

Thanks for your reply :

 

 

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.

Here the purpose was to use the function:getManufacturerLink($p1,$p2);

Share this post


Link to post
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...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More