RE: [PHP] IDEA: Method for Shopping Cart QUANTITY DISCOUNT?
| From: | Janet Valade | Date: | Wed, 22 Nov 2000 20:36:11 +0000 |
| Subject: | RE: [PHP] IDEA: Method for Shopping Cart QUANTITY DISCOUNT? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-26702@lists.php.net to get a copy of this message | ||
I store the various prices in a DB with the level number. I also store the
level parameters, e.g. min number and max number. It looks like this.
CREATE TABLE productCost (
partNo CHAR(14) NOT NULL,
quantCat INT(2) NOT NULL,
quantMin CHAR(4) NOT NULL,
quantMax CHAR(4) NOT NULL,
price DECIMAL(9,2) NOT NULL,
where records might be:
33333 1 1 5 10.00
33333 2 6 10 8.00
etc. quantCat 1 would be list price ($10.00), quantCat 2 would be $8.00 for
6-10 purchased, etc.
I can then get this information out of the database and use it to compute
the appropriate price based on the quantity ordered. I can put the info in
one or more arrays. I can loop through all the products ordered and compare
the quantity ordered to the quantMin and quantMax from the DB. The loop
finds the quantCat for the amount ordered and then selects the appropriate
price from the DB row WHERE quantCat=quantCat from the loop.
If your quantCat levels are the same for all products, it's not necessary to
store quantMin and quantMax in the DB. They can be set in the code.
Janet
> -----Original Message-----
> From: Derek Sivers [SMTP:list@hitmedia.com]
> Sent: Wednesday, November 22, 2000 11:54 AM
> To: php-general@lists.php.net
> Subject: [PHP] IDEA: Method for Shopping Cart QUANTITY DISCOUNT?
>
> I know LOTS of us on the PHP list have worked with shopping carts.
>
> Has anyone found a good solution/method for doing quantity discounts?
>
> 1 widget = $10
> 2 widgets = $18
> 3 widgets = $27.50
> 4 widgets = $35.33
> 5 widgets = $40.00
> each additional = $5
>
> Do you make SEPARATE ITEMS like a bundle?
> Like "widget1" is an item at $10 but
> "widget2" is a single item, costing $18?
> (And if so, do you scroll through and decrease inventory of sub-items
> inside the "widget2" package item?)
>
> I'd be doing this for a store with over 10,000 items, so it'd have to be
> easily scalable.
>
> Any ideas, anyone?
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net