Hi,
I want to show produtcts in all categories like products in particular category on 'Home Page' setted to top page.
What should I do?
Please help me.
Hi @yuki_ito
You mean you wanted to assign all products to specific category ? can you please elaborate question more ? so its help us to troubleshoot the issue , also you can provide screenshot if you have !
Thanks for reply.
I mean I want to show all products in default category .
Its layout is equal to a layout in a specific category under Default Category.
I also want to show that products on the root page, e.g. https://hogehoge.com/.
Hello @yuki_ito
Do you want to do it by coding or you can do by admin panel as well. You can assign all products in that category.
Please let me know if you need any other solutions.
Hi @yuki_ito
Yes , you can add categories/product on the homepage as well , here is the link to know how to add those products into homepage/root page - https://www.mageplaza.com/kb/magento-2-how-insert-products-homepage.html
Regarding default category , yes you can add all products in default categories as well - You can do it from admin panel and you can also done the same operation using code as well !
Also just to give your more info - Default category is root category of magento , so you need to add your category under the root category only !
Hope it helps
Hello @Manish Mittal
I want to do it by coding to magage code as files.
After, I create /Magento_Cms/layout/default.xml in my theme by coping /vendor/magento/module-catalog/view/frontend/layout/catalog_category_view.xml and saw the root page.
But , in conjecture, its code doesn't specify category, so error displayed as follows.
PHP Fatal error: Uncaught Error: Call to a member function getDisplayMode() on null in /var/www/html/w_w_auction/vendor/magento/module-catalog/Block/Category/View.php:160 Stack trace: #0 /var/www/html/w_w_auction/vendor/magento/module-catalog/view/frontend/templates/category/products.phtml(17): Magento\\Catalog\\Block\\Category\\View->isContentMode() #1 /var/www/html/w_w_auction/vendor/magento/framework/View/TemplateEngine/Php.php(59): include('/var/www/html/w...') #2 /var/www/html/w_w_auction/vendor/magento/framework/View/Element/Template.php(270): Magento\\Framework\\View\\TemplateEngine\\Php->render(Object(Magento\\Catalog\\Block\\Category\\View), '/var/www/html/w...', Array) #3 /var/www/html/w_w_auction/vendor/magento/framework/View/Element/Template.php(300): Magento\\Framework\\View\\Element\\Template->fetchView('/var/www/html/w...') #4 /var/www/html/w_w_auction/vendor/magento/framework/View/Element/AbstractBlock.php(667): Magento\\Framework\\View\\Element\\Template->_toHtml() #5 /var/www/html/w_w_auction/vendor/magento/framework/View/Layou in /var/www/html/w_w_auction/vendor/magento/module-catalog/Block/Category/View.php on line 160
How to specify category ?
I tried your suggestion.
Yes , you can add categories/product on the homepage as well , here is the link to know how to add those products into homepage/root page - https://www.mageplaza.com/kb/magento-2-how-insert-products-homepage.html
I can show all products in default categories, but layered navigation with filterable attributes don't work.
I also want to work layered navigation with filterable attributes with not admin panel but using code.
After adding a category under the root category, what shoud I do?