mytheory. Posted July 31, 2010 Share Posted July 31, 2010 Hello all,I am trying to apply an icon or text that says "new" for all products that are NEW.I managed to place icons for items that are on sale or price lowered by using the following lines of code in themes/prestashop/product-list.tpl. {if $product.on_sale} {l s='On sale!'} {/if} However, I can't figure out how to do this for products that are new. I thought the following line would work, but it's not... {if $product.new == 1} {l s='NEW!'} {/if} I don't know if this only works on v1.3.x, but I'm using v1.2.5 and I just can't figure it out. Does anybody know who I can get this to work on PS v1.2.5?Thanks! Link to comment Share on other sites More sharing options...
rocky Posted August 1, 2010 Share Posted August 1, 2010 I don't understand why you are trying to add a "new" icon to the product listings, since PrestaShop already has one by default. I have the following on line 8 of product-list.tpl: {if $product.new == 1}{l s='new'}{/if}{$product.name|escape:'htmlall':'UTF-8'|truncate:35:'...'} If the product is considered new (was created within the "number of days a product is considered new" option on the Preferences > Products tab), then a green "NEW" icon should appear. Link to comment Share on other sites More sharing options...
mytheory. Posted August 1, 2010 Author Share Posted August 1, 2010 Yes like the default one. However, I'm using a new theme and I was missing this line of code in my tpl. After copying it from above, it still does not work. I don't think this has anything to do with the new theme, as I am guessing the workings behind $product.new == 1 is happening somewhere else, perhaps in the /classes folder?rocky, I was wondering if you happen to know where I can find the inner workings of that line ($product.new == 1). Do you happen to know why this isn't working for me, and where I should be looking?Much Thanks! Link to comment Share on other sites More sharing options...
mytheory. Posted August 1, 2010 Author Share Posted August 1, 2010 Hey rocky,Right after posting the above post, I went a little deeper and noticed that it actually is working... in the products-list under categories, but its not visible in on the new-products.php page. However, when I use that same line of code for products on sale or with reduction (code from first post) these icons/text appear in both the product-lists page and under prices-drop.php page.Do you know why this is happening? I would like to not have the icons appear under prices-drop.php just like with new products or have new products show the icon/text under new-products.php... I'm just looking for some consistency between these two pages. Do you have any idea how I might go about achieving this?Thanks! 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