当前位置: 首页>>代码示例>>PHP>>正文


PHP Session::getLastRealOrderId方法代码示例

本文整理汇总了PHP中Magento\Checkout\Model\Session::getLastRealOrderId方法的典型用法代码示例。如果您正苦于以下问题:PHP Session::getLastRealOrderId方法的具体用法?PHP Session::getLastRealOrderId怎么用?PHP Session::getLastRealOrderId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Magento\Checkout\Model\Session的用法示例。


在下文中一共展示了Session::getLastRealOrderId方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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

示例2: execute

 /**
  * Record order shipping information after order is placed
  *
  * @param EventObserver $observer
  * @return void
  */
 public function execute(EventObserver $observer)
 {
     if ($this->shipperDataHelper->getConfigValue('carriers/shipper/active')) {
         $order = $this->orderFactory->create()->loadByIncrementId($this->checkoutSession->getLastRealOrderId());
         if ($order->getIncrementId()) {
             $this->recordOrder($order);
         }
     }
 }
开发者ID:shipperhq,项目名称:module-shipper,代码行数:15,代码来源:RecordOrder.php

示例3: _getOrder

 /**
  * Return order instance with loaded information by increment id
  *
  * @return \Magento\Sales\Model\Order
  */
 protected function _getOrder()
 {
     if ($this->getOrder()) {
         $order = $this->getOrder();
     } elseif ($this->_checkoutSession->getLastRealOrderId()) {
         $order = $this->_salesOrderFactory->create()->loadByIncrementId($this->_checkoutSession->getLastRealOrderId());
     } else {
         return null;
     }
     return $order;
 }
开发者ID:aiesh,项目名称:magento2,代码行数:16,代码来源:Placeform.php

示例4: makePreference

 /**
  * Return array with data to send to MP api
  *
  * @return array
  */
 public function makePreference()
 {
     $orderIncrementId = $this->_checkoutSession->getLastRealOrderId();
     $order = $this->_orderFactory->create()->loadByIncrementId($orderIncrementId);
     $customer = $this->_customerSession->getCustomer();
     $payment = $order->getPayment();
     $paramsShipment = new \Magento\Framework\DataObject();
     $paramsShipment->setParams([]);
     $this->_eventManager->dispatch('mercadopago_standard_make_preference_before', ['params' => $paramsShipment, 'order' => $order]);
     $arr = [];
     $arr['external_reference'] = $orderIncrementId;
     $arr['items'] = $this->getItems($order);
     $this->_calculateDiscountAmount($arr['items'], $order);
     $this->_calculateBaseTaxAmount($arr['items'], $order);
     $total_item = $this->getTotalItems($arr['items']);
     $total_item += (double) $order->getBaseShippingAmount();
     $order_amount = (double) $order->getBaseGrandTotal();
     if (!$order_amount) {
         $order_amount = (double) $order->getBasePrice() + $order->getBaseShippingAmount();
     }
     if ($total_item > $order_amount || $total_item < $order_amount) {
         $diff_price = $order_amount - $total_item;
         $arr['items'][] = ["title" => "Difference amount of the items with a total", "description" => "Difference amount of the items with a total", "category_id" => $this->_scopeConfig->getValue('payment/mercadopago/category_id', \Magento\Store\Model\ScopeInterface::SCOPE_STORE), "quantity" => 1, "unit_price" => (double) $diff_price];
         $this->_helperData->log("Total itens: " . $total_item, 'mercadopago-standard.log');
         $this->_helperData->log("Total order: " . $order_amount, 'mercadopago-standard.log');
         $this->_helperData->log("Difference add itens: " . $diff_price, 'mercadopago-standard.log');
     }
     if ($order->canShip()) {
         $shippingAddress = $order->getShippingAddress();
         $shipping = $shippingAddress->getData();
         $arr['payer']['phone'] = ["area_code" => "-", "number" => $shipping['telephone']];
         $arr['shipments'] = $this->_getParamShipment($paramsShipment, $order, $shippingAddress);
     }
     $billing_address = $order->getBillingAddress()->getData();
     $arr['payer']['date_created'] = date('Y-m-d', $customer->getCreatedAtTimestamp()) . "T" . date('H:i:s', $customer->getCreatedAtTimestamp());
     $arr['payer']['email'] = htmlentities($customer->getEmail());
     $arr['payer']['first_name'] = htmlentities($customer->getFirstname());
     $arr['payer']['last_name'] = htmlentities($customer->getLastname());
     if (isset($payment['additional_information']['doc_number']) && $payment['additional_information']['doc_number'] != "") {
         $arr['payer']['identification'] = ["type" => "CPF", "number" => $payment['additional_information']['doc_number']];
     }
     $arr['payer']['address'] = ["zip_code" => $billing_address['postcode'], "street_name" => $billing_address['street'] . " - " . $billing_address['city'] . " - " . $billing_address['country_id'], "street_number" => ""];
     $url = $this->_helperData->getSuccessUrl();
     $arr['back_urls'] = ['success' => $this->_urlBuilder->getUrl($url), 'pending' => $this->_urlBuilder->getUrl($url), 'failure' => $this->_urlBuilder->getUrl('checkout/onepage/failure')];
     $arr['notification_url'] = $this->_urlBuilder->getUrl("mercadopago/notifications/standard");
     $arr['payment_methods']['excluded_payment_methods'] = $this->getExcludedPaymentsMethods();
     $installments = $this->getConfigData('installments');
     $arr['payment_methods']['installments'] = (int) $installments;
     $auto_return = $this->getConfigData('auto_return');
     if ($auto_return == 1) {
         $arr['auto_return'] = "approved";
     }
     $sponsor_id = $this->_scopeConfig->getValue('payment/mercadopago/sponsor_id', \Magento\Store\Model\ScopeInterface::SCOPE_STORE);
     $this->_helperData->log("Sponsor_id", 'mercadopago-standard.log', $sponsor_id);
     if (!empty($sponsor_id)) {
         $this->_helperData->log("Sponsor_id identificado", 'mercadopago-standard.log', $sponsor_id);
         $arr['sponsor_id'] = (int) $sponsor_id;
     }
     return $arr;
 }
