Announcement

Collapse
No announcement yet.

Can I automatically calculate the savings based on the RRP?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Can I automatically calculate the savings based on the RRP?

    his technique will calculate a saving on prices based on the value of 'RRP' – a custom variable that you will need to create.

    It will display as follows within your product layouts.

    RRP: £10 – you save 8%

    To do this:

    1. Create a new variable called 'RRP' (Design | Library | Variables). It needs to have a type of 'Number' rather than 'Text'. (for more information on creating variables see the main help files - 'Understanding Variables > Adding a New Variable').

    2. Enter some RRP values for your products. Remember to NOT include a currency symbol.

    3. Copy and paste the following code into your product layout(s) wherever you want the price saving message to appear.

    <actinic:block php="true" selectable="false">
    $rrp = <actinic:variable name="RRP" selectable="false" />;
    $rawprice = <actinic:variable name="ProductPriceRaw" selectable="false" />;
    $rawprice = $rawprice * 1.175; // add in vat if showing VAT inc prices
    // only display is we have an RRP and there's a saving to show
    if ( ($rrp != 0) && ($rrp > $rawprice) )
    {
    $savepercent = round((($rrp - $rawprice) / $rrp) * 100);
    echo "RRP £$rrp - you save $savepercent%";
    }
    </actinic:block>

    4. Apply changes and check the results in the preview.

    There are several areas where you can tweak this code.

    * Use a currency other than pounds by amending the '£' just before where it says '£$rrp'

    * If you use a tax rate other than VAT at 17.5% then you can amend the line that talks about 'add in vat if showing VAT inc. prices'. If you don't charge tax at all you can safely delete this line.
Working...
X