magento 1 code to get all the attributes collection
public function getAttributes()
{
$collection = Mage::getResourceModel('catalog/product_attribute_collection')->addVisibleFilter()->addIsFilterableFilter();
return $collection;
}
I am changing magento1 code to magento 2 like below It get the collection but while applying filters like addVisibleFilter(),addIsFilterableFilter() then it is failed to load the collection. Please provide me a solution to get all the attributes with filters.
protected $_attributeFactory;
public function __construct(
....
\Magento\Catalog\Model\ResourceModel\Eav\Attribute $attributeFactory,
....
) {
....
$this->_attributeFactory = $attributeFactory;
....
}
public function <func_name>()
{
$attributeInfo = $this->_attributeFactory->getCollection()->addVisibleFilter()->addIsFilterableFilter();
}