I've created a quick module to extend Mage_Catalog_Block_Layer_View Class::getFilterableAttributes()
which works just fine.
However I need the funtioality of Amastys improved navigation module aswell which sacks off the getFilterableAttributes
method for it's own _getFilterableAttributes
method.
Now I can easily set a depends on my module to load first however I'm getting confused as the class that defines the _getFilterableAttributes
method doesn't extend a Magento base class, it extends an abstract that in turn extends another class.
/Model/Catalog/Layer.php
class Test_BrandCategories_Model_Catalog_Layer extends Mage_Catalog_Model_Layer
{
protected function _getFilterableAttributes()
{
Mage::log('Running...', null, 'ahoy_brand.log');
$attributes = $this->getData('_filterable_attributes');
if (is_null($attributes)) {
$settings = $this->_getDataHelper()->getAttributesSettings();
$attributes = Mage::helper('amshopby/attributes')->getFilterableAttributes();
foreach ($attributes as $k => $v){
$pos = 'left';
if (isset($settings[$v->getId()])){
$pos = $settings[$v->getId()]->getBlockPos();
}
elseif($v->getAttributeCode() == 'price'){
$pos = Mage::getStoreConfig('amshopby/block/price_pos');
}
if ($this->_notInBlock($pos)){
unset($attributes[$k]);
}
}
$this->setData('_filterable_attributes', $attributes);
}
return $attributes;
}
}
Amasty/Shopby/Block/Catalog/Layer/View.php
class Amasty_Shopby_Block_Catalog_Layer_View extends Amasty_Shopby_Block_Catalog_Layer_View_Adapter
{
...
protected function _getFilterableAttributes()
{
$attributes = $this->getData('_filterable_attributes');
if (is_null($attributes)) {
$settings = $this->_getDataHelper()->getAttributesSettings();
$attributes = Mage::helper('amshopby/attributes')->getFilterableAttributes();
foreach ($attributes as $k => $v){
$pos = 'left';
if (isset($settings[$v->getId()])){
$pos = $settings[$v->getId()]->getBlockPos();
}
elseif($v->getAttributeCode() == 'price'){
$pos = Mage::getStoreConfig('amshopby/block/price_pos');
}
if ($this->_notInBlock($pos)){
unset($attributes[$k]);
}
}
$this->setData('_filterable_attributes', $attributes);
}
return $attributes;
}
...
}
Amasty/Shopby.Block/Catalog/Layer/View/Adapter.php
if (Mage::helper('amshopby')->useSolr()) {
class Amasty_Shopby_Block_Catalog_Layer_View_Adapter extends Enterprise_Search_Block_Catalog_Layer_View {}
} else {
class Amasty_Shopby_Block_Catalog_Layer_View_Adapter extends Mage_Catalog_Block_Layer_View {}
}
Because of this extended extension and the custom method name pretended with an _ I'm really not sure what to do, I really don;t want to modify the Amasty plugin if possible but i know I may need to comment out the offending function or something similar. But after looking up solutions for a while I've not found an example that features a nested extension.