I want to override the Magento\Catalog\Model\Layer\Category\FilterableAttributeList model file. I have created the module. This is my di.xml file.
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for="Magento\Catalog\Model\Layer\Category\FilterableAttributeList" type="Pos\AdvancedLayeredNavigation\Model\Layer\Category\FilterableAttributeList" />
</config>
This is my model file,
<?php
namespace Pos\AdvancedLayeredNavigation\Model\Layer\Category;
class FilterableAttributeList extends Magento\Catalog\Model\Layer\Category\FilterableAttributeList
{
public function getList()
{
/** @var $collection \Magento\Catalog\Model\ResourceModel\Product\Attribute\Collection */
$collection = $this->collectionFactory->create();
$collection->setItemObjectClass(\Magento\Catalog\Model\ResourceModel\Eav\Attribute::class)
->addStoreLabel($this->storeManager->getStore()->getId())
->setOrder('position', 'DESC');
$collection = $this->_prepareAttributeCollection($collection);
$collection->load();
return $collection;
}
}
Can you guys help me!!!! Is there any way to overwrite this file?