close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues


Coupon subtracting odd amount! :(

Thread began 3/15/2012 6:02 am by Christopher West | Last modified 3/15/2012 5:42 pm by Christopher West | 647 views | 6 replies |

Christopher WestCommunity Expert

Coupon subtracting odd amount! :(

Hi there, I followed your tutotials on setting up a coupon system on my ecart (including the setup of a recordset to hold coupons).

but for some reason its producing odd results:

for example:

Item cost £33 I add 3 of these to shopping cart (so total is £99)
the coupon is £10
but in my shopping basket it would display £89 for the discount
Then the grand total would be £10
This doesnt make any sense. Obviously ecart is using the maths of subtracting the coupon from the subtotal AND THEN subtracting this new figure again from the subtotal. But how if I followed your tutorial closely.

I am using product options (this was put together with the massive help from Ray). I am wondering if its anything to do with that?

Any ideas?


Sign in to reply to this post

Jason ByrnesWebAssist

it's imposible to tell what the problem is without first doing some debugging.

to help troubleshoot, create a new blank page and add a eCart display manager to it.

on the second step of the display manager wizard, click the plus button and select the option to show all column.

on the third step of the display manager wizard, set the Discounts, shipping, taxes, and charges to Show individually.

this will create a cart display page that gives a more complete view of the cart details.

on this page, add the following code just before the </body> tag to show the session contents:

<pre><?php var_dump($_SESSION); ?></pre>

send a link to your site and steps to reproduce the problem, a link to the new cart display page for troubleshooting, and a copy of the cart object file in the WA_eCart folder in a zip archive.

Sign in to reply to this post

Christopher WestCommunity Expert

Hi Jason, I have done what you asked (I just need to sort something on the upload though as its not going to checkout as I had to change the code to do what you asked) But here is the link anyway: cart.php

also I am attaching the files (and a few extra) as you requested.

I am able to reproduce the problem.



Attached Files
Sign in to reply to this post

Jason ByrnesWebAssist

can you please provide steps i can use to reproduce the problem in order to troubleshoot.

What do i add to the cart?

what is the coupon code?

what steps do i need to perform on your site in order to see the problem?

Sign in to reply to this post

Christopher WestCommunity Expert

Hi there, the coupon codes that can be used are:

coupon10 (takes of £10)
coupon20 (takes off £20)

to reproduce the error - just add to cart any product that I have assigned £10 to. so the first 4 categories of products.
for my test I chose:
Individual Charms -> Large Daisy Charm
Decorative Charms - > Bubble Heart Charm
Bracelets -> Ball Bracelet
The grand total for the above is £30
I added a the coupon code (next to checkout button) : coupon10

if you then look at discounts its £20 (when its suppose to be £10 as the value of coupon10 is £10)

also if you keep adding more products the discount is then incremented by £10

also another test if you just begin with 1 item (£10) and trhen add a coupon code (coupon10) then checkout - it does NOT take any discount off.

Does this extra info help (sorry I should have been more detailed)


Sign in to reply to this post

Jason ByrnesWebAssist

in the eCart object, you have set the discount calculation as:

"Based on Cart Subtotal"
subtotal of cart "minus" $_SESSION['PromoAmount']

if you enter "coupon10" this sets the PromoAmount at 10,

so you are telling the cart:

set the total of the discount to subtract from the cart at "<subtotal> - 10"

if you only have a 10 products in the cart, it means:

10 - 10

which equals a discount of $0.

if the cart subtotal is 70:
70 - 10 = 60

the discount becomes $60

instead of "Based on Cart Subtotal", use a flat rate discount of "$_SESSION['PromoAmount']"

the reason you ran into the problem on following the tutorial is that you are using a different type of discount, yours is a flat rate discount, the example in the tutorial is for a percentage based discount.

the tutorial is doing a 10% discount (subtotal * 0.10), whereas you are doing a flat rate of£10 or £20

Sign in to reply to this post

Christopher WestCommunity Expert

Absolutely amazing for your help :) you guys on this support forum and the webassist ticket system are totally appriciated :)

I do have another concern which I will create another thread as its slightly different :)

(but I am slowly learning) :)


Sign in to reply to this post

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