Update for Menswear Online
Hi all,
Following on from this, thought some of you might like to see our current, slightly more advanced implimentation of this...
if you look at our "New Products" seciton at the bottom of the home page http://www.menswearonline.co.uk
I've edited this so that items with a saving below £24 show up with the saving as a percentage, where as items where you save over £24 show up as an amount for the saving.
Code below...
Enjoy
EDIT - in case the saving IS £24
im certainly not much of a php guy, im sure there are cleaner ways to do this, like some kind of OR function, but at least this works!
feel free to post clean ups. Thanks!
Hi all,
Following on from this, thought some of you might like to see our current, slightly more advanced implimentation of this...
if you look at our "New Products" seciton at the bottom of the home page http://www.menswearonline.co.uk
I've edited this so that items with a saving below £24 show up with the saving as a percentage, where as items where you save over £24 show up as an amount for the saving.
Code below...
Enjoy
Code:
<actinic:block php="true"> $rrp = <actinic:variable name="ProductRRP" selectable="false" />; $rawprice = <actinic:variable name="ProductPriceRaw" selectable="false" />; $amountsaved = round($rrp - $rawprice); $savepercent = round((($rrp - $rawprice) / $rrp) * 100); // only display is we have an RRP and there's a saving to show if ( ($rrp != 0) && ($rrp > $rawprice) && ($amountsaved > 24)) { echo "Save: £$amountsaved"; } if ($amountsaved < 24) { echo " Save: $savepercent%"; } </actinic:block>
EDIT - in case the saving IS £24
Code:
<actinic:block php="true"> $rrp = <actinic:variable name="ProductRRP" selectable="false" />; $rawprice = <actinic:variable name="ProductPriceRaw" selectable="false" />; $amountsaved = round($rrp - $rawprice); $savepercent = round((($rrp - $rawprice) / $rrp) * 100); // only display is we have an RRP and there's a saving to show if ( ($rrp != 0) && ($rrp > $rawprice) && ($amountsaved > 24)) { echo "Save: £$amountsaved"; } if ($amountsaved <= 24) { echo " Save: $savepercent%"; } </actinic:block>
feel free to post clean ups. Thanks!
Comment