Magento как мне программная доставка заказов?

Я ищу код для добавления MassAction в Magento и отправки и выполнения нескольких заказов из sales_order / index

Каким-то образом заказы выполняются не отправляется.

Похоже (совершенно нормальный заказ) не проходит тест canship () . Если он будет пройден $ order of $ orderid ?

Вот мой код

//Get orderids
$orderIds = $this->getRequest()->getPost('order_ids');

//verify if the array is not empty
if (!empty($orderIds)) {
//loop through orders
foreach ($orderIds as $orderId) {

// Dont know what this does
$order = Mage::getModel('sales/order')->loadByIncrementId($orderId);

// Is the order shipable?
if($order->canShip())
{
$itemQty =  $order->getItemsCollection()->count();
// This first definition and 2nd look overlapping, our one is obsolete?
$shipment = Mage::getModel('sales/service_order', $order)->prepareShipment($itemQty);
$shipment = new Mage_Sales_Model_Order_Shipment_Api();

// But still, no shipment, why?
$shipmentId = $shipment->create($orderId, array(), 'Shipment created through ShipMailInvoice', true, true);
7
задан Manashvi Birla 26 September 2016 в 07:52
поделиться