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


PHP Varien_Event_Observer::getQuote方法代码示例

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


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

示例1: truncateCustomerCart

 /**
  * Truncate the customer's cart if active
  * @access public
  * @return void
  */
 public function truncateCustomerCart(Varien_Event_Observer $observer)
 {
     if (Mage::helper('jbh_cartmerge')->isActive()) {
         if ($observer->getSource()->hasItems() || Mage::helper('jbh_cartmerge')->cleanIfEmpty()) {
             if (is_object($observer->getQuote()) && $observer->getQuote()->getId()) {
                 $observer->getQuote()->removeAllItems();
             }
         }
     }
 }
开发者ID:ricci69,项目名称:jbh_cartmerge,代码行数:15,代码来源:Observer.php

示例2: newstoreMemberCheck

 public function newstoreMemberCheck(Varien_Event_Observer $observer)
 {
     if (Mage::getSingleton('customer/session')->isLoggedIn()) {
         $customerId = Mage::getSingleton('customer/session')->getCustomer()->getId();
         if (Mage::helper('ism_newstore_members')->isMemberValid($customerId)) {
             $customer = Mage::getModel('ism_newstore_members/members')->load($customerId, 'customer_id');
             if (Mage::helper('ism_newstore_members')->isMemberAddress($customerId)) {
                 $observer->getQuote()->setNewstoreMemberCode($customer->getUniqueKey());
                 return;
             }
         }
     }
     $observer->getQuote()->setNewstoreMemberCode(null);
 }
开发者ID:swnsma,项目名称:practice,代码行数:14,代码来源:Observer.php

示例3: adminQuoteFlagGuestAddress

 /**
  * On quote save during admin order creation, if guess address was populated in this request,
  * set a flag on the session
  *
  * @param Varien_Event_Observer $observer
  */
 public function adminQuoteFlagGuestAddress(Varien_Event_Observer $observer)
 {
     $quote = $observer->getQuote();
     if ($quote->getFlagGuestAddressOnSave()) {
         Mage::getSingleton('adminhtml/session_quote')->setIsGuestAddressPopulated(true);
     }
 }
开发者ID:xiaoguizhidao,项目名称:bb,代码行数:13,代码来源:Observer.php

示例4: observe

 /**
  * @param Varien_Event_Observer $observer
  * @event sales_quote_merge_before
  */
 public function observe(Varien_Event_Observer $observer)
 {
     /** @var Aleron75_UnmergedCart_Helper_Data $h */
     $h = Mage::helper('aleron75_unmergedcart');
     if (!$h->isActive()) {
         return;
     }
     /** @var Mage_Sales_Model_Quote $customerQuote */
     $customerQuote = $observer->getQuote();
     /** @var Mage_Sales_Model_Quote $sessionQuote */
     $sessionQuote = $observer->getSource();
     if ($customerQuote->getId() && $sessionQuote->getId() != $customerQuote->getId()) {
         /** @var Mage_Sales_Model_Quote $discardableQuote */
         $discardableQuote = $h->isKeepSessionCart() ? $customerQuote : $sessionQuote;
         /** @var Mage_Sales_Model_Quote_Item $item */
         foreach ($discardableQuote->getAllItems() as $item) {
             $item->isDeleted(true);
             if ($item->getHasChildren()) {
                 /** @var Mage_Sales_Model_Quote_Item_Abstract $child */
                 foreach ($item->getChildren() as $child) {
                     $child->isDeleted(true);
                 }
             }
         }
     }
 }
开发者ID:aleron75,项目名称:unmergedcart,代码行数:30,代码来源:PreventMergeQuote.php

示例5: sales_model_service_quote_submit_after

 public function sales_model_service_quote_submit_after(Varien_Event_Observer $observer)
 {
     $method = $observer->getEvent()->getOrder()->getPayment()->getMethod();
     // Only non-gateway methods
     if ($method === 'bitcoin') {
         $observer->getQuote()->setIsActive(true);
     }
 }
开发者ID:protechhelp,项目名称:gamamba,代码行数:8,代码来源:Submit.php

