0

I'm trying to add a overview of all products with filter on the Homepage of my Magento store. I followed the following tutorial from PHP Cuong which I got up and running.

https://github.com/php-cuong/magento2-one-page-products

Currently I have a separate page with the following url "/phpcuong/product/onepage" which shows an overview of both the product filter and the products. But what I want to achieve is to have the content of this page (All products and the productfilter) to pop-up as part of my homepage.

I was not able to find any other thread about this topic. Most threads I found add products to the homepage with block shortcodes.

0

The module turned out to be unnecessary to my issue, the solution came from the following website in the form of xml code.

https://swissuplabs.com/blog/practical-guide-magento-and-magento-2-layered-navigation/

The following adds an overview of all filters on the homepage:

<referenceContainer name="sidebar.main">
<block class="Magento\LayeredNavigation\Block\Navigation\Category" name="catalog.leftnav" before="-" template="layer/view.phtml">
    <block class="Magento\LayeredNavigation\Block\Navigation\State" name="catalog.navigation.state" as="state" />
    <block class="Magento\LayeredNavigation\Block\Navigation\FilterRenderer" name="catalog.navigation.renderer" as="renderer" template="layer/filter.phtml"/>
</block>

The following adds an overview of all products on the homepage:

<referenceContainer name="content">
    <block class="Magento\Catalog\Block\Product\ListProduct" name="category.products.list" as="product_list" template="Magento_Catalog::product/list.phtml">
        <container name="category.product.list.additional" as="additional" />
        <block class="Magento\Framework\View\Element\RendererList" name="category.product.type.details.renderers" as="details.renderers">
            <block class="Magento\Framework\View\Element\Template" as="default"/>
        </block>
        <block class="Magento\Catalog\Block\Product\ProductList\Item\Container" name="category.product.addto" as="addto">
            <block class="Magento\Catalog\Block\Product\ProductList\Item\AddTo\Compare"
                  name="category.product.addto.compare" as="compare"
                  template="Magento_Catalog::product/list/addto/compare.phtml"/>
        </block>
        <block class="Magento\Catalog\Block\Product\ProductList\Toolbar" name="product_list_toolbar" template="Magento_Catalog::product/list/toolbar.phtml">
            <block class="Magento\Theme\Block\Html\Pager" name="product_list_toolbar_pager"/>
        </block>
        <action method="setToolbarBlockName">
            <argument name="name" xsi:type="string">product_list_toolbar</argument>
        </action>
    </block>
</referenceContainer>

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.