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


PHP Varien_Event_Observer::getOrderIds方法代碼示例

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


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

示例1: salesOrderSave

 /**
  * Set forced canCreditmemo flag
  *
  * @param Varien_Event_Observer $observer
  * @return Mage_Payment_Model_Observer
  */
 public function salesOrderSave($observer)
 {
     $orderId = current($observer->getOrderIds());
     $order = Mage::getModel('sales/order')->load($orderId);
     $payment = $order->getPayment();
     if (!is_object($payment) || !in_array($payment->getMethod(), array('gwap_cc', 'gwap_oneclick', 'gwap_boleto', 'gwap_2cc'))) {
         return $this;
     }
     $data = $this->getGwapPaymentData($payment);
     $mGwap = Mage::getModel('gwap/order');
     $mGwap->setStatus(Allpago_Gwap_Model_Order::STATUS_CREATED);
     $mGwap->setCreatedAt(Mage::getModel('core/date')->date("Y-m-d H:i:s"));
     // Não salvar dados do CC
     if (!Mage::getStoreConfig('payment/gwap_cc/tipo_autorizacao') && $payment->getMethod() != "gwap_boleto") {
         $mGwap->setInfo(Mage::helper('core')->encrypt(serialize($data->toArray())));
     }
     $mGwap->setType(Mage::getStoreConfig('payment/' . $payment->getMethod() . '/mc_type'));
     $mGwap->setCcType($data->getCcType());
     if ($payment->getMethod() == 'gwap_2cc') {
         $mGwap->setCcType2($data->getCcType2());
     }
     $mGwap->setOrderId($order->getId());
     $mGwap->save();
     if (Mage::getStoreConfig('payment/gwap_cc/tipo_autorizacao')) {
         if ($payment->getMethod() != 'gwap_boleto') {
             $result = $order->getPayment()->getMethodInstance()->authorizeNow($order, $data->toArray());
             if ($result && Mage::getStoreConfig('allpago/clearsale/active') && Mage::getStoreConfig('allpago/clearsale/produto') == 'clearid' && Mage::getStoreConfig('allpago/clearsale/clearid_questionario')) {
                 Mage::getModel('clearsale/clearid')->SubmitInfo($order);
             }
         }
     }
     if ($payment->getMethod() == "gwap_boleto") {
         $mGwap->setInfo(Mage::helper('core')->encrypt(serialize($data->toArray())));
         $mGwap->save();
         $log = Mage::getModel('allpago_mc/log');
         try {
             $order->getPayment()->getMethodInstance()->authorize($order->getPayment(), $order->getGrandTotal());
             $gwapNovo = Mage::getModel('gwap/order')->load($order->getId(), 'order_id');
             $gwapNovo->setStatus(Allpago_Gwap_Model_Order::STATUS_CAPTUREPAYMENT);
             $gwapNovo->setErrorCode(null);
             $gwapNovo->setErrorMessage(null);
             $gwapNovo->setTries(0);
             $gwapNovo->setAbandoned(0);
             $gwapNovo->setUpdatedAt(Mage::getModel('core/date')->date("Y-m-d H:i:s"));
             $gwapNovo->save();
             $log->add($gwapNovo->getOrderId(), 'Payment', 'authorize()', Allpago_Gwap_Model_Order::STATUS_AUTHORIZED, 'Boleto gerado');
         } catch (Exception $e) {
             //Salva log
             $log->add($mGwap->getOrderId(), '+ Conversao', 'authorize()', Indexa_Gwap_Model_Order::STATUS_ERROR, 'Ocorreu um erro', $e->getMessage());
             $mGwap->setUpdatedAt(Mage::getModel('core/date')->date("Y-m-d H:i:s"));
             $mGwap->save();
             //$url = Mage::getUrl('sales/order/view', array('order_id'=>$order->getId()));
             //$linkMessage = Mage::helper('gwap')->__('Clique aqui');
             //$this->getResponse()->setBody( sprintf( Mage::helper('gwap')->__('Não foi possível gerar seu boleto no momento. Você pode reimprimir acessando o detalhe de seu pedido. %s.'), '<a href="'.$url.'" target="_blank" class="imprimir_boleto">'.$linkMessage.'</a>' ) );
             return $this;
         }
     }
     return $this;
 }
開發者ID:adrianomelo5,項目名稱:magento,代碼行數:65,代碼來源:Observer.php

示例2: checkoutMultishippingControllerSuccessAction

 /**
  * @param Varien_Event_Observer $observer
  */
 public function checkoutMultishippingControllerSuccessAction(Varien_Event_Observer $observer)
 {
     $orderIds = $observer->getOrderIds();
     Mage::helper('integernet_piwik')->setMultishippingOrderIds($orderIds);
 }
開發者ID:viniciusferreira,項目名稱:Piwik,代碼行數:8,代碼來源:Observer.php


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