discount calculations in ecart object
Hi there, I am looking at the ecart object to setup coupon discounts. And wanting to see if I can do it completely in the ecart object OR just setup a php page to do the calculation on its own? I am attaching a screenshot of the choices I have available.
I have varying coupon discounts that the client can set up in the admin. these form the following conditions:
CouponType = Either Percentage or Flat Discount in £ (stored as a tinyint)
CouponDiscount = This is a float number which will be determined by CouponType
CouponGroup = Either; All Products, Sale Category or Delivery (so the discount can be applied to any products, I have setup a checkbox in the products table to suggest if it belongs to a sale category, or the discount is only applied to delivery cost).
In the ecart Object I have also created column for ProductSale as a number (this then allows me to use the ProductSale field in my product table)
Now lets say I want to setup a coupon discount calculation in the ecart object. Which options would I need to select for example:
(1) Any Product with the ProductSale checkbox ticked and with a 10% discount. (The 10% value needs to come from the database I guess I would stored as a session)
(2) Any Product with the ProductSale checkbox ticked and with a £10 discount. (The £10 value needs to come from the database I guess I would stored as a session)
Obviously I would need to write more conditions based on the variations of CouponType, CouponDiscount and CouponGroup.
My problem is with logic, for example if there are 5 items in the basket and 3 of them are flagged as ProductSale=True then I would want the discount of say £10 to be taken off each of those rather than the sum total? I did a basic test of 2 sale items in my basket and it only took off £10 rather than £20 (since 2 sale items with £10 discount would = £20).
I am wondering if these condition are are possible directly in ecart object?
I would stored my recordset values from the coupon table as session variables.
Please advise.
Chris