Jump to content

Incorrect Discount Values / Buggy Coupon System


MrDerp

Recommended Posts

Is anyone else having problems with discount values being incorrectly displayed on basket/checkout pages, as well as on order confirmation emails and the admin panel?

It has been accepted that 5.1.4 had a very buggy coupon system which appears to have been fixed in 5.1.5. However, in both versions the actual total discounted value is inaccurate, despite the grand total being correct.

If you look at the attached screenshot you can see that there are VAT display inconsistencies (the developers have said that they may rewrite the VAT module for 5.2.0) but the biggest issue is the "Total Discount" value. The "Grand Total" in this instance is correct, but - unless I have the mathematical ability of a 2 year old - £100 minus £4.17 does not equal £90.

For anyone using the coupon system, how are you getting around this problem? The developers don't see this as an urgent issue, so can anyone advise how to deal with this in the meantime?

To compound this problem, I have also noticed that when an order goes from a "pending" to "processing" state, the discounted value is recalculated...once again, incorrectly.

Was this system even tested?

Link to comment
Share on other sites

The frustrating thing is that there is probably a really simple fix - the correct discount value is being used in the background as the grand total is correct, so how do we get this to display in the template file?

Anybody with a bit of technical expertise have any ideas?

Link to comment
Share on other sites

MrDerp, please mention the name of the skin in your sig, although discussing any problems that it may be contributing will be over at the other forum.

You may also be assuming that everyone here has a complete understanding of your tax laws - that would be wrong.

Would you please give us a clue as to how a subtotal of 75 comes from 100. Please mention if your tax laws require taxes be included in displayed prices. How is VAT calculated? What is the 10% figure? Is that the coupon? Please mention what aspects of the order the 10% applies to: only one of the two items?, the subtotal?, including/excluding VAT?

Link to comment
Share on other sites

I've updated my signature as requested.

I'm UK-based and therefore we attract a standard VAT rate of 20%. Not all of our products attract VAT (we act as an agent on behalf of the artists for our original works) but the product shown in the screenshot does attract VAT at the aforementioned rate.

That's the thing - shouldn't this system make it clear where that subtotal comes from? Anyone that looks at the checkout/receipt screens should instantly be able to grasp how the calculations have been derived.

The subtotal of £75 comes from a total price of £100, minus the 10% discount, minus VAT (100 - 10 - 15). This isn't as issue specific to any one skin - it is an issue related to the fact the classes don't offer enough variables. For example, there doesn't seem to be an option (without customising the classes) to display a line price inc. VAT AND exc. VAT.

Back to the discounts, again, the classes don't offer up a discount price inc. VAT and exc. VAT. Nor do they multiply the discount by the quantity of the products purchased, which is extremely frustrating and looks plain unprofessional (hence my frustration at the lack of testing).

Link to comment
Share on other sites

That's quite odd, I've had a run through the 5.1.5 code and as far as I can tell, it should be printing out the discount correctly.

The only thing I can find which might be a discrepancy is on cubecart.class.php, line 1330, where it grabs the basket

$contents = $GLOBALS['cart']->get();

That function there recalculates the grand totals and discounts.. however, the discount actually being printed out references: $this->_basket['discount'], which has not been updated.

I suspect that $this->_basket is getting populated somewhere higher up, with the correct initial values, then the cart->get function is being called multiple times, and it's further diluting the discount somehow.. the discounts also seem to get called cumulatively, which is also a bit confusing.. far as I can tell, the first time it runs it'll run off £100 subtotal. The next it will run off £100 - £10 discount and calculate the discount as £9, then add that onto the discount level (making it then £19)

.. which is fine in theory, and explains why some of the values might be different from some of the others.. .. except I haven't got a clue how it's managed to end up at £4.17 .. if anything it should be going up, not down

Edit: .. no it isn't, got myself confused didn't I.. if anything, if $this->_basket is being correctly calculated earlier, the discount should be correct also, if anything it's the subtotals and grand total that should be wrong.. sadly I've got no idea other than printing out a lot of debugging info and trying to track it down that way

Edited by Toucan Web Design
Link to comment
Share on other sites

Many thanks for taking the time to look at the code - it's much appreciated.

I can contact the support team again but they were reluctant to look at this until the release of 5.2.0, so I'm a bit stuck really! What surprises me more than anything is that more people haven't come across this problem, which I'm guessing is a combination of not many people running CC 5 and a large percentage of those not using coupons (or people not noticing as their systems haven't been tested since upgrading).

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...