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


PHP Mage_Sales_Model_Order::getState方法代码示例

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


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

示例1: _redirectByOrder

 /**
  * @param Mage_Sales_Model_Order $order
  *
  * @return $this
  */
 protected function _redirectByOrder(Mage_Sales_Model_Order $order)
 {
     if (!$order->getId()) {
         $this->_redirectCart();
         return $this;
     }
     if ($order->isCanceled()) {
         $this->_redirectPaymentError();
         return $this;
     }
     switch ($order->getState()) {
         case Mage_Sales_Model_Order::STATE_NEW:
             $this->_redirectOrderPending();
             break;
         case Mage_Sales_Model_Order::STATE_CANCELED:
             $this->_redirectPaymentError();
             break;
         case Mage_Sales_Model_Order::STATE_PROCESSING:
         case Mage_Sales_Model_Order::STATE_COMPLETE:
         case Mage_Sales_Model_Order::STATE_CLOSED:
         case Mage_Sales_Model_Order::STATE_HOLDED:
         case Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW:
         default:
             $this->_redirectOrderState();
             break;
     }
     return $this;
 }
开发者ID:marcoescudeiro,项目名称:clickpag-magento,代码行数:33,代码来源:Action.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: _canViewOrder

 /**
  * Check order view availability
  *
  * @param   Mage_Sales_Model_Order $order
  * @return  bool
  */
 protected function _canViewOrder($order)
 {
     $customerId = Mage::getSingleton('customer/session')->getCustomerId();
     $availableStates = Mage::getSingleton('sales/order_config')->getVisibleOnFrontStates();
     if ($order->getId() && $order->getCustomerId() && $order->getCustomerId() == $customerId && in_array($order->getState(), $availableStates, $strict = true)) {
         return true;
     }
     return false;
 }
开发者ID:jpbender,项目名称:mage_virtual,代码行数:15,代码来源:OrderController.php

示例4: _prepareOrderData

 /**
  * @return array
  */
 protected function _prepareOrderData()
 {
     // magento 1.5 compat
     $shipping_method_c = $this->_order->getShippingMethod(true);
     $shipping_method = $this->_order->getData('shipping_method');
     $shipping_method_code = $shipping_method_c ? $shipping_method_c->getData('carrier_code') : $shipping_method;
     $data = array_filter(array('currency_code' => $this->_order->getOrderCurrencyCode(), 'shipping_method_code' => $shipping_method_code, 'shipping_method_title' => $this->_order->getShippingDescription(), 'created_on' => $this->_order->getCreatedAt(), 'updated_on' => $this->_order->getUpdatedAt(), 'state' => $this->_order->getState(), 'status' => $this->_order->getStatus(), 'is_gift' => $this->_order->getGiftMessageId() != null, 'ref_quote_id' => $this->_order->getQuoteId(), 'order_subtotal_with_tax' => $this->_order->getSubtotalInclTax(), 'order_subtotal' => $this->_order->getSubtotal(), 'order_tax' => $this->_order->getTaxAmount(), 'order_hidden_tax' => $this->_order->getHiddenTaxAmount(), 'order_shipping_with_tax' => $this->_order->getShippingInclTax(), 'order_shipping' => $this->_order->getShippingAmount(), 'order_discount' => $this->_order->getDiscountAmount(), 'order_shipping_discount' => $this->_order->getShippingDiscountAmount(), 'order_total' => $this->_order->getGrandTotal(), 'order_total_items' => $this->_order->getTotalItemCount()));
     return $data;
 }
开发者ID:payin7-payments,项目名称:payin7-magento,代码行数:12,代码来源:Submit.php

示例5: canSendEmail

 public function canSendEmail(Mage_Sales_Model_Order $order)
 {
     if ($order->getState() == Mage_Sales_Model_Order::STATE_CANCELED) {
         if (Mage::getStoreConfig(Ideasa_Base_ConfiguracoesSystem::CONTROLE_ENVIO_EMAIL_CANCELADO)) {
             return true;
         }
     }
     if ($order->getState() == Mage_Sales_Model_Order::STATE_NEW) {
         if (Mage::getStoreConfig(Ideasa_Base_ConfiguracoesSystem::CONTROLE_ENVIO_EMAIL_NOVO)) {
             return true;
         }
     }
     if ($order->getState() == Mage_Sales_Model_Order::STATE_PROCESSING || $order->getState() == Mage_Sales_Model_Order::STATE_COMPLETE) {
         if (Mage::getStoreConfig(Ideasa_Base_ConfiguracoesSystem::CONTROLE_ENVIO_EMAIL_FATURA_GERADA)) {
             return true;
         }
     }
     return false;
 }
