Reputation: 1629
When printing invoices from Magento I need the orders tracking number (if available) to be printed on the invoice.
Any ideas how to do this?
Upvotes: 0
Views: 948
Reputation: 224
Actualy Tracking Number is a part of shipment, not invoices. But if you want to check whether the tracking number is available you can use this :
$shipments = $order->getShipmentsCollection();
if ($shipments) {
foreach ($shipments as $shipment) {
foreach ($shipment->getAllTracks() as $track) {
$trackingNumbers[] = $track->getTrackNumber();
}
}
}
It will return the tracking number in array (if you have more than 1 shipment). Hope this helps.
Upvotes: 1