I’ve been pulling my hair out for a few hours trying to figure this one out so I thought it was probably worth writing a quick post about it.
I’d installed the Webshopapps Premium Order Export Module for a client which worked perfectly as expected. However the client wanted shipment tracking information included in the report so I had to modify it slightly.
Getting the Shipment Method was straight forward enough:
However the Tracking number proved to be much more difficult. This is how I ended up doing it:
$tracking = Mage::getResourceModel('sales/order_shipment_track_collection')
$trackingNumber = $trackings['number'];
Easy enough – I just had to cross reference a few forum posts to figure it out so I thought it was worth mentioning here.
Please note that I’m assuming there is only one tracking number, you might want to modify this if you want the most recent tracking number.
If you’ve got a better way of doing it, please leave a comment.