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.
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 .
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();
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.
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.
What specifically is it showing? It should reflect any values you update on the shipment.
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
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();
I'm guessing the values are the old ones in the database as well?
The value is updated in the database (ShippingMethodId). However the ShipmentName and DeliveryNote is not.
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.
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
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:
Order lines ar eadded to the shipment like this:
Hope this helps.
is working on a reply...