logic question concerning sale prices in shopping basket app
| From: | Brett | Date: | Wed, 28 Feb 2001 20:24:46 +0000 |
| Subject: | logic question concerning sale prices in shopping basket app | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-42078@lists.php.net to get a copy of this message | ||
I have a simple page that offers three items(7700,7701,7702). I am trying to figure the best way to
calculate the price for each shirt depending on the amount they want. The breakdown of prices is:
Any 3 shirts for $50
7700 - 3 for $33 or $14.99
7701 & 7702 - 3 for $50 or $25.
So I sort through the 7700's and set the price for multiples of three which is 11, then sort
through the 7701 and 7702 and set the price for multiples of three which is 16.66.
Now I run into a problem with the remaining shirts and figuring out how they should be priced. If
there are four shirts left and they are 2-7700, 1- 7701, and 1- 7702,
I need a way to make sure that the 7701 and 7702 are included with 1 of the 7700, and the other 7700
is priced at 14.99.
The items are stored in mysql and referenced by the product code(7700). Hopefully I explained this
weel enough. Maybe some ofyou have an idea.
If you want to see what this is for go to http://www.jnewman.com/oxfords. Play all you want, it
does nothing but add the prices. If you add 1 buttondown and 2 of the other shirts you will see
that the total is 70 something instead of 50 something.
Thanks,
Brett