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


PHP Mage_Sales_Model_Order::cancel方法代码示例

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


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

示例1: cancel

 /**
  * {@inheritdoc]
  */
 public function cancel()
 {
     if ($this->canCancel()) {
         Mage::dispatchEvent('order_cancel_before', array('order' => $this));
     }
     return parent::cancel();
 }
开发者ID:pierre-pizzetta,项目名称:orderflow-magento-module,代码行数:10,代码来源:Order.php

示例2: cancelaPedido

 public function cancelaPedido(Mage_Sales_Model_Order $order)
 {
     $paymentMethod = $order->getPayment()->getMethodInstance()->getCode();
     $listPaymentMethodsIdeasa = Mage::helper('base')->listPaymentMethods();
     $this->logger->info('Processando cancelamento do pedido ' . $order->getRealOrderId() . ', do modulo: ' . $paymentMethod);
     try {
         if ($order->getState() != Mage_Sales_Model_Order::STATE_CANCELED) {
             $order->cancel();
             //força o cancelamento
             if ($order->getStatus() != Mage_Sales_Model_Order::STATE_CANCELED) {
                 $order->setState(Mage_Sales_Model_Order::STATE_CANCELED, true, Mage::helper('base')->__('Pedido cancelado'), $notified = false);
             } else {
                 $order->addStatusToHistory($order->getStatus(), Mage::helper('base')->__('Pedido cancelado.'));
             }
             if ($order->hasInvoices() != '') {
                 $order->setState(Mage_Sales_Model_Order::STATE_CANCELED, true, Mage::helper('base')->__('O pagamento e o pedido foram cancelados, mas não foi possível retornar os produtos ao estoque pois já havia uma fatura gerada para este pedido.'), $notified = false);
             }
             $order->save();
         }
         if (Mage::helper('base')->isIdeasaPaymentMethod($paymentMethod) && Mage::helper('base/module')->isPagSeguroDiretoExists() && $paymentMethod == $listPaymentMethodsIdeasa[0]) {
             Mage::getModel('pagsegurodireto/notification')->sendEmail($order);
         }
     } catch (Exception $e) {
         $this->logger->error("Erro ao cancelar pedido {$orderId} \n {$e->__toString}()");
     }
     $this->logger->info('Cancelamento do pedido foi concluido ' . $order->getRealOrderId() . ', do modulo: ' . $paymentMethod);
     return;
 }
开发者ID:adrianomelo5,项目名称:magento,代码行数:28,代码来源:ExpiraPedido.php

示例3: _cancelOrder

 /**
  * Cancel the order if is in the current Magento store, otherwise, simply
  * set the state of the order to a state of canceled.
  *
  * @return self
  */
 protected function _cancelOrder()
 {
     if ($this->_order->getId()) {
         // Only save order that's in this magento store
         $this->_order->cancel()->save();
     } else {
         // The order is not in this magento store, simply set state of this empty order to cancel
         $this->_order->setState(Mage_Sales_Model_Order::STATE_CANCELED);
     }
     return $this;
 }
开发者ID:sirishreddyg,项目名称:magento-retail-order-management,代码行数:17,代码来源:Response.php

示例4: _processFailed

 /**
  * Process a failed order. Sets its new state and status and cancels the order
  * if set in config.
  *
  * @param $newStates
  * @param bool $description
  * @return bool
  */
 protected function _processFailed($newStates, $description = false)
 {
     $description = Mage::helper('buckaroo3extended')->__($description);
     $description .= " (#{$this->_postArray['brq_statuscode']})";
     //sets the transaction key if its defined ('brq_transactions')
     //will retrieve it from the response array, if response actually is an array
     if (!$this->_order->getTransactionKey() && array_key_exists('brq_transactions', $this->_postArray)) {
         $this->_order->setTransactionKey($this->_postArray['brq_transactions']);
     }
     if (Mage::getStoreConfig('buckaroo/buckaroo3extended_advanced/cancel_on_failed', $this->_order->getStoreId()) && $this->_order->canCancel()) {
         $this->_order->cancel()->save();
     }
     if ($this->_order->getState() == Mage_Sales_Model_Order::STATE_CANCELED) {
         $this->_order->addStatusHistoryComment($description, $newStates[1])->save();
         $this->_order->setStatus($newStates[1])->save();
     } else {
         $this->_order->addStatusHistoryComment($description)->save();
     }
     return true;
 }
开发者ID:technomagegithub,项目名称:olgo.nl,代码行数:28,代码来源:Push.php

