Jump to content

Coupon Codes not working.


jdmdecals

Recommended Posts

if i create a new coupon. *since the current update it does not work.

if i try to use a old coupon *that was created before the update it works.

if i edit a *old coupon (example change the % off) the old coupon no longer works..

has anyone else experienced this issue.

Link to comment
Share on other sites

There is a new function in CC515 as it pertains to having the choice to assign a coupon to be valid for selected products, as well as being valid for all but selected products.That is, to include these products for this coupon, or to exclude these products for this coupon.

When you say the coupon does not work, are you, in fact, using a coupon valid for/against specific products (as opposed to being valid for the whole order in general)?

Please try this:

In the file /classes/cart.class.php near line 1108, find:

$incexc = array_shift($products);

On that same line, after the current statement, append this

if(is_numeric($incexc)) {array_unshift($products, $incexc);$incexc = 'include';}

The current code is a test to determine if the product is included for this coupon, or excluded from this coupon. The problem is that legacy coupons (coupons created in CC514 and earlier) do not have the include/exclude flag and the code makes no allowance for the missing flag.

My concern is that, according to your description of what works and what doesn't, I would expect the old coupon to not work, yet you say it does. And new coupons (or edited old coupons) should work, yet you say they do not.

Again, the above may be relevant to coupons only assigned to products, as opposed to coupons applied to the whole order.

Link to comment
Share on other sites

The only coupon codes i use on my site are % off coupons for Everything. no products excluded.

coupon code: return ( gets customers 10% off everything. )

I updated from 5.1.4 to 5.1.5

I will try what you sujested this weekend. thanks.

But yes, If i try to edit a coupon made in 5.1.4 and older (edit the %off . meaning.. chang the discount from 5% to 10% off everything) the coupon no longer works. I also tested another old coupon by changing the coupon code from (return) to (ReturnCustomer) and the code no longer now works.

making a NEW coupon does not work.

Link to comment
Share on other sites

Using latest version - 5.1.5. My client created two new coupon codes (and had them published in a magazine) but didn't assign specific products and assumed that the coupons would therefore apply to everything. Then started receiving customer complaints that the coupons were not working.

The coupons were created after upgrading from 5.1.4 so no issues with legacy code. In the Advanced/Maintenance/Upgrade tab it says: "Your store is currently using the latest version. Please click force upgrade to restore to the default code for this version." I haven't clicked "force upgrade" as I was unsure what it woud do the site so don't know if this is part of the problem.

It seems you have to specify exactly which products the coupon discount applies to. Think this should be made clearer in the admin area. Cubecart has no official documentation so help notes in the admin area are all some clients have to go on. It might also be preferable to be able to apply the discount code to a specific category as it is laborious adding lots of products, especially as you have to enter the product name precisely rather than choose from a list.

Link to comment
Share on other sites

Welcome redsun! Glad to see you made it to the forums.

May we have a more precise description of "the coupons were not working"? Can you tell us what error messages, if any, were shown; any indication at all, or was it that the money amount simply was not taken off the total with no indication as to why at all?

Link to comment
Share on other sites

Thanks for the welcome. I've been using CubeCart since v4 but never got round to joining the forum.

The error message shown at the top of the Shopping Basket page was "The following errors were detected: Sorry, that voucher is not valid for the items in your basket." My client has now added the individual products to the coupon so all is now working as expected. As stated in my original post, I think the issue was more to do with the assumption that not assigning specific products would mean that coupon discounts would apply to all products.

Link to comment
Share on other sites

Ok, I think I've found the programming logic error.

(I really should get my CC515 package installed.)

Would someone conduct an experiment for me?

In the file /admin/sources/products.coupons.inc.php, at around line 52, find:


  array_unshift($_POST['product'], $_POST['incexc']);

  $record['product_id'] = serialize($_POST['product']);





Make it look like this:



  if (!empty($_POST['product'])) array_unshift($_POST['product'], $_POST['incexc']);

  $record['product_id'] = serialize($_POST['product']);

Link to comment
Share on other sites

I don't want to make any changes at the moment as the coupons are active on a live store and the client has just spent a bit of time adding all the products into the coupon, but I'll try this later next month when the offers are over.

Many thanks for the solution bsmither and to Dirty Butter for carrying out a test (and reminding me to add my version info to my signature - apologies). Having only just joined the forum I'm really impressed by the speed of response to enquiries - thanks again!

Link to comment
Share on other sites

Dirty Butter: Correction to the experiment ---

