Talk:TrackingNumbers
From DevWiki
How to properly submit tracking numbers
After a while I have figured out how to submit a tracking number. Below is a working example, since none has been posted so far.
<?xml version="1.0" encoding="UTF-8"?>
<xmldata>
<TrackingNumbers>
<OrderID>1012</OrderID>
<ShippingMethodID>141</ShippingMethodID>
<TrackingNumber>6133489398238923</TrackingNumber>
<MarkOrderShipped>true</MarkOrderShipped>
<SendShippedEmail>true</SendShippedEmail>
</TrackingNumbers>
</xmldata>
Please note: Contrary to or not mentioned in the article:
1. You must provide the ShippingMethodID as well as the OrderID and the TrackingNumber
2. ShipDate does nothing. No matter what, the Shipping Date is assigned todays date.
3. If the email is not being sent, contact Volusion. They have to do something to make it work. But it does work after they do whatever they need to do.
I don't know if there is anything else, but I do know the above works.
Applying Tracking Numbers
Here is the C# code I've written to apply Tracking Numbers to orders and update status/send emails:
DateTime dtToday = DateTime.Today;
string strShipDate = (dtToday.Month < 10 ? "0" : "") + dtToday.Month.ToString() + "/" + (dtToday.Day < 10 ? "0" : "") + dtToday.Day.ToString() + "/" + dtToday.Year.ToString();
StringBuilder sb = new StringBuilder();
sb.Append("<?xml version=\"1.0\" encoding=\"utf-8\" ?>");
sb.Append("<xmldata>");
for (int i = 0; i < salesOrders.Length; i++)
{
sb.Append("<TrackingNumbers>");
sb.Append("<Gateway>OTHER</Gateway>");
sb.Append("<OrderID>" + salesOrders[i].SalesOrderNo + "</OrderID>");
sb.Append("<ShipDate>" + strShipDate + "</ShipDate>");
sb.Append("<ShippingMethodID>310</ShippingMethodID>");
sb.Append("<TrackingNumber>" + salesOrders[i].ConsignmentNo + "</TrackingNumber>");
sb.Append("<MarkOrderShipped>true</MarkOrderShipped>");
sb.Append("<SendShippedEmail>true</SendShippedEmail>");
sb.Append("</TrackingNumbers>");
}
sb.Append("</xmldata>");
Question 1: Does the "Lock" status of an order prevent updates via Web Services?
Answer 1: No it does not. The API just doesn't support anything but Inserts into Orders. The only update done to Orders is by TrackingNumbers which sets the Orders Status to shipped and marks the items in the order as shipped.
Question 2: The MarkOrderShipped and SendShippedEmail commands are being run, but a Tracking Number entry is not being created against the order in Volusion. I figure that the XML is well-formed and being submitted correctly since the commands are running but the rest isn't being applied. Any ideas?
Answer 2: As long as you are providing a valid OrderID with each TrackingNumber entry then the MardOrderShipped and SendShippedEmail will do what they say. If you like you may post an example XML that you're posting and we'll take a look for you.
Question 3: Other than this Wiki, is there a user guide or some such to demonstrate use of the API? I figure it's a powerful tool if you know how to use it...
Answer 3: The Wiki has all the information we have on the API and we'll continue to add to it here. We hope that people will continue to add questions here where we can answer them once and help multiple people at once.
Question 4: Our programmer used the code from this page to try and insert tracking, but it isn't working. We can update the order status to shipped and the shipping confirmation email is sent successfully, but the tracking numbers are not getting updated/inserted. There has to be a solution for this. Does anyone have the right code to make this work or is there setting that we need to change from our admin?
Answer 4: Our shipping system has now been talking to our store for a few days. A lot of work initially, but once we got it figured out, it was well worth it.