S7 Media Ltd Posted November 13, 2011 Share Posted November 13, 2011 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 More sharing options...
Thierryh Posted November 14, 2011 Share Posted November 14, 2011 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 More sharing options...
S7 Media Ltd Posted November 14, 2011 Author Share Posted November 14, 2011 Hi Thiery thanks for your quick and detailed response. I'll have a go at using your suggestion and let you know how I get on. Thanks again. Link to comment Share on other sites More sharing options...
S7 Media Ltd Posted November 15, 2011 Author Share Posted November 15, 2011 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 More sharing options...
Thierryh Posted November 15, 2011 Share Posted November 15, 2011 Hi S7Media Ltd. What you say is right. Outside to override CategoryController.php, I don't see how to do what you wish. Link to comment Share on other sites More sharing options...
senso321 Posted December 4, 2013 Share Posted December 4, 2013 (edited) 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 Edited December 5, 2013 by senso321 (see edit history) 1 Link to comment Share on other sites More sharing options...
vekia Posted December 4, 2013 Share Posted December 4, 2013 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 thank you it is helpful definitely just wondering why there is truncate with 360 value? in database datatype is: 1 Link to comment Share on other sites More sharing options...
senso321 Posted December 5, 2013 Share Posted December 5, 2013 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 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