当前位置: 首页>>代码示例>>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;未经允许,请勿转载。