无法扩展/覆盖父级“移动”元素

时间:2018-08-25 00:43:05

标签: magento2

在父主题的catalog_product_view.xml中有此内容,只是复制了我试图更改的行之后的一行内容:

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceContainer name="content">
            <block class="Infortis\Base\Block\Product\View" name="product-view-wrapper" template="product/view.phtml" before="-">
                <container name="container_product_image_1" label="Product View, Image Column" />
                <container name="container_product_primary_1" label="Product View, Primary Column, Container 1" />
                <container name="container_product_primary_2" label="Product View, Primary Column, Container 2" />
                <container name="container_product_secondary_1" label="Product View, Secondary Column, Container 1" />
                <container name="container_product_secondary_2" label="Product View, Secondary Column, Container 2" />
                <container name="container_product_lower_primary_1" label="Product View, Lower Primary Column, Container 1" />
                <container name="container_product_lower_primary_2" label="Product View, Lower Primary Column, Container 2" />
                <container name="container_product_lower_secondary_1" label="Product View, Lower Secondary Column, Container 1" />
                <container name="container_product_lower_secondary_2" label="Product View, Lower Secondary Column, Container 2" />
                <block class="Magento\Cms\Block\Block" name="block_product_secondary_bottom">
                    <arguments>
                        <argument name="block_id" xsi:type="string">block_product_secondary_bottom</argument>
                    </arguments>
                </block>
            </block>
        </referenceContainer>

        <move element="product.info.main" destination="product-view-wrapper" />
        <move element="product.info.media" destination="product-view-wrapper" />
        <move element="bundle.options.container" destination="product-view-wrapper" />
        <move element="product.info.details" destination="product-view-wrapper" />
        <move element="catalog.product.related" destination="product-view-wrapper" />
        <move element="product.info.upsell" destination="product-view-wrapper" />
        <move element="product.info.overview" destination="product.info.main" before="product.social.links" />
        <move element="container_product_primary_1" destination="product.info.main" before="product.info.price" />

但是我需要将其移动到儿童主题的其他位置,例如:

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <move element="product.info.overview" destination="product.info.main" before="product.social.links" />
    </body>
</page>

,但是它不想扩展父级,并且一旦我从父级布局文件中删除了该行,它就会立即将其移动到需要的位置。我在做什么错了?

编辑:

它在Infortis> Ultimo主题中

父xml文件: /app/design/frontend/Infortis/base/Magento_Catalog/layout/catalog_product_view.xml

子xml文件 /app/design/frontend/Infortis/childtemp/Magento_Catalog/layout/catalog_product_view.xml

2 个答案:

答案 0 :(得分:0)

您确定在自定义主题中找到了正确的布局路径吗?在我看来,后备是问题。

答案 1 :(得分:0)

好吧,我终于找到了问题所在。在数据库的主题表中,像所有其他主题一样,主题被设置为“ 1”,而不是“ 0”。我不确定如何将其设置为1,但我认为这意味着虚拟而非物理。我什至不知道这意味着什么,但这解决了问题。现在,我的子xml很好地扩展了父xml。谢谢您的帮助!