James_B Posted August 29, 2011 Share Posted August 29, 2011 Hi, i wonder if someone could help. I'm trying to get the new icon at product.tpl and also at the home_featured.tpl and i can't do it. The only tpl where i can retrieve this data from the product array it's at categories.tpl but in my template i want this icon added to this other tpl's. Is that possible? Anyone can help me! Thanks in advance. Link to comment Share on other sites More sharing options...
shokinro Posted August 29, 2011 Share Posted August 29, 2011 I'm trying to get the new icon at product.tpl and also at the home_featured.tpl and i can't do it. The only tpl where i can retrieve this data from the product array it's at categories.tpl but in my template i want this icon added to this other tpl's for the Home Featured, if you put following code into your theme (correct location), the new icon should appear {if isset($product.new) && $product.new == 1}<span class="new">{l s='New'}</span>{/if} Edit: For product page, see next two posts. Link to comment Share on other sites More sharing options...
AKJV Posted August 29, 2011 Share Posted August 29, 2011 Actually, I managed to display a 'New' indication on product pages, just by adding a {if $product->new} conditional statement. I believe it works the same way as {if $product->on_sale} that's already used in product.tpl. Shokinro is much more experienced with Prestahop that I am, so I hope he can comment on this. 1 Link to comment Share on other sites More sharing options...
shokinro Posted August 29, 2011 Share Posted August 29, 2011 Shokinro is much more experienced with Prestahop that I am, so I hope he can comment on this. More experience does not mean knowing everything. I just checked the /classes/product.php class, you are right (I give a + vote) ,$product->new is already loaded, so there is no need to do the complicated calculation, PrestaShop already done it. Here is code for product code to show new icon {if $product->new}<span class="new">{l s='New'}</span>{/if} Sorry for the confusing. I will modify previous post to avoid further confusing. Link to comment Share on other sites More sharing options...
James_B Posted August 29, 2011 Author Share Posted August 29, 2011 Wooow!! That's awesome!! And easy!! I've tested and it works fine! Thank's a lot to both. I also realized i tested AKJV solution before asking but didn´t work for me propperly because the number of days where not good setted at the admin. So it was also kind of my fault to not finding the solution before. It's a shame we can't see the product data creation at back-end. This would have helped! Thanks a lot again! Very kind! Cheers Link to comment Share on other sites More sharing options...
Recommended Posts