robkwal Posted August 20, 2010 Share Posted August 20, 2010 Hi, I now have a grid view for my product list so when a product is on sale it interrupts the layout consistency. So I would like to know weather it is possible to remove the text 'PRICE LOWERED' and have something as simple as the price text changing to the color red if it was on sale, which would imply it was on sale, but not add a new line to the product and effect the layout? Is there an if statement that could be added or something?Thanks. Link to comment Share on other sites More sharing options...
Kicsihun Posted August 20, 2010 Share Posted August 20, 2010 Hi!In product_list.tpl modify the following lines {if $product.on_sale} {l s='On sale!'} {elseif ($product.reduction_price != 0 || $product.reduction_percent != 0) && ($product.reduction_from == $product.reduction_to OR ($smarty.now|date_format:'%Y-%m-%d %H:%M:%S' <= $product.reduction_to && $smarty.now|date_format:'%Y-%m-%d %H:%M:%S' >= $product.reduction_from))} {l s='Price lowered!'} {/if} so they will look like {if $product.on_sale} {l s='On sale!'} {/if} Change {if !$priceDisplay}{convertPrice price=$product.price}{else}{convertPrice price=$product.price_tax_exc}{/if} to {if !$priceDisplay}{convertPrice price=$product.price}{else}{convertPrice price=$product.price_tax_exc}{/if} In this case if the product is on sale it will display the text 'On sale', but in the case if the price is lowered the price will be displayed in red.If you want to display the price in red only if the product is on sale, but you dont't want to indicate if the price is lowered or not thandelete {if $product.on_sale} {l s='On sale!'} {elseif ($product.reduction_price != 0 || $product.reduction_percent != 0) && ($product.reduction_from == $product.reduction_to OR ($smarty.now|date_format:'%Y-%m-%d %H:%M:%S' <= $product.reduction_to && $smarty.now|date_format:'%Y-%m-%d %H:%M:%S' >= $product.reduction_from))} {l s='Price lowered!'} {/if} anddo the following changes {if !$priceDisplay}{convertPrice price=$product.price}{else}{convertPrice price=$product.price_tax_exc}{/if} Hope it works! Link to comment Share on other sites More sharing options...
robkwal Posted August 20, 2010 Author Share Posted August 20, 2010 Thanks for your quick response and help! Link to comment Share on other sites More sharing options...
Kicsihun Posted August 23, 2010 Share Posted August 23, 2010 Please let me know if it worked! Link to comment Share on other sites More sharing options...
robkwal Posted August 29, 2010 Author Share Posted August 29, 2010 This did work, thank you very much! Link to comment Share on other sites More sharing options...
Daan Tol Posted February 4, 2011 Share Posted February 4, 2011 it does not work on 1.3.1. .... I get this message in my shop:Fatal error: Smarty error: [in .../public_html/themes/my_theme/./product-list.tpl line 28]: syntax error: invalid attribute name: 'lowered!�' (Smarty_Compiler.class.php, line 1550) in /usr/home/deb26947/domains/serviezenonline.nl/public_html/tools/smarty/Smarty.class.php on line 1095Does anybody know how I can fix this? 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