示例5: _processConfirmState

 protected function _processConfirmState($state, $data)
 {
     switch ($state) {
         case 'SUCCESS':
         case 'PENDING':
             $this->_confirmOrder($data);
             break;
         case 'CANCEL':
             $this->_cancelOrder();
             break;
         case 'FAILURE':
             $msg = !empty($data['message']) ? $data['message'] : '';
             if (!$this->_succeeded($this->order)) {
                 $this->order->setState(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT, true, Mage::helper('wirecard_checkout_page')->__('An error occured during the payment process:') . ' ' . $msg)->save();
                 $this->order->cancel();
                 $payment = $this->order->getPayment();
                 $payment->setAdditionalInformation('consumerMessage', $data['consumerMessage']);
             }
             break;
         default:
             throw new Exception('Unhandled Wirecard Checkout Page action "' . $data['paymentState'] . '".');
     }
 }
开发者ID:netzkollektiv,项目名称:wirecard-checkout-magento,代码行数:23,代码来源:ProcessingController.php

示例6: cancel

 /**
  * Cancel the order
  *
  * @param Mage_Sales_Model_Order $order
  */
 public function cancel(Mage_Sales_Model_Order $order)
 {
     $order->cancel()->save();
     return $this;
 }
开发者ID:ArjenMiedema,项目名称:magento-sign2pay,代码行数:10,代码来源:Processor.php

示例7: cancel

 /**
  * Override cancel method to dispatch order
  *
  * @return unknown
  */
 public function cancel()
 {
     parent::cancel();
     //dispatch order in order preparation tab
     mage::helper('BackgroundTask')->AddTask('Dispatch order #' . $this->getId(), 'Orderpreparation', 'dispatchOrder', $this->getId());
     return $this;
 }
开发者ID:TrygveSkogsholm,项目名称:Magento-Patch,代码行数:12,代码来源:Order.php

示例8: _transactionLoss

 /**
  * execute if transaction was loss
  * 
  * @param SofortLib_TransactionData $transData
  * @param Mage_Sales_Model_Order $order
  * @return void
  */
 private function _transactionLoss($transData, $order)
 {
     $payment = $order->getPayment();
     if ($transData->isLastschrift()) {
         $payment->setParentTransactionId($transData->getTransaction())->setShouldCloseParentTransaction(true)->setIsTransactionClosed(0)->registerRefundNotification($transData->getAmount());
         $order->addStatusHistoryComment(Mage::helper('pnsofortueberweisung')->__('Customer returned payment'))->setIsVisibleOnFront(true);
         $order->save();
     } elseif ($transData->isSofortrechnung()) {
         // be sure that order can cancel
         $order->setState('sofort');
         $order->cancel();
         $order->addStatusHistoryComment(Mage::helper('pnsofortueberweisung')->__('Successfully canceled invoice: %s', $transData->getTransaction()))->setIsVisibleOnFront(true);
     } elseif ($transData->isSofortueberweisung()) {
         $lossStatus = Mage::getStoreConfig('payment/sofort/pnsofort_order_status_loss');
         $order->setState('sofort');
         if ($newStatus == 'unchanged') {
             $order->addStatusHistoryComment($transData->getStatus() . " " . $transData->getStatusReason());
         } else {
             $order->addStatusHistoryComment($transData->getStatus() . " " . $transData->getStatusReason(), $lossStatus);
         }
     } else {
         // be sure that order can cancel
         $order->setState('sofort');
         $order->cancel();
         $order->addStatusHistoryComment(Mage::helper('pnsofortueberweisung')->__('Customer canceled payment'))->setIsVisibleOnFront(true);
     }
     $order->save();
 }
开发者ID:jronatay,项目名称:ultimo-magento-jron,代码行数:35,代码来源:SofortController.php

示例9: cancel

 /**
  * FALLS DIESE KLASSE AUFGRUND EINES KONFLIKTS (VERURSACHT Z.B. DURCH EIN ANDERES ADDON) NICHT AKTIV IST,
  * MUSS DIE KOMPLETTE METHODE IN DIE AKTIVE KLASSE KOPIERT WERDEN. SOLLTE DIE METHODE IN DER AKTIVEN KLASSE
  * BEREITS VORHANDEN SEIN, MUSS DIE 'Mage::dispatchEvent'-ANWEISUNG AN DEN ANFANG DER BEREITS VORHANDENEN 
  * METHODE KOPIERT WERDEN. OB DIESE KLASSE AKTIV IST, KANN NACH INSTALLATION DES BILLPAY-ADDONS MIT HILFE 
  * DES DIAGNOSESKRIPTS, WELCHES UNTER DER FOLGENDEN URL VERFÜGBAR IST, ÜBERPRÜFT WERDEN.
  * 
  * http://<Ihr-Magento-Shop>/billpay/diagnostics/checkRewrites
  */
 public function cancel()
 {
     Mage::dispatchEvent('billpay_before_cancel_order', array('order' => $this, 'useHTMLFormat' => true));
     return parent::cancel();
 }
