Magento get shipments for order


Magento get shipments for order : Mage_Sales module is used to manage the sales order shipments in magento. Shipments basically allows you to manage the shipments and tracking numbers in magento. Resource sales_order_shipment(order_shipment) is used for shipments in magento.In this tutorial we are going to explain how you can get all the shipments created against an order. There can be multiple shipments for an order.


Magento get shipments for order

You can get all the shipments of an order as below –

Magento get shipments for order:

<?php
$orderId = 1245;
$order = Mage::getModel('sales/order')->load($orderId);
$shipmentIds = array();
foreach($order->getShipmentsCollection() as $shipment)
{
    $shipmentIds[] = $shipment->getId();
}

?>

The above example will give you array of shipment ids for order 1245. You also get other information about the shipments such as – total weight , total quantity etc.


Advertisements

Add Comment

📖 Read More