I try to create programmatically a shipment of an order with a track code.
This is my current code :
$order = Mage::getModel('sales/order')->loadByIncrementId("100014930"); $shipment = Mage::getModel('sales/service_order', $order)->prepareShipment($order->getItemQtys()); $arrTracking = array( 'carrier_code' => $order->getShippingCarrier()->getCarrierCode(), 'title' => $order->getShippingCarrier()->getConfigData('title'), 'number' => "1234", ); $track = Mage::getModel('sales/order_shipment_track')->addData($arrTracking); $shipment->addTrack($track); $shipment->register(); $order->save();
With this, I have no error while I execute it.
In the Magento panel, you can't ship the order, but the order stay in pending and the shipment doesn't appear.
Problem solved with this solution