开发者ID:SummaSolutions,项目名称:cart-magento2,代码行数:65,代码来源:Payment.php

示例5: _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) {
         $incrementId = $this->_checkoutSession->getLastRealOrderId();
         $status = $this->_checkoutSession->getLastOrderStatus();
         if ($status && $incrementId) {
             $isVisible = !in_array($status, $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' => $incrementId]);
         }
     }
 }
开发者ID:nja78,项目名称:magento2,代码行数:18,代码来源:Success.php

示例6: _initCheckout

 /**
  * Instantiate
  *
  * @return void
  * @throws \Magento\Framework\Exception\LocalizedException
  */
 protected function _initCheckout()
 {
     $pre = __METHOD__ . " : ";
     $this->_logger->debug($pre . 'bof');
     $this->_order = $this->_checkoutSession->getLastRealOrder();
     if (!$this->_order->getId()) {
         $this->getResponse()->setStatusHeader(404, '1.1', 'Not found');
         throw new \Magento\Framework\Exception\LocalizedException(__('We could not find "Order" for processing'));
     }
     if ($this->_order->getState() != \Magento\Sales\Model\Order::STATE_PENDING_PAYMENT) {
         $this->_order->setState(\Magento\Sales\Model\Order::STATE_PENDING_PAYMENT)->save();
     }
     if ($this->_order->getQuoteId()) {
         $this->_checkoutSession->setPayfastQuoteId($this->_checkoutSession->getQuoteId());
         $this->_checkoutSession->setPayfastSuccessQuoteId($this->_checkoutSession->getLastSuccessQuoteId());
         $this->_checkoutSession->setPayfastRealOrderId($this->_checkoutSession->getLastRealOrderId());
         $this->_checkoutSession->getQuote()->setIsActive(false)->save();
         //$this->_checkoutSession->clear();
     }
     $this->_logger->debug($pre . 'eof');
     //$this->_checkout = $this->_checkoutTypes[$this->_checkoutType];
 }
开发者ID:PayFast,项目名称:mod-magento_2,代码行数:28,代码来源:AbstractPayfast.php

示例7: getRealOrderId

 /**
  * @return mixed
  */
 public function getRealOrderId()
 {
     return $this->_checkoutSession->getLastRealOrderId();
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:7,代码来源:Failure.php

示例8: getOrder

 /**
  * Get order object
  *
  * @return \Magento\Sales\Model\Order
  */
 protected function getOrder()
 {
     return $this->_orderFactory->create()->loadByIncrementId($this->_checkoutSession->getLastRealOrderId());
 }
开发者ID:craigchristenson,项目名称:magento2-2checkout,代码行数:9,代码来源:Checkout.php

示例9: _getOrder

 /**
  * @return \Magento\Sales\Model\Order
  */
 protected function _getOrder()
 {
     $orderIncrementId = $this->_checkoutSession->getLastRealOrderId();
     $order = $this->_orderFactory->create()->loadByIncrementId($orderIncrementId);
     return $order;
 }
开发者ID:SummaSolutions,项目名称:cart-magento2,代码行数:9,代码来源:Page.php

示例10: getInfoPayment

 /**
  * @return array
  */
 public function getInfoPayment()
 {
     $order_id = $this->_checkoutSession->getLastRealOrderId();
     $info_payments = $this->_coreFactory->create()->getInfoPaymentByOrder($order_id);
     return $info_payments;
 }
开发者ID:SummaSolutions,项目名称:cart-magento2,代码行数:9,代码来源:AbstractSuccess.php


注:本文中的Magento\Checkout\Model\Session::getLastRealOrderId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。