开发者ID:adrianomelo5,项目名称:magento,代码行数:19,代码来源:Data.php

示例6: canCancel

 public function canCancel(Mage_Sales_Model_Order $order)
 {
     if ($order->getCustomerId() != Mage::getSingleton('customer/session')->getCustomerId()) {
         return false;
     }
     if (!in_array($order->getState(), Mage::getSingleton('sales/order_config')->getVisibleOnFrontStates(), $strict = true)) {
         return false;
     }
     if (!$order->canCancel() || $order->hasInvoices() || $order->hasShipments()) {
         return false;
     }
     if ($order->getState() == Mage_Sales_Model_Order::STATE_NEW && $this->canCancelNew($order->getStore())) {
         return true;
     }
     if ($order->getState() == Mage_Sales_Model_Order::STATE_PENDING_PAYMENT && $this->canCancelPending($order->getStore())) {
         return true;
     }
     return false;
 }
开发者ID:sequra,项目名称:Modgit-Order-Monitor,代码行数:19,代码来源:Customer.php

示例7: isOrderEditable

 /**
  * Returns true if order may be edited by currently logged in customer
  * 
  * @param Mage_Sales_Model_Order $order
  * @return boolean
  */
 public function isOrderEditable(Mage_Sales_Model_Order $order)
 {
     if (!$order->getCustomerId()) {
         return false;
     }
     if (Mage::getSingleton('customer/session')->getCustomerId() != $order->getCustomerId()) {
         return false;
     }
     $allowedStates = explode(',', Mage::getStoreConfig('sales/editcustomoptions/allowed_order_state'));
     return in_array($order->getState(), $allowedStates);
 }
开发者ID:helirexi,项目名称:EditCustomOptions,代码行数:17,代码来源:Data.php

示例8: _processPendingPayment

 /**
  * processes an order awaiting payment. Sets its new state and status.
  *
  * @param $newStates
  * @param bool $description
  * @return bool
  */
 protected function _processPendingPayment($newStates, $description = false)
 {
     $description = Mage::helper('buckaroo3extended')->__($description);
     $description .= " (#{$this->_postArray['brq_statuscode']})";
     //sets the transaction key if its defined ($trx)
     //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 ($this->_order->getState() == Mage_Sales_Model_Order::STATE_NEW) {
         $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,代码行数:24,代码来源:Push.php

示例9: _registerPaymentPending

 /**
  * Process payment pending notification
  *
  * @throws Exception
  */
 public function _registerPaymentPending()
 {
     $reason = $this->getRequestData('pending_reason');
     if ('authorization' === $reason) {
         $this->_registerPaymentAuthorization();
         return;
     }
     if ('order' === $reason) {
         throw new Exception('The "order" authorizations are not implemented.');
     }
     // case when was placed using PayPal standard
     if (Mage_Sales_Model_Order::STATE_PENDING_PAYMENT == $this->_order->getState() && !$this->getRequestData('transaction_entity')) {
         $this->_registerPaymentCapture();
         return;
     }
     $this->_importPaymentInformation();
     $this->_order->getPayment()->setPreparedMessage($this->_createIpnComment($this->_info->explainPendingReason($reason)))->setTransactionId($this->getRequestData('txn_id'))->setIsTransactionClosed(0)->registerPaymentReviewAction(Mage_Sales_Model_Order_Payment::REVIEW_ACTION_UPDATE, false);
     $this->_order->save();
 }
开发者ID:quyip8818,项目名称:Mag,代码行数:24,代码来源:Ipn.php

示例10: logRequest

 /**
  * @param Mage_Sales_Model_Order $order
  * @param string                 $uri
  * @param string                 $method
  * @param string                 $body
  */
 public function logRequest(Mage_Sales_Model_Order $order = null, $uri, $method, $body)
 {
     if (!$this->isApiLogEnabled()) {
         return;
     }
     $message = $this->getDashHash();
     $message .= PHP_EOL;
     $message .= PHP_EOL . 'Starting Request';
     $message .= PHP_EOL . 'Request Data:';
     $message .= PHP_EOL;
     if ($order && $order->getId()) {
         $message .= PHP_EOL . sprintf('Order ID:      %s', $order->getId());
         $message .= PHP_EOL . sprintf('Order Real ID: %s', $order->getRealOrderId());
         $message .= PHP_EOL . sprintf('Order State:   %s', $order->getState());
         $message .= PHP_EOL . sprintf('Order Status:  %s', $order->getStatus());
     }
     $message .= PHP_EOL . sprintf('URI:           %s', $uri);
     $message .= PHP_EOL . sprintf('Method:        %s', $method);
     $message .= PHP_EOL . sprintf('Request Body:  %s', $body);
     $message .= PHP_EOL;
     $message .= $this->getShortDashHash();
     $this->log($message);
 }
开发者ID:Tracksale,项目名称:tracksale-magento,代码行数:29,代码来源:Log.php

示例11: updatePaymentStatusCompleted

 /**
  * Update payment status to complete
  *
  * @param $payment
  */
 public function updatePaymentStatusCompleted($payment)
 {
     if ($this->_order->getState() != Mage_Sales_Model_Order::STATE_PROCESSING) {
         $payment->setTransactionId($this->_transactionId);
         $payment->setIsTransactionApproved(true);
         $payment->setIsTransactionClosed(true);
         $payment->addTransaction(Mage_Sales_Model_Order_Payment_Transaction::TYPE_ORDER);
         if (isset($this->_payuPayMethod)) {
             if ($this->_payuPayMethod == "PBL") {
                 $method = Mage::helper('payu_account')->__('Pay by link');
             }
             if ($this->_payuPayMethod == "CARD_TOKEN") {
                 $method = Mage::helper('payu_account')->__('Pay with card');
             }
         }
         if (isset($method)) {
             $payment->setPreparedMessage("PayU - " . $method . " " . Mage::helper('payu_account')->__('The transaction completed successfully.'));
             $this->_order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true, "PayU - " . $method . " " . Mage::helper('payu_account')->__('The transaction completed successfully.'), false)->sendOrderUpdateEmail(true, "PayU - " . Mage::helper('payu_account')->__('The transaction completed successfully in PayU.'))->save();
         } else {
             $payment->setPreparedMessage("PayU - " . Mage::helper('payu_account')->__('The transaction completed successfully.'));
             $this->_order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true, "PayU - " . Mage::helper('payu_account')->__('The transaction completed successfully.'), false)->sendOrderUpdateEmail(true, "PayU - " . Mage::helper('payu_account')->__('The transaction completed successfully in PayU.'))->save();
         }
     }
 }
