1

In a category page I have a product list, that's good, but, when the category is a parent (level-1) i want an other style page.

For example, I want to display one slider with a new product filtered by current category, one menu with subcategory but not the list of products with filters etc...

Basically, just one page without the listing products.

Please, could you give me the best practice ?

2

You can do your task by creating custom layout xml and call slider and product block in custom layout

1) Create custom layout xml and call your slider block and filters

app/design/frontend/Vendor/theme/Magento_Theme/page_layout/custom-layout.xml

<?xml version="1.0" ?>
    <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_layout.xsd">
        <update handle="empty"/>
        <referenceContainer name="page.wrapper">
            <container name="header.container" as="header_container" label="Page Header Container"  htmlTag="header" htmlClass="page-header" before="main.content"/>
            <container name="page.top" as="page_top" label="After Page Header" after="header.container"/>
        </referenceContainer>
    </layout>

2) Create layout.xml

app/design/frontend/Vendor/theme/Magento_Theme/layouts.xml

<page_layouts xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/PageLayout/etc/layouts.xsd">
    <layout id="custom-layout">
        <label translate="true">Custom Layout</label>
    </layout>
</page_layouts>

Now you can use this custom layout from admin Category->Design->Layout

  • The problem, it goes into the layout "catalog_category_view_type_layered" (layout for my sub categories), so I have script errors for example: customer-data.js: 85 Uncaught TypeError: Can not read property 'sectionLoadUrl' of undefined. How can i disabled this layout for only category parent or in custom layout ? – Kévin Vuillemin Jul 3 '17 at 23:01
0

You can do this by adding your slider and subcategory menu in a static block and then choose static block for parent categories from Category->Content->Add CMS Block and then change Category display mode to Static Block Only from Category->Display Settings->Display Mode

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.