本文整理匯總了PHP中Magento\Checkout\Model\Session::start方法的典型用法代碼示例。如果您正苦於以下問題:PHP Session::start方法的具體用法?PHP Session::start怎麽用?PHP Session::start使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Magento\Checkout\Model\Session
的用法示例。
在下文中一共展示了Session::start方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: place
/**
* Place the order when customer returned from PayPal until this moment all quote data must be valid.
*
* @param string $token
* @param string|null $shippingMethodCode
* @return void
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
* @SuppressWarnings(PHPMD.NPathComplexity)
*/
public function place($token, $shippingMethodCode = null)
{
if ($shippingMethodCode) {
$this->updateShippingMethod($shippingMethodCode);
}
if ($this->getCheckoutMethod() == \Magento\Checkout\Model\Type\Onepage::METHOD_GUEST) {
$this->prepareGuestQuote();
}
$this->ignoreAddressValidation();
$this->_quote->collectTotals();
$order = $this->quoteManagement->submit($this->_quote);
if (!$order) {
return;
}
// commence redirecting to finish payment, if paypal requires it
if ($order->getPayment()->getAdditionalInformation(self::PAYMENT_INFO_TRANSPORT_REDIRECT)) {
$this->_redirectUrl = $this->_config->getExpressCheckoutCompleteUrl($token);
}
switch ($order->getState()) {
// even after placement paypal can disallow to authorize/capture, but will wait until bank transfers money
case \Magento\Sales\Model\Order::STATE_PENDING_PAYMENT:
// TODO
break;
// regular placement, when everything is ok
// regular placement, when everything is ok
case \Magento\Sales\Model\Order::STATE_PROCESSING:
case \Magento\Sales\Model\Order::STATE_COMPLETE:
case \Magento\Sales\Model\Order::STATE_PAYMENT_REVIEW:
$this->orderSender->send($order);
$this->_checkoutSession->start();
break;
default:
break;
}
$this->_order = $order;
}