当我使用此代码创建交易和发货时,我收到上述错误。不适用于捆绑产品。其他简单/可配置的产品使用相同的代码工作正常。
$shipment = $order->prepareShipment($qtysForProducts);
$shipment->addTrack($track);
$shipment->addComment($comment);
$shipment->sendNewEmail(TRUE, $shipmentComment,$newSkuCustomer);
$shipment->register();
$shippmentId = $shipment->save()->getId();
$transactionSave = Mage::getModel('core/resource_transaction')
->addObject($shipment)
->addObject($shipment->getOrder())
->save();
提前致谢。
答案 0 :(得分:2)
'无法创建空货。'装运未注册或没有物品时触发的消息。检查$ qtysForProducts数组并尝试下一个代码:
$shipment = $order->prepareShipment($qtysForProducts);
$shipment->addComment($comment);
if ($shipment) {
$shipment->register();
$shipment->getOrder()->setIsInProcess(true);
try {
$transactionSave = Mage::getModel('core/resource_transaction')
->addObject($shipment)
->addObject($shipment->getOrder())
->save();
} catch (Mage_Core_Exception $e) {
Mage::log($e->getMessage(), Zend_Log::ERR);
}
}