close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

having 2 discounts

Thread began 1/22/2013 1:55 pm by Christopher West | Last modified 1/24/2013 3:09 pm by Jason Byrnes | 2394 views | 15 replies |

Christopher WestCommunity Expert

having 2 discounts

Hi my client wants to add a second feature to their ecommerce website. So on the checkout page (where customers will enter their billing/delivery address they will also have the option to enter a "gift voucher code" and/or "special offer coupon code). Currently they website exists with the gift voucher code they then gets calculated by paypal etc. but I just wondered how I can integrate a coupon system based on a percentage discount....also logically the coupon percentage discount would need to be calculated before the "gift voucher" discount is applied to the order. since the gift voucher is a means of payment (since it would have been previously ordered and paid for). What would be the best way to go about having 2 different types of discounts using ecart (so the gift voucher just reduces the total order cost and the coupon take a percentage of the total items (subtotal).

Chris

Sign in to reply to this post

Jason ByrnesWebAssist

for the calculation of the coupon code discount use a flat rate, then, for example to give a 10% discount use:

$this->TotalColumn("TotalPrice") * 0.1

Sign in to reply to this post

Christopher WestCommunity Expert

Hi Jason, one query though, so the TotalPrice is BEFORE any other price concerns (such as shipping costs and also the current Gift voucher redemption I have in place). I used the Gift Voucher redemption as part of the discount part of ecart if I can remember. Im just wondering how I can include both the original gift voucher system AND the new coupon system I wish to incorporate. Plus I would need to consider the order of the calculations so the coupon discount doesnt intervere with they shipping costs and the gift voucher calculations. plus in your coupon calcuation where would i place this code on the checkout form? and I would also be allowing the admin to create their own coupon codes with different percentage values that also have an expiry date.

any guidelines appriciated on the above queries :)

Chris

Sign in to reply to this post

Jason ByrnesWebAssist

this code:
$this->TotalColumn("TotalPrice")


returns the subtotal of the Price * Quantity for each line item

it does not take into account shipping, or the other voucher code.

to have both a coupon code system and a voucher code system like this in place, you will need to have 2 forms, one to enter the coupon code and store it to a session

one to enter the voucher code and store it in a separate session

the discount rules would be triggered on the separate sessions.

if you are using a database for storing the discount percentages, you will need to have a recordset that looks up the entered coupon code, then stores the percentage in a session and use the session in the discount rule.

I can give you a broad outline here, if you need further assistance in setting this up, i suggest signing up for a premiere support appointment.

Sign in to reply to this post

Christopher WestCommunity Expert

Hi Jason thanks for the advice, I am possibly looking to setup a support ticket with Ray as I had another issue to address...however what you have given me in your reply does seem straight forward (hopefully for me to see how far I can get without a support ticket)

One thing I noted is that you mentioned 2 forms so was a little puzzled by this...as while I have been prepping to add a coupon system...where I have my form on the Checkout page there is the voucher code input box which will store the session from there...and I have now included a second input box to capture the coupon code whcih will store in a second session. So why would I need 2 forms? if I am capturing both the voucher code and coupon code on 2 seperate input boxes within the same form?

Chris

Sign in to reply to this post

Jason ByrnesWebAssist

yes, 2 input boxes in the same form should work too, the idea is to keep the two unique, 2 forms / 2 input boxes, either way, it's 6 of one....

Sign in to reply to this post

Christopher WestCommunity Expert

ok well a few issues...I have managed to get it working to an extent...but while testing came to a very odd bug... i am attaching the file in question in case there is something obvious....

the bug is: if i name a coupon with letters then the calculation comes back as the first first coupon value in the the database. if I name the coupon starting with a number then it seems to work..

in my database I have:
CouponCode VARCHAR(16) utf8_general_ci
CouponValue FLOAT

the records I current have stored in the database are:
CouponID CouponCode CouponValue
14 b 0.98
15 10th 0.1
16 20th 0.2
17 half 0.5
18 30th 0.3
19 50th 0.5
20 you 0.5
21 66 0.5
22 5half 0.5

Attached Files
checkout.zip
Sign in to reply to this post

Jason ByrnesWebAssist

in the coupon recordset, you the data type for the coupon code variable is set to int.

use Advanced view to edit the parameter and set the data type to text

Sign in to reply to this post

Christopher WestCommunity Expert

such a small mistake on my part not to notice that :(
With my other query relating to if the website admin creates a theoritical coupon value of 99% or even 100% discount. how might I overcome that (I understand why its not working since if there is a 99% or 100% discount then then subtotal would be less then £1 and paypal doesnt like that. i know somewhere i overcomed this problem with the gift vouchers. but with coupons the discount wont ever be allowed to delivery costs so if an order is below £1 then delivery cost would still need to be paid for via paypal.

Chris

Sign in to reply to this post

Jason ByrnesWebAssist

Yeah, that part will take custom coding to account for, I would suggest a premiere support ticket for that.

Sign in to reply to this post
loading

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