I've created a function that will retrieve orders with certain characteristics from different web-based software. The function then pulls the tracking numbers from these order records, adds the tracking numbers to the equivalent order in AbleCommerce, updates the AbleCommerce order shipping status to shipped, and saves the order. However, when I ran the first test, the tracking numbers were added, but the shipping status remained as unshipped. I've included a code snippet below. If anyone can pont me towards what I'm doing wrong that would be great.
Code: Select all
int acOrderId = OrderDataSource.LookupOrderId(acOrderNum);
Order updateOrder = OrderDataSource.Load(acOrderId);
List<String> tn = new List<String>();
// code to retrieve tracking numbers and add to List would be here
foreach (String trackNum in tn)
{
TrackingNumber trackingNum = new TrackingNumber();
trackingNum.TrackingNumberData = trackNum;
updateOrder.Shipments[0].TrackingNumbers.Add(trackingNum);
}
updateOrder.ShipmentStatus = OrderShipmentStatus.Shipped;
updateOrder.Save();
I also tried it by adding the following code, also with the same result...
Code: Select all
DateTime shipDate;
// the shipping date value is set here
changeOrder.Shipments[0].Ship(shipDate);
All of this is enclosed in try-catch blocks that call an e-mail submission method that I know works to inform me if there was any reported error. No errors are returned.