close ad
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

discount calculations in ecart object

Thread began 7/09/2016 5:39 am by Christopher West | Last modified 7/12/2016 3:15 pm by Christopher West | 1255 views | 5 replies

Christopher WestCommunity Expert

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.


Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question





Ease of use


security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...