0

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

2
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by kireol
1
<?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";
?>
Votes + Comments
Simple answer that worked, great!
0

Hi kireol,

Thanks for that worked perfectly,

Much appreciated!

Regards,

Dan.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.