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


PHP Varien_Event_Observer::getSession方法代碼示例

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


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

示例1: adminCheckGuestOrder

 /**
  * Catch guest order creation in admin
  *
  * @param Varien_Event_Observer $observer
  * @return void
  */
 public function adminCheckGuestOrder(Varien_Event_Observer $observer)
 {
     /* @var $request Mage_Core_Controller_Request_Http */
     $request = $observer->getRequestModel();
     /** @var $session Mage_Adminhtml_Model_Session_Quote */
     $session = $observer->getSession();
     if ($request->getParam('is_guest_order')) {
         // In case of guest order mark the quote appropriately
         $session->getQuote()->setCustomerIsGuest(true);
         if (($originalOrderId = $session->getPreviousOrderId()) && !$session->getIsGuestAddressPopulated()) {
             // Populate address fields from the original order
             $originalOrder = Mage::getModel('sales/order')->load($originalOrderId);
             if ($originalOrder->getId()) {
                 $session->getQuote()->getBillingAddress()->setCustomerAddressId('');
                 Mage::helper('core')->copyFieldset('sales_copy_order_billing_address', 'to_order', $originalOrder->getBillingAddress(), $session->getQuote()->getBillingAddress());
                 $session->getQuote()->getShippingAddress()->setCustomerAddressId('');
                 Mage::helper('core')->copyFieldset('sales_copy_order_shipping_address', 'to_order', $originalOrder->getShippingAddress(), $session->getQuote()->getShippingAddress());
                 // Don't set our "guest address populated" flag on the session just yet,
                 // because quote isn't saved during this request in every case.  Wait for save.
                 $session->getQuote()->setFlagGuestAddressOnSave(true);
             }
         }
     }
 }
開發者ID:xiaoguizhidao,項目名稱:bb,代碼行數:30,代碼來源:Observer.php

示例2: uploadSkuCsv

 /**
  * Upload and parse CSV file with SKUs
  *
  * @param Varien_Event_Observer $observer
  * @return null
  */
 public function uploadSkuCsv(Varien_Event_Observer $observer)
 {
     /** @var $helper Enterprise_Checkout_Helper_Data */
     $helper = Mage::helper('enterprise_checkout');
     $rows = $helper->isSkuFileUploaded($observer->getRequestModel()) ? $helper->processSkuFileUploading($observer->getSession()) : array();
     if (empty($rows)) {
         return;
     }
     /* @var $orderCreateModel Mage_Adminhtml_Model_Sales_Order_Create */
     $orderCreateModel = $observer->getOrderCreateModel();
     $cart = $this->_getBackendCart($observer);
     $cart->prepareAddProductsBySku($rows);
     $cart->saveAffectedProducts($orderCreateModel, false);
 }
開發者ID:barneydesmond,項目名稱:propitious-octo-tribble,代碼行數:20,代碼來源:Observer.php


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