Copied to clipboard

Flag this post as spam?

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


  • Niall McCabe 8 posts 78 karma points
    Oct 06, 2016 @ 09:30
    Niall McCabe
    0

    CurrentOrderNumber resets to 20

    I am having an issue where, in the Tea Commerce section of the back office, the order number of each new order coming in is set to 21. It seems that the CurrentOrderNumber field in the Store table keeps resetting to 20.

    I’ve tried updating this to 0, 1, 100, random number etc. with no effect, the database will update but every time a new order comes in it resets back to 20. Each time I’ve updated the database I’ve restarted the website. Can you provide any info? Any help would be much appreciated, thanks.

    The instance of Tea Commerce is fully licensed if that helps.

  • Anders Burla Johansen 2560 posts 8256 karma points
    Oct 06, 2016 @ 10:13
    Anders Burla Johansen
    0

    Do you have a DB trigger that resets it or maybe some custom code that runs in debug mode that resets it to 20?

    When an order is finalized it does this:

    OrderNumber = store.OrderSettings.OrderNumberPrefix + store.GetNextOrderNumber( true );
    Save();
    

    The GetNextOrderNumber method does this on a store object.

     CurrentOrderNumber++;
     orderNumber = CurrentOrderNumber;
    
     Save();
     return orderNumber;
    

    Do you do any load balacing or something more complex that could impact it?

  • Niall McCabe 8 posts 78 karma points
    Oct 06, 2016 @ 10:38
    Niall McCabe
    0

    Hi Anders

    I figured that was all that the Order Number generation was doing. There isn't any custom code or a DB trigger, but a load balancer is used to separate the cms instance from the site, but there is only one DB, so I'm not sure how it could impact.

  • Anders Burla Johansen 2560 posts 8256 karma points
    Oct 06, 2016 @ 10:51
    Anders Burla Johansen
    0

    TC has a caching layer that caches the objects when fetched from the DB. Maybe that is the problem when load balancing??

  • Niall McCabe 8 posts 78 karma points
    Oct 06, 2016 @ 10:57
    Niall McCabe
    0

    Could be an issue, how is best to clear the cache from this caching layer?

  • Anders Burla Johansen 2560 posts 8256 karma points
    Oct 06, 2016 @ 12:24
    Anders Burla Johansen
    0

    You can call TeaCommerce.Api.Infrastructure.Caching.CacheService.Instance.Invalidate("Stores")

  • Niall McCabe 8 posts 78 karma points
    Oct 06, 2016 @ 15:43
    Niall McCabe
    0

    The TC caching layer doesn't seem to be interfering with the load balancing. Make a call to the CacheService.Instance.Invalidate("Stores") didn't help.

    One thing I have noticed is that the CurrentOrderNumber will reset without a finalized order having gone through. Unless there are methods on the order object that can reset the CurrentOrderNumber, I am stumped.

  • Anders Burla Johansen 2560 posts 8256 karma points
    Oct 07, 2016 @ 10:16
    Anders Burla Johansen
    0

    There is nothing in Tea Commerce that resets the CurrentOrderNumber. So the only thing is that one server finalizes the order and the CurrentOrderNumber is 20 at that shop where the shop where the order is created and where your add products to the cart runs with a different number. So somehow they things are not aligned correctly.

    Kind regards

    Anders

Please Sign in or register to post replies

Write your reply to:

Draft