1

enter image description here

Is it possible to create new custom layered navigation on left sidebar? I want to display custom store and after clicking on store I would like to display products on right side column .

0

Yes, it is possible to add any custom filter at categories pages. For this you need to craete a layout file inside your Module : app/code/MODULE_NAMESPACE/MODULE_NAME/view/frontend/layout/catalog_category_view.xml

<?xml version="1.0" encoding="UTF-8"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  layout="2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
      <body>        
     <referenceContainer name="sidebar.additional">
   <block class="MODULE_NAMESPACE\MODULE_NAME\Block\YOUR_BLOCKNAME" name="MODULE_NAME.BLOCK" after ="-" template="MODULENAMESPACE_MODULENAME::YOURPHTMLFILE.phtml"/>
        </referenceContainer>
    </body>
</page>

Now create phtml file inside app/code/MODULE_NAMESPACE/MODULE_NAME/view/frontend/templates/YOURPHTMLFILE.phtml and Block file app/code/MODULE_NAMESPACE/MODULE_NAME/Block/YOUR_BLOCKNAME.php inside with your custom code.

For showing your custom collection rewrite Block Magento\Catalog\Block\Product\ListProduct this can be done as below: app/code/MODULE_NAMESPACE/MODULE_NAME/etc/di.xml

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
 <preference for="Magento\Catalog\Block\Product\ListProduct" type="MODULE_NAMESPACE\MODULE_NAME\Product\ListProduct" />
</config>



namespace MODULE_NAMESPACE\MODULE_NAME\Block\Product;
class ListProduct extends Magento\Catalog\Block\Product\ListProduct
{
  protected function _getProductCollection()
    {

        /*
      *  customize the default code
      */
    }

}
  • Nice Explanation ... – Danial Butt Aug 26 '17 at 8:57
  • your are rockstar man!! After clicking how I can get data on right column? any suggestions or solutions? – Danial Butt Aug 27 '17 at 6:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.