Jump to content

Change Sale Price Color in Product List?


Recommended Posts

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

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

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

×
×
  • Create New...