Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Simon Dingley 1470 posts 3427 karma points c-trib
    Jan 06, 2017 @ 13:04
    Simon Dingley
    0

    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

  • Rusty Swayne 1655 posts 4993 karma points c-trib
    Jan 06, 2017 @ 16:27
    Rusty Swayne
    0

    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.

  • Rusty Swayne 1655 posts 4993 karma points c-trib
    Jan 06, 2017 @ 17:02
    Rusty Swayne
    0

    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.

  • Simon Dingley 1470 posts 3427 karma points c-trib
    Jan 06, 2017 @ 16:32
    Simon Dingley
    0

    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

  • Rusty Swayne 1655 posts 4993 karma points c-trib
    Jan 06, 2017 @ 16:46
    Rusty Swayne
    0

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

  • Simon Dingley 1470 posts 3427 karma points c-trib
    Jan 09, 2017 @ 11:02
    Simon Dingley
    0

    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

  • Simon Dingley 1470 posts 3427 karma points c-trib
    Jan 09, 2017 @ 14:15
    Simon Dingley
    0

    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

  • Rusty Swayne 1655 posts 4993 karma points c-trib
    Jan 09, 2017 @ 16:56
    Rusty Swayne
    0

    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?

  • Simon Dingley 1470 posts 3427 karma points c-trib
    Jan 09, 2017 @ 21:00
    Simon Dingley
    0

    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.

  • Rusty Swayne 1655 posts 4993 karma points c-trib
    Jan 09, 2017 @ 21:07
    Rusty Swayne
    0

    Have you altered the invoice builder chain in any way?

  • Simon Dingley 1470 posts 3427 karma points c-trib
    Jan 09, 2017 @ 21:47
    Simon Dingley
    0

    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:

    <taskChain alias="CheckoutManagerInvoiceCreate">
        <tasks>
            <task type="Merchello.Core.Chains.InvoiceCreation.CheckoutManager.AddBillingInfoToInvoiceTask, Merchello.Core" />
            <task type="Merchello.Core.Chains.InvoiceCreation.CheckoutManager.ConvertItemCacheItemsToInvoiceItemsTask, Merchello.Core" />
            <task type="Merchello.Web.Workflow.InvoiceCreation.CheckoutManager.AddCouponDiscountsToInvoiceTask, Merchello.Web" />
            <task type="Merchello.Core.Chains.InvoiceCreation.CheckoutManager.ApplyTaxesToInvoiceTask, Merchello.Core" />
            <task type="MySite.Infrastructure.Chains.InvoiceCreation.CheckoutManager.ValidateCommonCurrency, MySite.Infrastructure" />
            <task type="Merchello.Core.Chains.InvoiceCreation.CheckoutManager.AddInvoiceNumberPrefixTask, Merchello.Core" />
            <task type="Merchello.Web.Workflow.InvoiceCreation.CheckoutManager.AddNotesToInvoiceTask, Merchello.Web" />
        </tasks>
    </taskChain>
    
  • Rusty Swayne 1655 posts 4993 karma points c-trib
    Jan 09, 2017 @ 21:59
    Rusty Swayne
    0

    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?

  • Simon Dingley 1470 posts 3427 karma points c-trib
    Jan 11, 2017 @ 19:52
    Simon Dingley
    0

    Should I expect to see it in the merchOfferCodeTempData element? If so it looks like this:

    <merchOfferCodeTempData>{"VersionKey":"6f8bff7b-91be-4b5d-97a6-c96494c5e031","Data":[],"ResetWasCancelled":false}</merchOfferCodeTempData>
    
  • Rusty Swayne 1655 posts 4993 karma points c-trib
    Jan 11, 2017 @ 21:35
    Rusty Swayne
    0

    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>

Please Sign in or register to post replies

Write your reply to:

Draft