开发者ID:par-orillonsoft,项目名称:plugin_magento,代码行数:29,代码来源:Payment.php

示例12: addCommentToOrder

 /**
  * Add comment to order
  *
  * @param  Mage_Sales_Model_Order   		$order
  * @param  string                   		$comment
  * @param  boolean  						$isShipmentSuccessfullyCreated
  *
  * @return void
  */
 public function addCommentToOrder(Mage_Sales_Model_Order $order, $comment, $isShipmentSuccessfullyCreated = false)
 {
     /*
      * for Magento 1.4.x.x
      */
     if (true === $this->getConfig()->isVersionRecommendedOrLarger()) {
         $order->addStatusHistoryComment($comment)->setIsVisibleOnFront(false)->setIsCustomerNotified(false)->save();
         /*
          * for Magento 1.3.x.x
          */
     } else {
         //Get existing order status
         $status = $order->getStatus();
         //If shipment was created successfully
         if (true === $isShipmentSuccessfullyCreated) {
             $status = Mage_Sales_Model_Order::STATE_PROCESSING;
         }
         //Is status is empty, take state
         if ($status == "") {
             $status = $order->getState();
         }
         if (false === $isShipmentSuccessfullyCreated) {
             /*
              * reload the order to avoid that unwanted order data is saved | SEE DHLIS-181
              *  Order Items are set as shipped in CE 1.3 even if there was an exception
              */
             $order = Mage::getModel('sales/order')->load($order->getId());
         }
         $order->addStatusToHistory($status, $comment)->save();
     }
 }
开发者ID:igorvasiliev4,项目名称:magento_code,代码行数:40,代码来源:Autocreate.php

