Member Avatar for dan_ord

Hi,

I would like to add discount to an order, but the tricky bit for me is the following:

**Example**

1 photo = £15.00

But for every 3 photos i want to subtract £3 and for every 3 photos after that another £3 off the total order

So 3 photos @ £15 = £45 - the discount (£3) gives me a total of £42

And 6 photos @ £15 = £90 - the discount (£3 x2 = 6) total of £84

and so on...

But i only want this to happen after every 3 photos if you get me?

If anyone can help it would be greatly appreciated!

Regards,

Dan

<?php

$ordered = 7;
$numdiscounted = (int)($ordered/3);
$discounted = $numdiscounted *3;
$pdprice = $ordered * 15;
$finalprice = $pdprice-$discounted;

echo "ordered ".$ordered."pics\n".
        $numdiscounted." received a discount\n".
        "Customed saved ".$discounted."\n".
        "Total price before discount: ".$pdprice."\n".
        "Final price: " .$finalprice."\n\n";
?>
commented: Simple answer that worked, great! +1
Member Avatar for dan_ord

Hi kireol,

Thanks for that worked perfectly,

Much appreciated!

Regards,

Dan.

no problem. cheers

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.