本文整理汇总了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;
}
示例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;
}
示例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;
}