Welcome Guest, Not a member yet? Register   Sign In
flexi cart - A comprehensive shopping cart library for CodeIgniter

[eluser]haseydesign[/eluser]
Quote:I am trying to achieve the effect of applying unlimited number of vouchers that is based off a custom table. I have a function that calls flexi cart to put that in as a manual discount. That's when I realized it is not cumulative.

Also, on top of custom vouchers, I want to have discounts (as part of flexi cart) that can be applied to the cart summary. Currently, as I understand, it's taking the largest discount possible from the manual discounts (my custom vouchers) and the code discounts. I was hoping to achieve the effect of stacking.

@Khang via email

Since you're going the custom route, you could possibly create the summary discounts 'live' as the user is entering the custom voucher codes.

I don't know exactly how your custom voucher table is going to work, but let's say it's as follows.
The customer voucher table contains a set of voucher codes, with their own discount conditions.

When the customer adds a code to the cart, you check your custom table whether it is valid, if so, you then manually create a new discount within flexi-cart that matches the discount of the single voucher.
Then for every other valid voucher code added, delete the flexi-cart discount you just created, and create a new one that matches the discount total for your two custom vouchers.
Repeat as necessary.
To create the discounts within flexi-cart, you’re probably best off using the ‘set_discount()’ function rather than using the database discount tables.

---

P.S. I ‘think’ I remember why only one discount can be applied per summary column.
Allowing multiple discounts could lead to potential unintended discounts depending upon the order of how the discounts were applied.
For example, a $10 discount and a 10% discounts applied to a cart total of $100.

Example #1 – discount $10 first, then 10%
$100 - $10 = $90
$90 – 10% = $81

Example #2 – discount 10% first, then $10
$100 – 10% = $90
$90 - $10 = $80

This may then have caused further complications with what the correct legal implementation of tax should be under certain laws and circumstances.

Good luck


Messages In This Thread
flexi cart - A comprehensive shopping cart library for CodeIgniter - by El Forum - 03-12-2013, 04:18 AM



Theme © iAndrew 2016 - Forum software by © MyBB