开发者ID:xiaoguizhidao,项目名称:bilderrahmen,代码行数:14,代码来源:Order.php

示例10: cancelOrder

 /**
  * Cancel Magento order
  *
  * @param   MageOrder       $order          Order
  * @param   string          $message        Cancel message
  */
 protected function cancelOrder(MageOrder $order, $message)
 {
     $order->cancel()->setState(MageOrder::STATE_CANCELED, true, $message, true)->sendOrderUpdateEmail()->setIsNotified(true)->save();
 }
开发者ID:payneteasy,项目名称:php-plugin-magento,代码行数:10,代码来源:Abstract.php

示例11: declineOrder

 /**
  * Process decline action by ops decline url
  *
  * @param Mage_Sales_Model_Order $order Order
  * @param array $params Request params
  */
 public function declineOrder($order, $params)
 {
     try {
         Mage::register('ops_auto_void', true);
         //Set this session value to true to allow cancel
         $order->cancel();
         $order->setState(Mage_Sales_Model_Order::STATE_CANCELED, Mage_Sales_Model_Order::STATE_CANCELED, Mage::helper('ops')->__('Order declined on ops side. Barclaycard status: %s, Payment ID: %s.', Mage::helper('ops')->getStatusText($params['STATUS']), $params['PAYID']));
         $order->save();
         $this->cancelInvoices($order);
         $this->setPaymentTransactionInformation($order->getPayment(), $params, 'decline');
     } catch (Exception $e) {
         $this->_getCheckout()->addError(Mage::helper('ops')->__('Order can not be canceled for system reason.'));
         throw $e;
     }
 }
开发者ID:roshu1980,项目名称:add-computers,代码行数:21,代码来源:Payment.php

示例12: _processCancel

 /**
  * Processed order cancelation
  * @param string $msg Order history message
  */
 protected function _processCancel($msg)
 {
     $this->_order->cancel();
     $this->_order->addStatusToHistory(Mage_Sales_Model_Order::STATE_CANCELED, $msg);
     $this->_order->save();
 }
开发者ID:chucky515,项目名称:Magento-CE-Mirror,代码行数:10,代码来源:Event.php

示例13: _cancelOrder

 /**
  * Cancela la order anterior que se le pasa como parametro
  *
  * @param Mage_Sales_Model_Order $order
  * @return $this
  */
 protected function _cancelOrder(Mage_Sales_Model_Order $order)
 {
     $order->cancel()->save();
     return $this;
 }
开发者ID:aplazame,项目名称:magento,代码行数:11,代码来源:Cart.php

示例14: attemptCancelOrder

 /**
  * Attempt to cancel an order.
  * @param  Mage_Sales_Model_Order $order
  * @param  string                 $eventName
  * @return self
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function attemptCancelOrder(Mage_Sales_Model_Order $order, $eventName)
 {
     $logData = ['increment_id' => $order->getIncrementId()];
     try {
         $order->cancel()->save();
         $logMessage = 'Canceling order {increment_id}';
         $this->_logger->info($logMessage, $this->_context->getMetaData(__CLASS__, $logData));
     } catch (Exception $e) {
         // Catching any exception that might be thrown due to calling cancel method on the order object.
         $logMessage = 'An error occurred canceling order "{increment_id}". See the exception log for details.';
         $this->_logger->warning($logMessage, $this->_context->getMetaData(__CLASS__, $logData));
         $this->_logger->logException($e, $this->_context->getMetaData(__CLASS__, [], $e));
     }
     return $this;
 }
开发者ID:sirishreddyg,项目名称:magento-retail-order-management,代码行数:22,代码来源:Event.php

示例15: _processDeclined

 /**
  * Handle Declined answer
  *
  * @throws Exception
  */
 protected function _processDeclined()
 {
     $this->_order->cancel()->addStatusHistoryComment("WayForPay returned a Declined status. Code: #{$this->_data['reasonCode']}. Reason: {$this->_data['reason']}", Mage_Sales_Model_Order::STATE_CANCELED);
     $this->_order->save();
 }
开发者ID:alexkuk,项目名称:Magento,代码行数:10,代码来源:ResponseProcessor.php


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