當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Session::getLastOrderId方法代碼示例

本文整理匯總了PHP中Magento\Checkout\Model\Session::getLastOrderId方法的典型用法代碼示例。如果您正苦於以下問題:PHP Session::getLastOrderId方法的具體用法?PHP Session::getLastOrderId怎麽用?PHP Session::getLastOrderId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Magento\Checkout\Model\Session的用法示例。


在下文中一共展示了Session::getLastOrderId方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: isValid

 /**
  * @return bool
  */
 public function isValid()
 {
     if (!$this->checkoutSession->getLastSuccessQuoteId()) {
         return false;
     }
     if (!$this->checkoutSession->getLastQuoteId() || !$this->checkoutSession->getLastOrderId()) {
         return false;
     }
     return true;
 }
開發者ID:shabbirvividads,項目名稱:magento2,代碼行數:13,代碼來源:SuccessValidator.php

示例2: getPostData

 public function getPostData()
 {
     $orderId = $this->_checkoutSession->getLastOrderId();
     if ($orderId) {
         $incrementId = $this->_checkoutSession->getLastRealOrderId();
         return $this->Config->getPostData($incrementId);
     }
 }
開發者ID:MagePsycho,項目名稱:magento2-module-payment-tmrobokassa,代碼行數:8,代碼來源:Redirect.php

示例3: getOrder

 /**
  * @return \Magento\Sales\Model\Order
  */
 public function getOrder()
 {
     if ($this->_order == null) {
         $this->_order = $this->_orderFactory->create()->load($this->_checkoutSession->getLastOrderId());
     }
     return $this->_order;
 }
開發者ID:Adyen,項目名稱:adyen-magento2,代碼行數:10,代碼來源:Success.php

示例4: executeInternal

 /**
  * Execute request
  *
  * @throws AlreadyExistsException
  * @throws NoSuchEntityException
  * @throws \Exception
  * @return void
  */
 public function executeInternal()
 {
     if ($this->customerSession->isLoggedIn()) {
         $this->messageManager->addError(__("Customer is already registered"));
         return;
     }
     $orderId = $this->checkoutSession->getLastOrderId();
     if (!$orderId) {
         $this->messageManager->addError(__("Your session has expired"));
         return;
     }
     try {
         $this->orderCustomerService->create($orderId);
     } catch (\Exception $e) {
         $this->messageManager->addException($e, $e->getMessage());
         throw $e;
     }
 }
開發者ID:nblair,項目名稱:magescotch,代碼行數:26,代碼來源:Create.php

示例5: execute

 /**
  * Execute request
  *
  * @throws AlreadyExistsException
  * @throws NoSuchEntityException
  * @throws \Exception
  * @return \Magento\Framework\Controller\Result\Json
  */
 public function execute()
 {
     /** @var \Magento\Framework\Controller\Result\Json $resultJson */
     $resultJson = $this->_objectManager->get(\Magento\Framework\Controller\Result\JsonFactory::class)->create();
     if ($this->customerSession->isLoggedIn()) {
         return $resultJson->setData(['errors' => true, 'message' => __('Customer is already registered')]);
     }
     $orderId = $this->checkoutSession->getLastOrderId();
     if (!$orderId) {
         return $resultJson->setData(['errors' => true, 'message' => __('Your session has expired')]);
     }
     try {
         $this->orderCustomerService->create($orderId);
         return $resultJson->setData(['errors' => false, 'message' => __('A letter with further instructions will be sent to your email.')]);
     } catch (\Exception $e) {
         $this->messageManager->addException($e, $e->getMessage());
         throw $e;
     }
 }
開發者ID:Doability,項目名稱:magento2dev,代碼行數:27,代碼來源:Create.php

示例6: isValid

 /**
  * Is valid session?
  *
  * @param \Magento\Checkout\Model\Session $checkoutSession
  * @return bool
  */
 public function isValid(\Magento\Checkout\Model\Session $checkoutSession)
 {
     if (!$checkoutSession->getLastSuccessQuoteId()) {
         return false;
     }
     if (!$checkoutSession->getLastQuoteId() || !$checkoutSession->getLastOrderId()) {
         return false;
     }
     return true;
 }
開發者ID:aiesh,項目名稱:magento2,代碼行數:16,代碼來源:SuccessValidator.php

示例7: isValid

 /**
  * Is valid session?
  *
  * @param \Magento\Checkout\Model\Session $checkoutSession
  * @return bool
  */
 public function isValid(\Magento\Checkout\Model\Session $checkoutSession)
 {
     if (!$checkoutSession->getLastSuccessQuoteId()) {
         return false;
     }
     if (!$checkoutSession->getLastQuoteId() || !$checkoutSession->getLastOrderId() && count($checkoutSession->getLastRecurringPaymentIds()) == 0) {
         return false;
     }
     return true;
 }
開發者ID:aiesh,項目名稱:magento2,代碼行數:16,代碼來源:SuccessValidator.php

示例8: getOrderIdForPaymentStart

 /**
  * @return int|false
  */
 public function getOrderIdForPaymentStart()
 {
     if ($this->checkoutSuccessValidator->isValid()) {
         return $this->checkoutSession->getLastOrderId();
     }
     $orderId = $this->request->getParam('id');
     if ($orderId) {
         return $orderId;
     }
     return false;
 }
開發者ID:tozwierz,項目名稱:magento2_payupl,代碼行數:14,代碼來源:Order.php

示例9: _prepareLastOrder

 /**
  * Get last order ID from session, fetch it and check whether it can be viewed, printed etc
  *
  * @return void
  */
 protected function _prepareLastOrder()
 {
     $orderId = $this->_checkoutSession->getLastOrderId();
     if ($orderId) {
         $order = $this->_orderFactory->create()->load($orderId);
         if ($order->getId()) {
             $isVisible = !in_array($order->getStatus(), $this->_orderConfig->getInvisibleOnFrontStatuses());
             $canView = $this->httpContext->getValue(Context::CONTEXT_AUTH) && $isVisible;
             $this->addData(['is_order_visible' => $isVisible, 'view_order_url' => $this->getUrl('sales/order/view/', ['order_id' => $orderId]), 'print_url' => $this->getUrl('sales/order/print', ['order_id' => $orderId]), 'can_print_order' => $isVisible, 'can_view_order' => $canView, 'order_id' => $order->getIncrementId()]);
         }
     }
 }
開發者ID:shabbirvividads,項目名稱:magento2,代碼行數:17,代碼來源:Success.php

示例10: validateAddresses

 /**
  * Validate order addresses
  *
  * @return bool
  */
 protected function validateAddresses()
 {
     $order = $this->orderRepository->get($this->checkoutSession->getLastOrderId());
     $addresses = $order->getAddresses();
     foreach ($addresses as $address) {
         $result = $this->addressValidator->validateForCustomer($address);
         if (is_array($result) && !empty($result)) {
             return false;
         }
     }
     return true;
 }
開發者ID:pradeep-wagento,項目名稱:magento2,代碼行數:17,代碼來源:Registration.php


注:本文中的Magento\Checkout\Model\Session::getLastOrderId方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。