不能 extend/override 父 "move" 元素
Can't extend/override parent "move" element
在父主题的 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
您确定您在自定义主题中找到了正确的布局扩展路径吗?在我看来,后备是问题所在。
好的,我终于找到问题了。在数据库中的主题 table 中,主题被设置为“1”而不是像所有其他主题一样的“0”。我不确定它是如何设置为 1,但我相信这意味着 Virtual 而不是物理的..我什至不确定那是什么意思,但这解决了问题。现在我的 child xml 扩展了 parent xml 就好了。感谢您的帮助!
在父主题的 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
您确定您在自定义主题中找到了正确的布局扩展路径吗?在我看来,后备是问题所在。
好的,我终于找到问题了。在数据库中的主题 table 中,主题被设置为“1”而不是像所有其他主题一样的“0”。我不确定它是如何设置为 1,但我相信这意味着 Virtual 而不是物理的..我什至不确定那是什么意思,但这解决了问题。现在我的 child xml 扩展了 parent xml 就好了。感谢您的帮助!