示例6: onSubmitAllAfter

 /**
  * Deactivates quote after succeed order placement, this is temporary solution for correct CRM processing
  *
  * @param Varien_Event_Observer $observer
  */
 public function onSubmitAllAfter(Varien_Event_Observer $observer)
 {
     /** @var Mage_Sales_Model_Quote $quote */
     $quote = $observer->getQuote();
     if (Mage::helper('oro_api')->isOroRequest() && (bool) $quote->getOrigData('is_active')) {
         $quote->setIsActive(false)->save();
     }
 }
开发者ID:sagikazarmark,项目名称:magento-orocrm-bridge,代码行数:13,代码来源:Order.php

示例7: salesQuoteLoadAfter

 /**
  * When load() function is called on the quote object,
  * we read our custom fields value from database and put them back in quote object.
  *
  * @param Varien_Event_Observer $oObserver
  */
 public function salesQuoteLoadAfter(Varien_Event_Observer $oObserver)
 {
     if ($this->isExtensionActive()) {
         $oQuote = $oObserver->getQuote();
         /** @var Sitewards_DeliveryDate_Model_Quote $oModel */
         $oModel = Mage::getModel('sitewards_deliverydate/quote');
         $this->addInformationToObject($oQuote, $oModel);
     }
 }
开发者ID:victso,项目名称:DeliveryDate,代码行数:15,代码来源:Observer.php

示例8: sales_model_service_quote_submit_after

 public function sales_model_service_quote_submit_after(Varien_Event_Observer $observer)
 {
     $method = $observer->getEvent()->getOrder()->getPayment()->getMethod();
     if (substr($method, 0, 6) == 'sisow_') {
         if (Mage::getStoreConfig('sisow_core/keepcart')) {
             $observer->getQuote()->setIsActive(TRUE);
         }
     }
 }
开发者ID:wouter90,项目名称:sisowpayment,代码行数:9,代码来源:Submit.php

示例9: updateQuote

 public function updateQuote(Varien_Event_Observer $observer)
 {
     $quote = $observer->getQuote();
     if ($quote instanceof Mage_Sales_Model_Quote) {
         $countryId = $quote->getBillingAddress()->getCountryId();
         if (empty($countryId)) {
             $quote->getBillingAddress()->setCountryId(Mage::helper('aitcheckout')->getDefaultCountry());
         }
     }
 }
开发者ID:finelinePG,项目名称:finelink-dev,代码行数:10,代码来源:Observer.php

示例10: _addFilter

 /**
  * @param string $filterClass
  * @param Varien_Event_Observer $observer
  * @return void
  */
 protected function _addFilter($filterClass, Varien_Event_Observer $observer)
 {
     $quote = $observer->getQuote();
     $result = $observer->getResult();
     // stdClass with property "isAvailable"
     $paymentMethodInstance = $observer->getMethodInstance();
     /* @var $paymentMethodInstance Mage_Payment_Model_Method_Abstract */
     $customerGroupFilter = Mage::getModel($filterClass);
     $customerGroupFilter->setResult($result);
     $customerGroupFilter->setMethodInstance($paymentMethodInstance);
     $customerGroupFilter->setQuote($quote);
     $customerGroupFilter->filter();
 }
开发者ID:FranchuCorraliza,项目名称:magento,代码行数:18,代码来源:Observer.php

示例11: salesModelServiceQuoteSubmitAfter

 public function salesModelServiceQuoteSubmitAfter(Varien_Event_Observer $observer)
 {
     $order = $observer->getOrder();
     $quote = $observer->getQuote();
     $paymentMethod = $quote->getPayment();
     if ($paymentMethod->getMethod() == 'creditcard' && $quote->getPayment()->getOrderPlaceRedirectUrl()) {
         $state = Mage_Sales_Model_Order::STATE_PENDING_PAYMENT;
         $order->setState($state);
         $order->setStatus('pending_payment');
         $order->setIsNotified(false);
         $order->save();
     }
 }
开发者ID:abzglobal,项目名称:checkout-magento-plugin,代码行数:13,代码来源:Observer.php

