Developer forum

Forum » Development » Update order codebehind

Update order codebehind


Reply
Hi

I have a function that makes 2 new orders of an existing order.

            Dim myRetOrder As New Dynamicweb.eCommerce.Orders.Order
            myRetOrder.Complete = True
            myRetOrder.StateID = sStatusRetourAnnulerenID


            Dim myNewOrder As New Dynamicweb.eCommerce.Orders.Order
            myNewOrder.Complete = True
            myNewOrder.StateID = sStatusRetourNieuwID
          
            Dim sSQL As String = "SELECT * FROM ECOMORDERS WHERE ORDERID = '{0}'"
            sSQL = String.Format(sSQL, sOrder)

            Dim myOrders As Orders.OrderCollection = Orders.Order.getOrders(sSQL, True)

            For Each myOrder As Orders.Order In myOrders
                For Each myOrderline As Orders.OrderLine In myOrder.OrderLines
                    Dim myNewOrderline As Orders.OrderLine = Orders.OrderLine.Create(myOrderline.ID)
                    myNewOrderline.Reference = "Kopie van orderregel " & myOrderline.ID & " van order " & sOrder
                    If arrRetour.Contains(myOrderline.ID) Then
                        myNewOrderline.Order = myNewOrder
                        myNewOrderline.SetUnitPrice(Dynamicweb.Base.ChkDouble(myOrderline.Price.Price.ToString) * -1)
                        myRetOrder.OrderLines.Add(myNewOrderline, True)
                    Else
                        myNewOrderline.Order = myNewOrder
                        myNewOrder.OrderLines.Add(myNewOrderline, True)
                    End If
                  
                Next
            Next

            myRetOrder.Save()
            myNewOrder.Save() The function above works nice, I get 2 new orders. But the order doesn't contain the total prices, delivery costs etc of the orderlines. Is there a function I can use to update my order, so it makes the sum of prices, delivery costs etc?

Replies

 
Reply
Hi Martijn

There are no "helper" method to set all prices on a new order form an existing.
You will have to set every property by code.

/Thomas  
 
Reply
Hi Thomas

Thanks for your quick reply.
I will make my own function in this case.

Martijn

 

You must be logged in to post in the forum