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