From a specific order I want to create shipment of that order and also allot tracking number to it programmatically. Please help . Thanks
The question was just for knowledge sharing purpose .
One can understand some points from Ref_Link
// $order_id = Order ID
$_order = Mage::getModel('sales/order')->load($order_id);
if($_order->canShip())
{
$shipmentId = Mage::getModel('sales/order_shipment_api')->create($_order->getIncrementId(), $itemsarray ,'your_comment' ,false,1);
echo $shipmentId; // Outputs Shipment Increment Number
$trackmodel = Mage::getModel('sales/order_shipment_api')
->addTrack($shipmentId,'your_shipping_carrier_code','your_shipping_carrier_title','carrier_tracking_number');
}
$itemsarray
= format explained here Ref_link
Thats it !
A simple code snippet .
Hope it helps someone .
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With