Jump to content
Larry Ullman's Book Forums

Recommended Posts

Hello,

 

I have built my first e-commerce site from the knowledge gained from this book. This book has played a monumental role in the success of the site.

 

The client is now wanting to allow the use of Promo Codes, on a per product/per cart/per categoery basis etc.

 

I cant get my head round the problem.

 

Some pointers would really help me as I cant think how to add the promo code to the cart and update the price of added products after the promo code has been added etc. The Promo Codes will exist in a Vouchers table:

 

tblVoucher.png

 

Please Help

Ronnie

Link to comment
Share on other sites

Congrats on getting your site up! That's always quite an accomplishment.

 

Assuming your site structure is similar to that of Larry's 2nd example in the book, you'll probably have to perform a SQL join between the items in the cart with the vouchers table. To that end, you'll want a foreign key in the vouchers table to the items table, or something like that.

 

Once the join is working, than I imagine it's just a matter of subtracting the voucher amount from the total price of the item. You might want to also make it obvious to the user that they're saving money via the voucher, but that's something to handle on the display side of things.

Link to comment
Share on other sites

 Share

×
×
  • Create New...