I have a custom phtml showing list of products with specific brand shown like below.

enter image description here

I need to show the sidebar like this image in phtml as shown in the category view page of Magento 2

enter image description here

I tried this code

<referenceContainer name="columns">
    <container name="div.sidebar.main" htmlTag="div" htmlClass="sidebar sidebar-main" after="main">
        <container name="sidebar.main" as="sidebar_main" label="Sidebar Main"/>
    <container name="div.sidebar.additional" htmlTag="div" htmlClass="sidebar sidebar-additional" after="div.sidebar.main">
        <container name="sidebar.additional" as="sidebar_additional" label="Sidebar Additional"/>
    <container name="columns.main" htmlTag="div" htmlClass="brand-additional"  before="-"  >
        <block class="Brands\BrandsModules\Block\Index\Index" name="brandsmodules_index_demo" template="Brands_BrandsModules::brandsmodules_index_demo.phtml"/>
  • Is this a custom page layout? If so nothing will load because you are only adding containers without any actual blocks. – Ben Crook Sep 20 at 12:33

Your Answer

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

Browse other questions tagged or ask your own question.