Jump to content

Display manufacturers on category page specific to category


Recommended Posts

Hi there

 

Is there anyway I can display manufacturers specific to the category page that I'm browsing? So for example, if I was browsing Cars > 4x4s, at the top of the 4x4 category page would be the logo of manufacturers that make 4x4s - for example, Land Rover, Jeep etc.

 

Is this possible?

 

Thanks in advance

Link to comment
Share on other sites

Hi

In product-list.tpl, I think that you can use $product.manufacturer_name.

To check if it works, I suggest that you add {debug} in your file product-list.tpl, delete all files in /tools/smarty/compile and then press F5 in your web navigator.

A popup window will be displayed, in which you can see all variables/datas relative to the current PrestaShop, including $products.

 

$products is an array containing the products of the current category (this array is visible if the current PS page is a category.php page.

So top of this TPL, you could add an extra {foreach from=$products item=product name=products}...{/foreach} in order to display only the manufacturer names/logos.

 

Hope it helps.

Thiery

Link to comment
Share on other sites

Hi Thierry, from what you've said I've managed to come up with this:

 

{foreach from=$products item=product name=products}{$products.manufacturer_name}{/foreach}

 

What this does is picks up products on that particular page, and lists the manufacturer name. So let's say there's five products by Samsung, it'll list the name five times - it'll say SamsungSamsungSamsungSamsungSamsung. Then, on page two, if there's only one, it'll just list the name. If that makes sense.

 

So what I'd like it to do is find all the manufacturers across the whole category the user is browsing, and display it's logo once. I have tried displaying the logo but struggling.

 

Any help would be really appreciated. Thanks

Link to comment
Share on other sites

  • 2 years later...

I know that this is a old topic, but it might be useful for somebody.

In prestashop 1.5 you can use the following code line to display the manufacturer on category page.

{$product.manufacturer_name|strip_tags:'UTF-8'|truncate:360:'...'}

Just find the right place in product-list.tpl to place it. 

 

And if you want to achieve a result like the author of this topic you just have to create a forearch loop within the forearch loop ( products )

I hope this will be helpful for somebody. Would have saved some time for me :P

Edited by senso321 (see edit history)
  • Like 1
Link to comment
Share on other sites

I know that this is a old topic, but it might be useful for somebody.

In prestashop 1.5 you can use the following code line to display the manufacturer on category page.

{$product.manufacturer_name|strip_tags:'UTF-8'|truncate:360:'...'}

Just find the right plac ein product-list.tpl.

 

And if you want to achieve a result like the autohr of this topic you just have to create a forearch loop within the forearch loop ( products )

 

I hope this will be helpful for somebody. Woul dhave saved some time for me :P

 

thank you :) it is helpful definitely

just wondering why there is truncate with 360 value? 

 

in database datatype is:

OfOJKVt.png

  • Like 1
Link to comment
Share on other sites

I didint check the database, but I wanted to make sure that all of the chars are displayed. :)

 

To those who dont know what truncate is, 

 

Truncate let's you shorten a word ( in our case manufacturers name ) to a certain character limit ( in my example it will display as much as 360 characters, but as vekia pointed out its already limited to 64 characters in database )

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...