这是什么意思?
我试图以编程方式为订单创建发货,它抛出了一个错误,正如我在下面复制的那样。
我的代码:
if (!$order->canShip()) {
echo 'can not ship this order';
return false;
}
$itemQty = $order->getItemsCollection()->count();
$shipment = Mage::getModel('sales/service_order', $order)
->prepareShipment($itemQty);
$shipmentId = $shipment->create($order->getIncrementId(), $itemQty, 'Shipment created through ShipMailInvoice', true, true);
错误是:
<b>Fatal error</b>: Uncaught exception 'Varien_Exception' with message 'Invalid method Mage_Sales_Model_Order_Shipment::create(Array
(
[0] => $orderId
[1] => 8
[2] => Royal mail Shipment
[3] => 1
[4] => 1
)
)'
in /home/toesocks/public_html/lib/Varien/Object.php:569
Stack trace:
#0 /home/toesocks/public_html/product_scanning/v2/functions/orderDispatch.php(82): Varien_Object->__call('create', Array)
#1 /home/toesocks/public_html/product_scanning/v2/functions/orderDispatch.php(82): Mage_Sales_Model_Order_Shipment->create('15300007141', 8, 'Shipment create...', true, true)
#2 {main}
thrown in <b>/home/toesocks/public_html/lib/Varien/Object.php</b> on line <b>569</b><br />
有人可以解释一下这是什么意思,为什么我会收到这个错误?
亲切的问候
杰伊