Copied to clipboard

Flag this post as spam?

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


  • Paul Crowdy 39 posts 110 karma points
    Nov 10, 2021 @ 08:32
    Paul Crowdy
    0

    Deleting Orders

    Hi Matt,

    I have a site that has been live for a while with Vendr running on it (1.8.2, on Umbraco 8.14.0), but without any ecom functionality being used.

    I am now in a position where we are going to buy a licence and turn on all of the ecom functionality.

    There are currently 7 test orders visible within the Vendr admin. When I try to delete any of them the process is timing out.

    The vendrOrder table currently has 13,760,716 rows in it, which is what I assume is causing the issue.

    Do you have any suggestions?

    Thanks,

    Paul.

  • Matt Brailsford 3326 posts 17654 karma points MVP 8x c-trib
    Nov 10, 2021 @ 08:42
    Matt Brailsford
    0

    Hi Paul,

    Wow! That doesn't sound right.

    Whilst you haven't been accepting orders, have you been allowing people to make carts? If not, it sounds like there may be something wrong in your implementation potentially creating carts when one isn't needed. Generally speaking, you only really want to create a cart the first time someone adds an item to the cart.

    For you to have that many lines in the order table would suggest something is making a lot of carts.

    Let me find a SQL script that should be able to clear everything out, but in the meantime you might want to review your code to see why it's created that many orders.

    Matt

  • Paul Crowdy 39 posts 110 karma points
    Nov 10, 2021 @ 08:46
    Paul Crowdy
    0

    Hi Matt,

    The "Add To Cart" functionality hasn't been live, but.... There is a "0 items in basket" message in the header, that is using "GetOrCreateCurrentOrder(storeId)", which I guess means that every user (and bot) will be creating an order. What would be a better method of doing this?

    Paul

  • Matt Brailsford 3326 posts 17654 karma points MVP 8x c-trib
    Nov 10, 2021 @ 08:52
    Matt Brailsford
    0

    Hi Paul,

    You should really only be calling GetOrCreateCurrentOrder when you know you need to ensure an order exists, such as when you are adding items to a cart. For all other purposes where you are just displaying a current order, you should use GetCurrentOrder instead which will return null if one doesn't currently exists.

  • Matt Brailsford 3326 posts 17654 karma points MVP 8x c-trib
    Nov 10, 2021 @ 09:03
    Matt Brailsford
    0

    Ok, so I think this SQL statement should remove all your order entries

    DELETE FROM [vendrFrozenPrice];
    DELETE FROM [vendrOrderPriceAdjustment];
    DELETE FROM [vendrOrderAmountAdjustment];
    DELETE FROM [vendrOrderAppliedDiscountCode];
    DELETE FROM [vendrOrderAppliedGiftCard];
    DELETE FROM [vendrOrderLineAttribute];
    DELETE FROM [vendrOrderLineProperty];
    DELETE FROM [vendrOrderProperty];
    DELETE FROM [vendrOrderLine];
    DELETE FROM [vendrOrder];
    

    To be fair, given it's just empty cards, you could probably only need to do

    DELETE FROM [vendrOrder];
    

    There shouldn't really be any other data on the other tables, but I guess it's worth being thurough.

    Matt

Please Sign in or register to post replies

Write your reply to:

Draft