close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

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 Ray Borduin | 1189 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.

Chris

Sign in to reply to this post

Ray BorduinWebAssist

I think when it comes to complex couponing like you are describing it becomes easier to do all of the logic in PHP and save the final coupon amount in the session and then just use a rule to discount the amount stored in the session. I feel like it would be more difficult to do with the rules wizard alone and it may not even be possible that way alone.

Sign in to reply to this post
Did this help? Tips are appreciated...

Christopher WestCommunity Expert

So in essence all I need to do is load everything in sessions and then use these sessions in my recordset to return the correct discount record.

Sign in to reply to this post

Ray BorduinWebAssist

Yes. I'd go ahead and calculate the discount total and save it in the session and then just do a flat rate discount of the value of that session variable when it is set.

Sign in to reply to this post
Did this help? Tips are appreciated...

Christopher WestCommunity Expert

I can do the exact same process for delivery as well since my delivery calculation is based on postcode (which is corresponds to zones around the country) max weight and max width, height and depth of parcels)

Sign in to reply to this post

Ray BorduinWebAssist

Yes that is a good idea as well. Just look up the delivery amount and save it in the session.

Sign in to reply to this post
Did this help? Tips are appreciated...

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

Content

rating

Layout

rating

Ease of use

rating

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...