tags:

views:

125

answers:

5

OK my client wants to show a buy both feature in the cart, if they have 1 particular item type in the cart they want it to show up for another particular item type so if they buy both they can save $50 off the total. I am trying to wrap my head around what would be the best way to set this up so it couldn't be easily hacked (ie: adding both to the cart then removing one and keeping the discount)

does anyone have some general ideas in theory?

Thanks.

+5  A: 

Why not perform the check right before they submit the order? that way, everytime they get to the submit order page, it will check if both items are present.

phsr
And every time the cart is displayed.
Csaba Kétszeri
A: 

Are they using a system already, or is this a custom job on your part?

Kalium
+1  A: 

usualy it'd done by creating a new bundle item. It's a bit dirty but works :)

Alekc
+2  A: 

easy enough - always calculate the final price on the fly based on the current cart contents. The issue you mention seems like it would only be a problem if you were calculating the final price and caching it somehow.

Eric Petroelje
A: 

Add the discount to the cart and use another table to keep track of the discount's dependencies. Whenever an item is removed from the cart, check to make sure the discount is still valid. If it is, great. If not, remove it and recalculate the cart price.

geetee