当前位置: 首页>>代码示例>>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;未经允许,请勿转载。