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.
Question 5: Please share additional sample code showing how to send the XML within C#.
Question 6: I have tried submitting multiple tracking updates in one post - it processes the first record correctly but ignores the remainder. Does anyone know whether tracking has to be submitted one per post?
Tracking # not getting updated
this is the code we are using, the status is updating but the tracking # is not...
<?xml version="1.0" encoding="utf-8" ?><xmldata> <TrackingNumbers><OrderID>1078</OrderID> <ShipDate>2009-02-03 13:34:12.207</ShipDate> <ShippingMethodID>205</ShippingMethodID> <MarkOrderShipped>true</MarkOrderShipped> <SendShippedEmail>true</SendShippedEmail> <TrackingNumber>9101805213907275554761</TrackingNumber> </TrackingNumbers></xmldata>
And the result:
TrackingNumbers struct Success VALUE True
your help is appreciated.. thanks.
Comment: The thing that jumps out for me is your date format - the previous example uses DD/MM/YYYY (or whatever the local construct is) whereas this code has YYYY-MM-DD HH:MM:SS.SSS - very different. I would suggest updating this value or removing the ShipDate tag (as per the comment in the main article, that implies that it is set to current date anyway). Your tracking number is pretty long, but within allowed limits (30 chars).