本文整理匯總了PHP中Varien_Event_Observer::getAttribute方法的典型用法代碼示例。如果您正苦於以下問題:PHP Varien_Event_Observer::getAttribute方法的具體用法?PHP Varien_Event_Observer::getAttribute怎麽用?PHP Varien_Event_Observer::getAttribute使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Varien_Event_Observer
的用法示例。
在下文中一共展示了Varien_Event_Observer::getAttribute方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: processAttributeChangeEvent
/**
* Process index data after attribute information was changed
*
* @param Varien_Event_Observer $observer
* @return Mage_CatalogIndex_Model_Observer
*/
public function processAttributeChangeEvent(Varien_Event_Observer $observer)
{
/**
* @todo add flag to attribute model which will notify what options was changed
*/
$attribute = $observer->getAttribute();
$tags = array(Mage_Eav_Model_Entity_Attribute::CACHE_TAG . ':' . $attribute->getId());
if ($attribute->getOrigData('is_filterable') != $attribute->getIsFilterable()) {
if ($attribute->getIsFilterable() != 0) {
$this->_getIndexer()->plainReindex(null, $attribute);
} else {
$this->_getAggregator()->clearCacheData($tags);
}
} elseif ($attribute->getIsFilterable()) {
$this->_getAggregator()->clearCacheData($tags);
}
return $this;
}
示例2: saveAttributeData
/**
* @param Varien_Event_Observer $observer
* @return $this
*/
public function saveAttributeData($observer)
{
/** @var $connection Varien_Db_Adapter_Pdo_Mysql */
$connection = Mage::getSingleton('core/resource')->getConnection('read');
$table = Mage::getSingleton('core/resource')->getTableName('ecommerceteam_sln_attribute_data');
$attributeId = (int) $observer->getAttribute()->getAttributeId();
$groupId = addslashes($observer->getAttribute()->getData('group_id'));
$frontendType = addslashes($observer->getAttribute()->getData('frontend_type'));
$comment = $observer->getAttribute()->getData('comment');
$optionsLimit = $observer->getAttribute()->getData('options_limit');
$connection->insertOnDuplicate($table, array('attribute_id' => $attributeId, 'group_id' => $groupId, 'frontend_type' => $frontendType, 'comment' => $comment, 'options_limit' => $optionsLimit));
return $this;
}