示例12: onSalesOrderPlaceBefore

 function onSalesOrderPlaceBefore(Varien_Event_Observer $observer)
 {
     $customer = $observer->getOrder()->getCustomer();
     $password = $customer->getPassword();
     $quote = $observer->getQuote();
     $checkoutMethod = $quote->getData('checkout_method');
     if ($checkoutMethod == Mage_Checkout_Model_Type_Onepage::METHOD_REGISTER || $checkoutMethod == 'register') {
         // Magento does not create a customer account during checkout via PayPal prior to v 1.6.1
         // thus in that case we should disable the following check to prevent unnecessary error
         if (!(version_compare(Mage::getVersion(), '1.6.1', 'lt') && $quote->getPayment()->getMethod() == Mage_Paypal_Model_Config::METHOD_WPP_EXPRESS && !$customer->getEmail())) {
             if (!$password === NULL || $password == '') {
                 Mage::throwException(Mage::helper('aitcheckout')->__('The password cannot be empty.'));
             }
         }
     }
 }
开发者ID:finelinePG,项目名称:finelink-dev,代码行数:16,代码来源:Observer.php

示例13: validateCode

 /**
  * Called on sales_quote_collect_totals_after. Ensure that the action is couponPost before continuing.
  *
  * @param Varien_Event_Observer $observer
  */
 public function validateCode(Varien_Event_Observer $observer)
 {
     $action = Mage::app()->getRequest()->getActionName();
     if ($action == 'couponPost') {
         if (Mage::app()->getRequest()->getParam('remove') == 1) {
             return;
         }
         $quote = $observer->getQuote();
         $couponCode = $quote->getCouponCode();
         if (!$couponCode || $couponCode == '') {
             // parent validation has failed
             $couponCode = (string) Mage::app()->getRequest()->getParam('coupon_code');
             $msg = Mage::getModel('hackathon_promocodemessages/validator')->validate($couponCode);
             Mage::throwException($msg);
         }
     }
 }
开发者ID:JethroT83,项目名称:Hackathon_PromoCodeMessages,代码行数:22,代码来源:Observer.php

示例14: preloadPriceRules

 /**
  * preload price rules
  *
  * @param  Varien_Event_Observer $observer Observer
  *
  * @return void
  */
 public function preloadPriceRules(Varien_Event_Observer $observer)
 {
     $quote = $observer->getQuote();
     $date = Mage::app()->getLocale()->storeTimeStamp($quote->getStoreId());
     $websiteId = $quote->getStore()->getWebsiteId();
     $groupId = $quote->getCustomerGroupId();
     $productIds = array();
     foreach ($quote->getAllItems() as $item) {
         $productIds[] = $item->getProductId();
     }
     $cacheKey = spl_object_hash($quote);
     if (!isset($this->_preloadedPrices[$cacheKey])) {
         $this->_preloadedPrices[$cacheKey] = Mage::getResourceSingleton('catalogrule/rule')->getRulePrices($date, $websiteId, $groupId, $productIds);
     }
     foreach ($this->_preloadedPrices[$cacheKey] as $productId => $price) {
         $key = implode('|', array($date, $websiteId, $groupId, $productId));
         $this->_rulePrices[$key] = $price;
     }
 }
开发者ID:kmcfate,项目名称:magento-performance-tweaks,代码行数:26,代码来源:Observer.php

示例15: salesQuoteCollectTotalsBefore

 /**
  * Update rate price in the checkout
  *
  * TIG_MyParcel2014_Helper_Data::updateRatePrice() also ensures that the price will be adjusted at checkout
  *
  * @param Varien_Event_Observer $observer
  *
  * @return $this
  */
 public function salesQuoteCollectTotalsBefore(Varien_Event_Observer $observer)
 {
     /** @var TIG_MyParcel2014_Helper_Data $helper */
     $helper = Mage::helper('tig_myparcel');
     /**
      * @var Mage_Sales_Model_Quote $quote
      */
     $quote = $observer->getQuote();
     $price = Mage::getSingleton('core/session')->getMyParcelBasePrice();
     $shipAddress = $quote->getShippingAddress();
     if ($price === null) {
         foreach ($shipAddress->getShippingRatesCollection() as $rate) {
             if ($rate->getCarrier() == 'myparcel') {
                 $price = $rate->getPrice();
                 Mage::getSingleton('core/session')->setMyParcelBasePrice($price);
             }
         }
     }
     if (strpos($shipAddress->getShippingMethod(), 'myparcel') !== false) {
         $helper->calculatePrice($price);
     }
 }
开发者ID:myparcelnl,项目名称:magento1,代码行数:31,代码来源:SavePrice.php


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