本文整理汇总了PHP中Magento\Sales\Model\Order::prepareShipment方法的典型用法代码示例。如果您正苦于以下问题:PHP Order::prepareShipment方法的具体用法?PHP Order::prepareShipment怎么用?PHP Order::prepareShipment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Sales\Model\Order
的用法示例。
在下文中一共展示了Order::prepareShipment方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _createShipment
/**
* Create shipment
*
* @throws bool
*/
protected function _createShipment()
{
$this->_adyenLogger->addAdyenNotificationCronjob('Creating shipment for order');
// create shipment for cash payment
$payment = $this->_order->getPayment()->getMethodInstance();
if ($this->_order->canShip()) {
$itemQty = [];
$shipment = $this->_order->prepareShipment($itemQty);
if ($shipment) {
$shipment->register();
$shipment->getOrder()->setIsInProcess(true);
$comment = __('Shipment created by Adyen');
$shipment->addComment($comment);
/** @var \Magento\Framework\DB\Transaction $transaction */
$transaction = $this->_transactionFactory->create();
$transaction->addObject($shipment)->addObject($shipment->getOrder())->save();
$this->_adyenLogger->addAdyenNotificationCronjob('Order is shipped');
}
} else {
$this->_adyenLogger->addAdyenNotificationCronjob('Order can\'t be shipped');
}
}
示例2: _createShipment
/**
*
*/
protected function _createShipment()
{
$this->_debugData['_createShipment'] = 'Creating shipment for order';
// create shipment for cash payment
$payment = $this->_order->getPayment()->getMethodInstance();
if ($this->_order->canShip()) {
$itemQty = array();
$shipment = $this->_order->prepareShipment($itemQty);
if ($shipment) {
$shipment->register();
$shipment->getOrder()->setIsInProcess(true);
$comment = __('Shipment created by Adyen');
$shipment->addComment($comment);
/** @var \Magento\Framework\DB\Transaction $transaction */
$transaction = $this->_transactionFactory->create();
$transaction->addObject($shipment)->addObject($shipment->getOrder())->save();
$this->_debugData['_createShipment done'] = 'Order is shipped';
}
} else {
$this->_debugData['_createShipment error'] = 'Order can\'t be shipped';
}
}