New year - new issue :) I have a site that before xmas was apparently working fine but at some point over the xmas period stopped letting users (at least some) apply coupons. No exceptions were being logged, no errors shown in the browser or console and all coupon constraints criteria were met.
By chance, I discovered that if I cleared my cookies and refreshed the site in order to start a fresh basket, I could apply the coupon codes again. Any ideas why? It's like the basket went stale and something, therefore, prevented the coupon codes being applied to existing baskets?
I think this may have to do with http://issues.merchello.com/youtrack/issue/M-1264 - I've refactored things to not store as much data in the Merchello cookie - but you bring up a good point that I should check to see coupons are clearing properly after the change.
I've verified that no changes are necessary with the way coupon offer codes are temporarily persisted as a result of the Merchello cookie / CustomerContext changes for the http://issues.merchello.com/youtrack/issue/M-1264 fix.
The site in question is running v2.2.0 so wouldn't be affected by your change but at the same time could be a potential victim of the problem identified in that issue. What could cause the cookie to become too large over time?
The issue really only started popping up lately so I'm not 100% certain (and have not gone back to check earlier versions). Just speculating - but one suspect would be the original recently viewed implementation.
Note it is sort of a compound issue since the total size is subject to all cookies in the domain so it may not be solely a function of Merchello's code. The issue arises with the decryption of the Merchello cookie - e.g. even if the Merchello cookie has not grown in size it's encrypted value cannot be stored in it's entirety resulting in a failed decryption on a request ...
If there was a failure to decrypt the cookie would that not result in an exception being logged somewhere? Would that not cause the contents of the basket to appear empty?
Is there any further information I can provide to help identify the exact cause and ensure that it is addressed?
Further to my earlier update, another discount code has been reported not to work on the same site. I could see the problem for myself yet the only way to kick the site into recognising it was to bump the web.config.
I have a sneaky feeling that perhaps things are being persisted into the MerchelloContext (or elsewhere) which are not refreshed when certain actions are initiated on the site such as editing and saving discounts. Does that idea hold any weight?
It's using CheckoutManager. More specifically, the controller that handles the application of a discount code inherits directly from CheckoutDiscountControllerBase - there is no custom implementation or overriding of any of its methods.
Do you mean the CheckoutManagerInvoiceCreate task chain?
If so, yes, there is a custom ValidateCommonCurrency task for normalising the currency of items in the basket. Aside from that the rest are stock tasks and config looks as follows:
Coupon Codes Not being Applied Until After Cookies Are Cleared
Happy New Year guys!
New year - new issue :) I have a site that before xmas was apparently working fine but at some point over the xmas period stopped letting users (at least some) apply coupons. No exceptions were being logged, no errors shown in the browser or console and all coupon constraints criteria were met.
By chance, I discovered that if I cleared my cookies and refreshed the site in order to start a fresh basket, I could apply the coupon codes again. Any ideas why? It's like the basket went stale and something, therefore, prevented the coupon codes being applied to existing baskets?
Cheers, Simon
I think this may have to do with http://issues.merchello.com/youtrack/issue/M-1264 - I've refactored things to not store as much data in the Merchello cookie - but you bring up a good point that I should check to see coupons are clearing properly after the change.
I've verified that no changes are necessary with the way coupon offer codes are temporarily persisted as a result of the Merchello cookie / CustomerContext changes for the http://issues.merchello.com/youtrack/issue/M-1264 fix.
Hi Rusty,
The site in question is running v2.2.0 so wouldn't be affected by your change but at the same time could be a potential victim of the problem identified in that issue. What could cause the cookie to become too large over time?
Thanks, Simon
The issue really only started popping up lately so I'm not 100% certain (and have not gone back to check earlier versions). Just speculating - but one suspect would be the original recently viewed implementation.
Note it is sort of a compound issue since the total size is subject to all cookies in the domain so it may not be solely a function of Merchello's code. The issue arises with the decryption of the Merchello cookie - e.g. even if the Merchello cookie has not grown in size it's encrypted value cannot be stored in it's entirety resulting in a failed decryption on a request ...
Hi Rusty,
I've created an issue to track this now:
http://issues.merchello.com/youtrack/issue/M-1268
If there was a failure to decrypt the cookie would that not result in an exception being logged somewhere? Would that not cause the contents of the basket to appear empty?
Is there any further information I can provide to help identify the exact cause and ensure that it is addressed?
Cheers, Simon
Further to my earlier update, another discount code has been reported not to work on the same site. I could see the problem for myself yet the only way to kick the site into recognising it was to bump the web.config.
I have a sneaky feeling that perhaps things are being persisted into the MerchelloContext (or elsewhere) which are not refreshed when certain actions are initiated on the site such as editing and saving discounts. Does that idea hold any weight?
Cheers, Simon
The discount data is actually stored in the Customer's (or Anonymous Customers extended data collection). https://github.com/Merchello/Merchello/blob/merchello-dev/src/Merchello.Core/Checkout/CheckoutOfferManagerBase.cs#L145
It could be related to the cookie in the sense that the cookie stores the customer key - but that would also affect the basket relation.
Are you using a checkout manager or the deprecated salespreparation?
It's using CheckoutManager. More specifically, the controller that handles the application of a discount code inherits directly from
CheckoutDiscountControllerBase
- there is no custom implementation or overriding of any of its methods.Have you altered the invoice builder chain in any way?
Do you mean the
CheckoutManagerInvoiceCreate
task chain?If so, yes, there is a custom
ValidateCommonCurrency
task for normalising the currency of items in the basket. Aside from that the rest are stock tasks and config looks as follows:I don't think that is it - especially since it is firing after the discounts should be being added.
Can you look at the customer's extended data collection after you've added the discount and verify that the offer codes are saved?
Should I expect to see it in the
merchOfferCodeTempData
element? If so it looks like this:Yes - when I run it in my install (using offer code "test") I get:
<merchOfferCodeTempData>{"VersionKey":"24269447-0a61-41c6-83bd-3ef197d024da","Data":["test"],"ResetWasCancelled":false}</merchOfferCodeTempData>
is working on a reply...