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


PHP Order::hold方法代碼示例

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


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

示例1: _holdCancelOrder

 /**
  * @param $ignoreHasInvoice
  * @throws \Magento\Framework\Exception\LocalizedException
  */
 protected function _holdCancelOrder($ignoreHasInvoice)
 {
     $orderStatus = $this->_getConfigData('payment_cancelled', 'adyen_abstract', $this->_order->getStoreId());
     // check if order has in invoice only cancel/hold if this is not the case
     if ($ignoreHasInvoice || !$this->_order->hasInvoices()) {
         if ($orderStatus == \Magento\Sales\Model\Order::STATE_HOLDED) {
             // Allow magento to hold order
             $this->_order->setActionFlag(\Magento\Sales\Model\Order::ACTION_FLAG_HOLD, true);
             if ($this->_order->canHold()) {
                 $this->_order->hold();
             } else {
                 $this->_adyenLogger->addAdyenNotificationCronjob('Order can not hold or is already on Hold');
                 return;
             }
         } else {
             // Allow magento to cancel order
             $this->_order->setActionFlag(\Magento\Sales\Model\Order::ACTION_FLAG_CANCEL, true);
             if ($this->_order->canCancel()) {
                 $this->_order->cancel();
             } else {
                 $this->_adyenLogger->addAdyenNotificationCronjob('Order can not be canceled');
                 return;
             }
         }
     } else {
         $this->_adyenLogger->addAdyenNotificationCronjob('Order has already an invoice so cannot be canceled');
     }
 }
開發者ID:Adyen,項目名稱:adyen-magento2,代碼行數:32,代碼來源:Cron.php

示例2: _holdCancelOrder

 /**
  * @param $order
  * @return bool
  * @deprecate not needed already cancelled in ProcessController
  */
 protected function _holdCancelOrder($ignoreHasInvoice)
 {
     $orderStatus = $this->_getConfigData('payment_cancelled', 'adyen_abstract', $this->_order->getStoreId());
     // check if order has in invoice only cancel/hold if this is not the case
     if ($ignoreHasInvoice || !$this->_order->hasInvoices()) {
         $this->_order->setActionFlag($orderStatus, true);
         if ($orderStatus == \Magento\Sales\Model\Order::STATE_HOLDED) {
             if ($this->_order->canHold()) {
                 $this->_order->hold();
             } else {
                 $this->_debugData['warning'] = 'Order can not hold or is already on Hold';
                 return;
             }
         } else {
             if ($this->_order->canCancel()) {
                 $this->_order->cancel();
             } else {
                 $this->_debugData['warning'] = 'Order can not be canceled';
                 return;
             }
         }
     } else {
         $this->_debugData['warning'] = 'Order has already an invoice so cannot be canceled';
     }
 }
開發者ID:pivulic,項目名稱:adyen-magento2,代碼行數:30,代碼來源:Cron.php


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