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.

  • Martin 44 posts 66 karma points
    Dec 12, 2011 @ 19:04
    Martin
    0

    Updating shipping method

    How can I update the shipping method for a completed order?

    Like this?

    var shipment = currentPurchaseOrder.Shipments.First();
    shipment.ShippingMethod = ShippingMethod.Get(1);
    shipment.ShipmentPrice = 10m;
    shipment.Save();

  • Søren Spelling Lund 1797 posts 2786 karma points
    Dec 13, 2011 @ 11:54
    Søren Spelling Lund
    0

    Yes. Although you probably want to recalculate the order total based on the new values as well.

    You can use the SaveOrder pipeline to do that.

    PipelineFactory.Create<PurchaseOrder>("SaveOrder").Execute(myPurchaseOrder);
  • Martin 44 posts 66 karma points
    Dec 13, 2011 @ 14:09
    Martin
    0

    Thank you. The update costs works fine.

    The shipping method is also updated, but when I look at the Shipping tab on the order, it still shows the old shipping method info. How do I update that?

     

    I didnt include your Pipeline updatater, because the customer also has a field to change the order total.

  • Søren Spelling Lund 1797 posts 2786 karma points
    Dec 13, 2011 @ 14:41
    Søren Spelling Lund
    0

    What specifically is it showing? It should reflect any values you update on the shipment.

  • Martin 44 posts 66 karma points
    Dec 13, 2011 @ 15:10
    Martin
    0

    Here is my shipment updater:

    http://i.imgur.com/omPn4.png

    After I update it, the value is correctly changed, and the dropdown list shows the correct value.

    This is what the shipping tab shows:

    http://i.imgur.com/2IV4Z.png

  • Martin 44 posts 66 karma points
    Dec 13, 2011 @ 18:49
    Martin
    0

    Here's the source-code if you need it:

    var shippingCosts = txtShippingCosts.Text.ToDecimal();

    purchaseOrder.ShippingTotal = shippingCosts;

    var shipment = purchaseOrder.Shipments.First();
    shipment.ShipmentPrice = shippingCosts;
    shipment.ShippingMethod = ShippingMethod.Get(int.Parse(ddlShipping.SelectedValue));
    shipment.Save();

  • Søren Spelling Lund 1797 posts 2786 karma points
    Dec 16, 2011 @ 14:15
    Søren Spelling Lund
    0

    I'm guessing the values are the old ones in the database as well?

  • Martin 44 posts 66 karma points
    Dec 18, 2011 @ 00:17
    Martin
    0

    The value is updated in the database (ShippingMethodId). However the ShipmentName and DeliveryNote is not.

  • Martin 44 posts 66 karma points
    Dec 18, 2011 @ 00:22
    Martin
    0

    I've updated the code to this:

    var shippingCosts = txtShippingCosts.Text.ToDecimal();
    purchaseOrder.ShippingTotal = shippingCosts;

    var shipmentMethod = ShippingMethod.Get(int.Parse(ddlShipping.SelectedValue));


    var shipment = purchaseOrder.Shipments.First();
    shipment.ShipmentPrice = shippingCosts;

    shipment.ShippingMethod = shipmentMethod;
    shipment.ShipmentName = shipmentMethod.Name;
    shipment.DeliveryNote = shipmentMethod.Name;
    shipment.Save();

     

    Now it works fine.

  • Kuttikrishnan.P 6 posts 26 karma points
    Nov 28, 2012 @ 09:31
    Kuttikrishnan.P
    0

    Hi,

    I want to assign differeent shipping methods to the different items present in my basket . Could any one please help me to complete that task (I am using UCommerce pipeline)

    Please let me know if you need any other information .

    Regards,

    Kutti

     

     

     

     

     

  • Søren Spelling Lund 1797 posts 2786 karma points
    Dec 07, 2012 @ 20:20
    Søren Spelling Lund
    0

    Hi Kutti,

    You can create a new shipment for evey item you want to have a different shipping method.

    The code above illustrates how to do it. You want to change the following line to match the shipping method you want:

    shipment.ShippingMethod = shippingMethod;

    Order lines ar eadded to the shipment like this:

    shipment.AddOrderLine(orderLine);
    shipment.Save();

    Hope this helps. 

Please Sign in or register to post replies

Write your reply to:

Draft