Oncilla Posted May 22, 2010 Share Posted May 22, 2010 Hey guys,I'm trying to make a change to my product list template.Here is my current code for the area I'm working with: {if !$priceDisplay || $priceDisplay == 2}{convertPrice price=$product.price}{if $priceDisplay == 2} {l s='+Tx'}{/if}{/if} {if $priceDisplay}{convertPrice price=$product.price_tax_exc}{if $priceDisplay == 2} {l s='-Tx'}{/if}{/if} What do I need to add/change to make the products price change to RED whenever the item is on sale?Thanks. Link to comment Share on other sites More sharing options...
Oncilla Posted May 23, 2010 Author Share Posted May 23, 2010 Any ideas? Surely it's something simply? Link to comment Share on other sites More sharing options...
5ummer5 Posted May 23, 2010 Share Posted May 23, 2010 Have you got a bit of code in there saying something like:-If on sale, display the "on sale" image?EDIT:Ok I have just checked this out and you need to add your own {if} statement in there to define what the price should look like if on sale and when not on sale.The current code will be this {if !$priceDisplay || $priceDisplay == 2}{convertPrice price=$product.price}{if $priceDisplay == 2} {l s='+Tx'}{/if}{/if} {if $priceDisplay}{convertPrice price=$product.price_tax_exc}{if $priceDisplay == 2} {l s='-Tx'}{/if}{/if} and you need to add the if statement and also the color:#ff000 so it will look like this {if $product.on_sale} {if !$priceDisplay || $priceDisplay == 2}{convertPrice price=$product.price}{if $priceDisplay == 2} {l s='+Tx'}{/if}{/if} {if $priceDisplay}{convertPrice price=$product.price_tax_exc}{if $priceDisplay == 2} {l s='-Tx'}{/if}{/if} {else} {if !$priceDisplay || $priceDisplay == 2}{convertPrice price=$product.price}{if $priceDisplay == 2} {l s='+Tx'}{/if}{/if} {if $priceDisplay}{convertPrice price=$product.price_tax_exc}{if $priceDisplay == 2} {l s='-Tx'}{/if}{/if} {/if} This is basically saying if the product is on sale then display the price in red. If its not then display it as normal.Hope this helps! Link to comment Share on other sites More sharing options...
Oncilla Posted May 23, 2010 Author Share Posted May 23, 2010 I tried replacing my code with yours and it's still not working unfortunately.Thanks for the reply though, much appreciated. Link to comment Share on other sites More sharing options...
Burhan BVK Posted May 23, 2010 Share Posted May 23, 2010 It is supposed to be $product->on_sale, not $product.on_sale. And if we simplify the code a little bit: {if !$priceDisplay || $priceDisplay == 2}{convertPrice price=$product.price}{if $priceDisplay == 2} {l s='+Tx'}{/if}{/if} {if $priceDisplay}{convertPrice price=$product.price_tax_exc}{if $priceDisplay == 2} {l s='-Tx'}{/if}{/if} Link to comment Share on other sites More sharing options...
5ummer5 Posted May 23, 2010 Share Posted May 23, 2010 Hi Oncillayou need to make sure you refresh the cache when you try and view the page to make sure the changes are reflected properly.Thanks whitelighter for the simplified code Link to comment Share on other sites More sharing options...
Recommended Posts