I am trying to get the attribute code from the filter.phtml template file. Does anyone have any ideas how to do this?
$_item->getFilter()->getAttributeModel()->getAttributeCode()
The above line of code can be used to get the attribute code when it is in the loop.
It will works only if filter is attribute bu for category it will not work so you have to write like
echo $_filter->getType();
if($_filter->getType()=='catalog/layer_filter_attribute')
{
echo $_filter->getAttributeModel()->getAttributeCode();
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With