Re: Shopping Cart Discount System
| From: | Ashley Sheridan | Date: | Mon, 31 Dec 2012 09:36:06 +0000 |
| Subject: | Re: Shopping Cart Discount System | ||
| References: | 1 | Groups: | php.db php.general |
| Request: | Send a blank email to php-general+get-319975@lists.php.net to get a copy of this message | ||
Karl DeSaulniers <karl@designdrumm.com> wrote:
>Hello Everyone,
>Hope all are well. Quick and hopefully painless question.
>Is there any examples on how to build a discount system
>into your shopping cart out there that anyone knows of?
>I am using MySQL and PHP. I have built one of my own so far,
>but am having trouble making sense of what goes where.
>
>For example. If a product has miscellaneous charges,
>lets say.. glitter is extra on your shirt.
>How is discounts applied? I mean, as far as discounts go,
>lets say its 20% a shirt and this shirt has glitter.
>Is it best practice to apply the discount to just the shirt
>or the shirt and glitter as a combo discount.
>I know this is somewhat dependent on the owners choice
>of what he/she wants to give the discount on,
>but my question is of the programing of it.
>Do I build conditions for the shirt to get a discount applied
>then the miscellaneous charges, or combine the totals of the two,
>then apply the discount to the sum?
>
>Then lets say there is a cart discount also being applied.
>Is it best practice to apply this to the total of items then
>add the shipping, rush charges and tax, or to the total of the whole
>cart
>including shipping, rush charges then add the tax after applying the
>discount?
>
>Sorry for the run-on question, hope this makes sense enough to merit
>help.
>
>HNY,
>
>Best,
>
>Karl DeSaulniers
>Design Drumm
>http://designdrumm.com
>
>PS: Because this question could be answered by either database or
>general, is the only reason for the double post.
>Wont be making a habit of it.. :)
I would apply the discounts where they made sense from a customer POV. Would you expect a t-shirt
discount to be applied to only the base item or the product as a whole? I'd say tge whole
thing. You could have various areas in your code that apply discounts at different levels: per item,
per group of items (bogof, etc), and per basket.
Thanks,
Ash
http://www.ashleysheridan.co.uk