我正在尝试将分层导航移动到页面上特定的位置。
以下是myflag
处的布局XML:
Magento_LayeredNavigation/page_layout/1column.xml
这很好用,它将分层导航移动到内容区域。但是我想将分层导航移到这里(<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_layout.xsd">
<move element="catalog.leftnav" destination="content" after="-"/>
</layout>
):
category.products
将<referenceContainer name="content">
<block class="Magento\Catalog\Block\Category\View" name="category.products" template="Magento_Catalog::category/products.phtml">
处的布局XML更改为此功能:
Magento_LayeredNavigation/page_layout/1column.xml
有人能告诉我在现有元素中移动元素的正确方法吗?
答案 0 :(得分:0)
将catalog_category_view.xml
覆盖到您的主题
示例app-&gt; design-&gt; frontend-&gt; pakage-&gt; theme-&gt; Magento_Catalog-&gt; layout-&gt; catalog_category_view.xml
<?xml version="1.0"?>
<!--
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<move element="catalog.leftnav" destination="category.product.list.additional" before="-"/>
</body>
</page>
对于类别页面,您还可以覆盖所有页面