Make a new coupon in CC515, but be sure to not assign any products to it. That is, this coupon should apply to the whole order.

Because I'm not sure the CC515 code takes into account a CC515-style coupon that is not related to a product.

A CC515-style coupon incorporates a 'include/exclude' flag for the products assigned to it.

Link to comment
Share on other sites

Just to add to this, it appears that fixed price discounts do not work at all in 5.1.5.

There are also rounding issues with the discounts - I've just tried to take 10% off a product with a cost of £22.50, the discount was calculated at £2.26 and the grand total was £20.26!!

I get the impression these kind of bugs are not being taken seriously but it makes the store look very unprofessional - these are simple calculations that the software shouldn't be getting wrong. Very frustrating.

Link to comment
Share on other sites

  • 2 weeks later...

I've been experimenting, and my best guess as to where the problem with the discount calculation is occuring is based on a combination of PHP's number_format() function doing some rounding, plus perhaps there is a currency conversion happening.

In the Currencies list, comparing the default currency of the store (or, more specifically, the currently selected currency of the logged-in customer) with Pound Sterling, is there a conversion rate that is not exactly 1.00000?

My experiments show that a price of 22.50, with a conversion rate of 1.005, rounded by price_format(), will get 2.26.

I have no theories as yet on your comment about fixed money discounts not working at all.

Link to comment
Share on other sites

Hi folks

Still having problems with coupon codes, and one of my clients is using them heavily in the run-up to Christmas. This is becoming a major headache and I would hope this can be resolved as soon as possible. My decision to recommend CubeCart to my client is starting to weigh very heavily against me.

In "orders/items" the totals are incorrect. £6.29 + £6.29 = £12.58 (not £12.59). The total discount should be £3.77 (not £5.39 at 43%!). I can't figure out why CubeCart is increasing the percentage discount. It even happens on orders of single items so doesn't appear to be caused by multiple items in the basket. (NB: in the example below the shipping is high because the delivery is to Asia - this isn't an error)

Any ideas for a quick fix? I'd normally not want to amend core code but in this instance may not have the option. Please help!

cc_sg_01.png

cc_sg_02.png

Link to comment
Share on other sites

RedSun - I'm having the exact same issues. I have logged multiple support calls regarding this but the development team have informed me that they're not prepared to look at this until the next release.

Personally, I think this warrants a much more prompt response as it is an urgent problem that is having a massive impact on orders - it makes our site look extremely unprofessional and is bound to put people off.

It is clear that the testing of the coupon module was extremely lacklustre (in fact, I'd hazard a guess that it wasn't tested at all).

Link to comment
Share on other sites

Couldn't agree more with McDerp, however, I think the problem may thankfully be restricted to the admin area.

Apologies if I seemed to be panicking but I intially thought that the whole thing was behaving incorrectly. The "admin/orders" section is showing the already-discounted value of items and the discount as 43% however the totals are correct when compared to the discount applied on the front end through the customer's basket.

Link to comment
Share on other sites

I've been experimenting, and my best guess as to where the problem with the discount calculation is occuring is based on a combination of PHP's number_format() function doing some rounding, plus perhaps there is a currency conversion happening.

In the Currencies list, comparing the default currency of the store (or, more specifically, the currently selected currency of the logged-in customer) with Pound Sterling, is there a conversion rate that is not exactly 1.00000?

My experiments show that a price of 22.50, with a conversion rate of 1.005, rounded by price_format(), will get 2.26.

I have no theories as yet on your comment about fixed money discounts not working at all.

The conversion rate is 1.00000. I am only allowing sterling transactions, so it can't be related to currency conversion. It looks like a rounding issue somewhere in one of the classes, but where?!

Link to comment
Share on other sites

Almost, if not all, of the currency manipulations are done in the Tax class.

For the store front-end, calculating and applying discounts from coupons, gift certificates, and whatever else may be in place is handled in the Cart class. Any discounts that are assigned to a product(s) are applied to the product price first. Then, any discounts that can be applied to the whole order (such as reducing the shipping costs) are handled.

To apply a discount to a product, the equations are very straightforward. For example:

$discount = $price*($value/100); // Value is coupon percent off

$price -= $discount;

Link to comment
Share on other sites

Any ideas on the fixed priced coupons? I completely missed this thread and set up/sent out several fixed price coupons. I was able to adjust one to a percentage since it applied to a specific item, but the other is for any purchase.

Will your code update fix that?

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