ylliX - Online Advertising Network How to create Magento shipment programmaticaly? - Yet Another Programmer's Blog

How to create Magento shipment programmaticaly?

In case someone will need this, it’s quite simple:

$order = Mage::getModel('sales/order')->load( 1234 );
$shipment = Mage::getModel('sales/service_order', $order)->prepareShipment(array());
$shipment->register();
$shipment->getOrder()->setCustomerNoteNotify(false);
$shipment->getOrder()->setIsInProcess(true);
$transactionSave = Mage::getModel('core/resource_transaction')->addObject($shipment)->addObject($shipment->getOrder())->save();

 

Leave a Reply