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


PHP Varien_Event_Observer::getEventName方法代碼示例

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


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

示例1: eavAttributeChange

 /**
  * Update all attribute-dependant index
  *
  * @param Varien_Event_Observer $observer
  * @return Mage_CatalogSearch_Model_Fulltext_Observer
  */
 public function eavAttributeChange(Varien_Event_Observer $observer)
 {
     $attribute = $observer->getEvent()->getAttribute();
     /* @var $attribute Mage_Eav_Model_Entity_Attribute */
     $entityType = Mage::getSingleton('eav/config')->getEntityType(Mage_Catalog_Model_Product::ENTITY);
     /* @var $entityType Mage_Eav_Model_Entity_Type */
     if ($attribute->getEntityTypeId() != $entityType->getId()) {
         return $this;
     }
     $delete = $observer->getEventName() == 'eav_entity_attribute_delete_after';
     if (!$delete && !$attribute->dataHasChangedFor('is_searchable')) {
         return $this;
     }
     $showNotice = false;
     if ($delete) {
         if ($attribute->getIsSearchable()) {
             $showNotice = true;
         }
     } elseif ($attribute->dataHasChangedFor('is_searchable')) {
         $showNotice = true;
     }
     if ($showNotice) {
         $url = Mage::getSingleton('adminhtml/url')->getUrl('adminhtml/system_cache');
         Mage::getSingleton('adminhtml/session')->addNotice(Mage::helper('catalogsearch')->__('Attribute setting change related with Search Index. Please run <a href="%s">Rebuild Search Index</a> process.', $url));
     }
     return $this;
 }
開發者ID:hirentricore,項目名稱:devmagento,代碼行數:33,代碼來源:Observer.php

示例2: addObserver

 /**
  * Register an observer
  * 
  * If observer has event_name property it will be regitered for this specific event.
  * If not it will be registered as global observer
  *
  * @param Varien_Event_Observer $observer
  * @return Varien_Event_Collection
  */
 public function addObserver(Varien_Event_Observer $observer)
 {
     $eventName = $observer->getEventName();
     if ($eventName) {
         $this->getEventByName($eventName)->addObserver($observer);
     } else {
         $this->getGlobalObservers()->addObserver($observer);
     }
     return $this;
 }
開發者ID:natxetee,項目名稱:magento2,代碼行數:19,代碼來源:Collection.php

示例3: clearPaymentMethodFromQuote

 /**
  * in some cases the payment method is not set properly by Magento so we need to reset the
  * payment method in the quote's payment before importing the data
  *
  * @event sales_quote_payment_import_data_before
  * @param $observer
  * @return $this
  */
 public function clearPaymentMethodFromQuote(Varien_Event_Observer $observer)
 {
     if ($observer->getEventName() == 'sales_quote_payment_import_data_before' && $observer->getEvent()->getPayment() instanceof Mage_Sales_Model_Quote_Payment) {
         $observer->getEvent()->getPayment()->setMethod(null);
     }
     return $this;
 }
開發者ID:roshu1980,項目名稱:add-computers,代碼行數:15,代碼來源:Observer.php


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