Copied to clipboard

Flag this post as spam?

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


These support forums are now closed for new topics and comments.
Please head on over to http://eureka.ucommerce.net/ for support.

  • Basil 33 posts 53 karma points
    Oct 03, 2012 @ 07:48
    Basil
    0

    Order Status to Completed

    Is it possible to move a bulk amount of orders to the completed node? I think just changing the OrderStatus of purchase order will not be enough, there is pipeline configured 'ToCompletedOrder' to execute when status changing to completed, whats happening behind the seens of  this pipeline, is there a way to update the status using sql query? or any other way?

     

    Its very urgent, can anyone help on this please?

  • Søren Spelling Lund 1797 posts 2786 karma points
    Oct 10, 2012 @ 09:02
    Søren Spelling Lund
    0

    Hi Basil,

    Sure it's possible. You can use the IOrderService to do it. Here's a sample:

    var existingOrderStatus = OrderStatus.Get((int)OrderStatusCode.New);
    var newOrderStatus = OrderStatus.Get((int)OrderStatusCode.CompletedOrder);
    var purchaseOrders = PurchaseOrder.All().Where(x => x.OrderStatus == existingOrderStatus).ToList();

    // This guy handles the status change including running any configured pipeline
    var orderService = ObjectFactory.Instance.Resolve<IOrderService>(); 

    foreach (var order in purchaseOrders)
    {
      orderService.ChangeOrderStatus(order, newOrderStatus);
      order.Save();
  • Basil 33 posts 53 karma points
    Oct 10, 2012 @ 09:07
    Basil
    0

    OK thanks Soren, so i have to build a custom form to do this, no way to update this by running a SQL query?

  • Søren Spelling Lund 1797 posts 2786 karma points
    Oct 17, 2012 @ 10:26
    Søren Spelling Lund
    0

    You can do SQL but you won't get the pipeline executed. If you just need the statuses updated that's fine. By default uCommerce will acquire any outstanding payments for you as part of the process, but you might not need that.

  • Tom 713 posts 954 karma points
    Mar 12, 2014 @ 05:28
    Tom
    0

    Hi Soren,

    Just wondering if you can use the IOrderService in a console app? I'm looking to output a csv of all order lines from orders with a status of new? alternatively does the OrderService require some kind of context? are there any more samples of getting started with the various services/API?

  • Jesper Nielsen 141 posts 498 karma points
    Mar 14, 2014 @ 09:14
    Jesper Nielsen
    1

    Hi Tom,

    Yes you can. :-)

    Please take a look at this blog post about using the uCommerce API's in an Application.

    You can take a look at the uCommerce documentation site for other samples and articles

    Kind regards,

    Jesper

  • Tom 713 posts 954 karma points
    Mar 16, 2014 @ 22:35
    Tom
    0

    Thanks Jesper!

Please Sign in or register to post replies

Write your reply to:

Draft