Copied to clipboard

Flag this post as spam?

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


  • Marcus Maunula 229 posts 386 karma points
    May 24, 2022 @ 17:47
    Marcus Maunula
    0

    Getting all unprocessed Orders?

    Trying to find a service method to GetAllOrders or at least All Finalized Orders not processed yet. But I only seem to be able to GetAllOrders with known ids.

    The idea is to make a custom dashboard in the backoffice so I can list some of the custom properties.

    Maybe: GetOpenOrdersForAllCustomers(storeid)

  • Matt Brailsford 4125 posts 22222 karma points MVP 9x c-trib
    May 25, 2022 @ 07:38
    Matt Brailsford
    100

    Hey Marcus,

    For that you'll need to use the SearchOrders method. Something like this should get you what you want I think.

    _orderService.SearchOrders(
            (where) => where.FromStore(storeId)
                .And(where.IsFinalized().Not()),
            1, 10);
    
  • Michele Benolli 31 posts 149 karma points
    Jul 20, 2022 @ 12:17
    Michele Benolli
    0

    Hi Matt, I'm actually using the code above to get all the "active" orders, but we have 700+ non-finalized orders and the method results to be very slow (4-5 seconds). Do you have any suggestion to improve the search?

    var orders = _orderService.SearchOrders((x) => x
                .FromStore(storeId)
                .AndNot(x.IsFinalized()), 1, int.MaxValue).Items;
    
  • Matt Brailsford 4125 posts 22222 karma points MVP 9x c-trib
    Jul 20, 2022 @ 13:15
    Matt Brailsford
    0

    HI Michele,

    I'd suggest going through the Vendr DB tables and adding indexes on all the connected order entities (discounts, price adjustments etc) as this is likely the issue.

    We'll be adding indexes in an upcoming release as we've done some tests on them now to know the have benefit.

    Basically anywhere order ID is used as a foreign key, add a db index on them.

Please Sign in or register to post replies

Write your reply to:

Draft