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


PHP Varien_Event_Observer::getOrderItem方法代码示例

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


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

示例1: salesConvertQuoteItemToOrderItem

 public function salesConvertQuoteItemToOrderItem(Varien_Event_Observer $observer)
 {
     $quoteItem = $observer->getItem();
     if ($additionalOptions = $quoteItem->getOptionByCode('additional_options')) {
         $orderItem = $observer->getOrderItem();
         $options = $orderItem->getProductOptions();
         $options['additional_options'] = unserialize($additionalOptions->getValue());
         $orderItem->setProductOptions($options);
     }
 }
开发者ID:GaynorH,项目名称:prestigedrinks,代码行数:10,代码来源:Observer.php

示例2: addSubscriptionProductSubscriptionToOrder

 /**
  * Save additional (subscription) product options (added in addSubscriptionProductSubscriptionToQuote)
  * from quote items to order items
  *
  * @event sales_convert_quote_item_to_order_item
  * @param Varien_Event_Observer $observer
  */
 public function addSubscriptionProductSubscriptionToOrder(Varien_Event_Observer $observer)
 {
     /** @var Mage_Sales_Model_Quote_Item $quoteItem */
     /** @noinspection PhpUndefinedMethodInspection */
     $quoteItem = $observer->getItem();
     /** @var Mage_Sales_Model_Order_Item $orderItem */
     /** @noinspection PhpUndefinedMethodInspection */
     $orderItem = $observer->getOrderItem();
     if ($additionalOptions = $quoteItem->getOptionByCode('additional_options')) {
         $options = $orderItem->getProductOptions();
         $options['additional_options'] = unserialize($additionalOptions->getValue());
         $orderItem->setProductOptions($options);
     }
 }
开发者ID:sandermangel,项目名称:adyen-magento-subscription,代码行数:21,代码来源:Observer.php

示例3: orderItemRemoveAfter

 /**
  *
  * @param Varien_Event_Observer $observer            
  * @return Zoffio_WmsApi_Model_Observer
  */
 public function orderItemRemoveAfter(Varien_Event_Observer $observer)
 {
     // $event = $observer->getEvent()->getData();
     Mage::log(__CLASS__ . "_" . __FILE__ . "_" . __LINE__, null, 'wms-api.log');
     Mage::log(__CLASS__ . "_" . __FUNCTION__ . " " . self::$_observerExecutionCounter, null, 'shebin.log');
     // ###################################################################
     /**
      * Order Item remove after event to handle the remove Order.
      */
     $order = $observer->getOrder();
     $order_status = $order->getData('status');
     // return if the order status is not set
     if (!isset($order_status) || trim($order_status) === '') {
         return $this;
     }
     // Do not push Order that are not approved.
     if ($order_status != 'approved' && $order_status != 'canceled') {
         Mage::log('Order not pushed in WMS. Status: ' . $order_status, null, 'wms-api.log', true);
         return $this;
     }
     // Get increment Order Id
     $zoffio_order_id = $order->getIncrementId();
     // connect to the WMS API
     $proxy = new SoapClient(self::$_apiUrl);
     $sessionId = $proxy->login(self::$_apiUser, self::$_apiPassword);
     // Check Order existence in WMS
     try {
         $order_existWms = $proxy->salesOrderList($sessionId, $order_complexFilter);
     } catch (Exception $e) {
         Mage::log($e->getMessage(), null, 'shebin.log');
         Mage::log($e->getTraceAsString(), null, 'shebin.log');
     }
     // Do not push the cancell orders that was not approved to WMS
     if ($order_status == 'canceled' && count($order_existWms) < 1) {
         /*
          * Order should not be pushed when the cancelled order is not there
          * in the WMS. ie., the Order was not approved.
          */
         Mage::log('Order canceled which is not in WMS ' . $zoffio_order_id, null, 'wms-api.log', true);
         return $this;
     }
     if (count($order_existWms) > 0) {
         $order_item = $observer->getOrderItem();
         $order_product = array();
         $item_sku = $order_item->getSku();
         $item_qty = 0;
         // remove product
         $item_price = 0;
         $order_products[] = array('sku' => $item_sku, 'qty' => $item_qty, 'price' => $item_price, 'order_increment_id' => $zoffio_order_id);
         try {
             $result = $proxy->mdnapiOrderupdateOrderItems($sessionId, $order_products);
             $result = $proxy->salesOrderAddComment($sessionId, $zoffio_order_id, $order_status);
         } catch (Exception $e) {
             Mage::log($e->getMessage(), null, 'wms-api.log');
             Mage::log($e->getTraceAsString(), null, 'wms-api.log');
         }
     }
     // ###################################################################
     return $this;
 }
开发者ID:shebin512,项目名称:Magento_Zoff,代码行数:65,代码来源:Observer.php


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