本文整理汇总了PHP中Magento\Framework\Session\Generic::setOrderIds方法的典型用法代码示例。如果您正苦于以下问题:PHP Generic::setOrderIds方法的具体用法?PHP Generic::setOrderIds怎么用?PHP Generic::setOrderIds使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Framework\Session\Generic
的用法示例。
在下文中一共展示了Generic::setOrderIds方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createOrders
/**
* Create orders per each quote address
*
* @return \Magento\Multishipping\Model\Checkout\Type\Multishipping
* @throws \Exception
*/
public function createOrders()
{
$orderIds = [];
$this->_validate();
$shippingAddresses = $this->getQuote()->getAllShippingAddresses();
$orders = [];
if ($this->getQuote()->hasVirtualItems()) {
$shippingAddresses[] = $this->getQuote()->getBillingAddress();
}
try {
foreach ($shippingAddresses as $address) {
$order = $this->_prepareOrder($address);
$orders[] = $order;
$this->_eventManager->dispatch('checkout_type_multishipping_create_orders_single', ['order' => $order, 'address' => $address, 'quote' => $this->getQuote()]);
}
foreach ($orders as $order) {
$order->place();
$order->save();
if ($order->getCanSendNewEmailFlag()) {
$this->orderSender->send($order);
}
$orderIds[$order->getId()] = $order->getIncrementId();
}
$this->_session->setOrderIds($orderIds);
$this->_checkoutSession->setLastQuoteId($this->getQuote()->getId());
$this->getQuote()->setIsActive(false);
$this->quoteRepository->save($this->getQuote());
$this->_eventManager->dispatch('checkout_submit_all_after', ['orders' => $orders, 'quote' => $this->getQuote()]);
return $this;
} catch (\Exception $e) {
$this->_eventManager->dispatch('checkout_multishipping_refund_all', ['orders' => $orders]);
throw $e;
}
}