示例13: createInvoice

 /**
  *  Create invoice for order
  */
 protected function createInvoice(Mage_Sales_Model_Order $order)
 {
     if ($order->getState() == Mage_Sales_Model_Order::STATE_NEW) {
         try {
             if (!$order->canInvoice()) {
                 $order->addStatusHistoryComment('MultiSafepay: Order cannot be invoiced.', false);
                 $order->save();
                 return false;
             }
             //START Handle Invoice
             $invoice = Mage::getModel('sales/service_order', $order)->prepareInvoice();
             $invoice->setRequestedCaptureCase(Mage_Sales_Model_Order_Invoice::CAPTURE_OFFLINE);
             $invoice->register();
             $invoice->getOrder()->setCustomerNoteNotify(false);
             $invoice->getOrder()->setIsInProcess(true);
             $order->addStatusHistoryComment('Automatically invoiced by MultiSafepay invoicer.', false);
             $transactionSave = Mage::getModel('core/resource_transaction')->addObject($invoice)->addObject($invoice->getOrder());
             $transactionSave->save();
             //END Handle Invoice
             //Send Invoice emails
             $mail_invoice = $this->getConfigData("mail_invoice");
             $send_bno_invoice = $this->getConfigData("bno_no_invoice");
             $gateway = $order->getPayment()->getMethodInstance()->_gateway;
             if ($mail_invoice && $gateway != 'PAYAFTER') {
                 $invoice->setEmailSent(true);
                 $invoice->sendEmail();
                 $invoice->save();
             } elseif ($gateway == 'PAYAFTER' && !$send_bno_invoice && $mail_invoice) {
                 $invoice->setEmailSent(true);
                 $invoice->sendEmail();
                 $invoice->save();
             }
             $order->setTotalPaid($order->getGrandTotal());
         } catch (Exception $e) {
             $order->addStatusHistoryComment('MultiSafepay invoicer: Exception occurred during the creation of the invoice. Exception message: ' . $e->getMessage(), false);
             $order->save();
         }
     }
     return false;
 }
开发者ID:xiaoguizhidao,项目名称:storebaby.it,代码行数:43,代码来源:Base.php

示例14: _processDirectSale

 /**
  * Process Configured Payment Action: Direct Sale, create invoce if state is Pending
  *
  * @param Mage_Sales_Model_Order $order  Order
  * @param array                  $params Request params
  */
 protected function _processDirectSale($order, $params, $instantCapture = 0)
 {
     Mage::register('postfinance_auto_capture', true);
     $status = $params['STATUS'];
     if ($status == PostFinance_Payment_Model_Payment_Abstract::POSTFINANCE_AWAIT_CUSTOMER_PAYMENT) {
         $order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, Mage_Sales_Model_Order::STATE_PENDING_PAYMENT, Mage::helper('postfinance')->__('Waiting for the payment of the customer'));
         $order->save();
     } elseif ($status == PostFinance_Payment_Model_Payment_Abstract::POSTFINANCE_AUTHORIZED_WAITING) {
         $order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, Mage_Sales_Model_Order::STATE_PENDING_PAYMENT, Mage::helper('postfinance')->__('Authorization waiting from PostFinance'));
         $order->save();
     } elseif ($order->getState() == Mage_Sales_Model_Order::STATE_PENDING_PAYMENT || $instantCapture) {
         if ($status == PostFinance_Payment_Model_Payment_Abstract::POSTFINANCE_AUTHORIZED) {
             if ($order->getStatus() != Mage_Sales_Model_Order::STATE_PENDING_PAYMENT) {
                 $order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, Mage_Sales_Model_Order::STATE_PROCESSING, Mage::helper('postfinance')->__('Processed by PostFinance'));
             }
         } else {
             $order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, Mage_Sales_Model_Order::STATE_PROCESSING, Mage::helper('postfinance')->__('Processed by PostFinance'));
         }
         if (!$order->getInvoiceCollection()->getSize()) {
             $invoice = $order->prepareInvoice();
             $invoice->setRequestedCaptureCase(Mage_Sales_Model_Order_Invoice::CAPTURE_ONLINE);
             $invoice->register();
             $invoice->setState(Mage_Sales_Model_Order_Invoice::STATE_PAID);
             $invoice->getOrder()->setIsInProcess(true);
             $invoice->save();
             $transactionSave = Mage::getModel('core/resource_transaction')->addObject($invoice)->addObject($invoice->getOrder())->save();
             /*
              * If the payment method is a redirect-payment-method send the email
              * In any other case Magento sends an email automatically in Mage_Checkout_Model_Type_Onepage::saveOrder
              */
             if ($this->isRedirectPaymentMethod($order) === true && $order->getEmailSent() !== '1') {
                 $order->sendNewOrderEmail();
             }
         }
     } else {
         $order->save();
     }
 }
开发者ID:nomade-it,项目名称:MagentoPostFinance,代码行数:44,代码来源:Payment.php

示例15: canCancelManually

 /**
  * Check if order can be cancelled manually
  *
  * @param Mage_Sales_Model_Order $order
  * @return bool
  */
 public function canCancelManually($order)
 {
     $payment = $order->getPayment();
     //If order has state 'pending_payment' and the payment has Barclaycard-status 0 or null (unknown) then cancel the order
     if ($order->getState() == Mage_Sales_Model_Order::STATE_PENDING_PAYMENT && (true === is_null($payment->getAdditionalInformation('status')) || $payment->getAdditionalInformation('status') == '0')) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:roshu1980,项目名称:add-computers,代码行数:16,代码来源:Abstract.php


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