I am using Magento 2.2.4 for online Bookstore. I have books under categories and sub-categories.
I need to list all these categories and sub-categories on Homepage left side like in the Screenshot below.
When clicking on the ctaegory, it should be navigated to the books under relevant category. Since I am fresher to Magento and PHP, I am trying customization using CMS rather code modifications. I tried this with widgets and blocks, but I could not find an effective way. Is there a way to do this?
Best Answer
I have to do something similar and I have used following code to achieve the requirement.
app/code/Anshu/CategoryFilter/registration.php
app/code/Anshu/CategoryFilter/etc/module.xml
app/code/Anshu/CategoryFilter/Block/CategoryFilter.php
app/code/Anshu/CategoryFilter/view/frontend/requirejs-config.js
app/code/Anshu/CategoryFilter/view/frontend/web/js/categoryfilter.js
app/code/Anshu/CategoryFilter/view/frontend/templates/categoryfilter.phtml
You can modify this code according to your requirement. I hope this will be helpful.
I have to show this block on cms page, so I have called it in CMS page in admin. You can call this or show this block at any place you want.