magento2产品布局文件详解

7天成为Magento系统架构师,现在开始学习Magento全栈开发!

《Magento2.X企业级开发实战》

本主题提供有关产品布局文件的信息。Magento允许您自定义通用布局文件中所有产品类型的查看页面。还可以按产品实体ID或SKU为特定产品类型甚至具体产品页面执行自定义。

magento2产品布局文件列表:

LAYOUT FILEDESCRIPTION
catalog_product_view.xmlCommon layout. Affects all product types
catalog_product_view_type_bundle.xmlLayout from this file is applied to bundle product only
catalog_product_view_type_configurable.xmlLayout from this file is applied to configurable product only
catalog_product_view_type_downloadable.xmlLayout from this file is applied to downloadable product only
catalog_product_view_type_grouped.xmlLayout from this file is applied to grouped product only
catalog_product_view_type_simple.xmlLayout from this file is applied to simple product only
catalog_product_view_type_virtual.xmlLayout from this file is applied to virtual product only
catalog_product_view_id_{id}.xmlLayout from this file is applied to the specific product by Entity ID value. E.g. catalog_product_view_id_45.xml
catalog_product_view_sku_{sku}.xmlLayout from this file is applied to the specific product by SKU value. E.g. catalog_product_view_sku_24-WG080.xml

自定义产品视图页面

使用产品页面上的容器来构造布局中的内容。可以引用容器并向其添加块。

容器使用布局XML文件中的容器标记将内容结构分配给页面。除了包含元素的内容外,容器没有其他内容。容器的示例包括:

  • product.info.main
  • product.info.price
  • product.info.stock.sku
  • product.info.form.content
  • product.info.extrahint
  • product.info.social
  • product.info.media

Example

1
<move element="product.info.social" destination="product.info.main" before="product.info.price"/>

magento2购物车结算配置页面

checkout_cart_configure.xmlCommon layout. Affects all product types
checkout_cart_configure_type_bundle.xmlLayout from this file is applied to bundle product only
checkout_cart_configure_type_configurable.xmlLayout from this file is applied to configurable product only
checkout_cart_configure_type_downloadable.xmlLayout from this file is applied to downloadable product only
checkout_cart_configure_type_simple.xmlLayout from this file is applied to simple product only
checkout_cart_configure_id_{id}.xmlLayout from this file is applied to the specific product by Entity ID value. E.g. checkout_cart_configure_id_45.xml
checkout_cart_configure_sku_{sku}.xmlLayout from this file is applied to the specific product by SKU value. E.g. checkout_cart_configure_sku_24-WG080.xml
checkout_cart_item_renderers.xmlLayout from this file is applied to renderer’s cart page items

magento2心愿单wishlist布局页面:

wishlist_index_configure.xmlCommon layout. Affects all product types
wishlist_index_configure_type_bundle.xmlLayout from this file is applied to bundle product only
wishlist_index_configure_type_configurable.xmlLayout from this file is applied to configurable product only
wishlist_index_configure_type_downloadable.xmlLayout from this file is applied to downloadable product only
wishlist_index_configure_type_grouped.xmlLayout from this file is applied to grouped product only
wishlist_index_configure_type_simple.xmlLayout from this file is applied to simple product only
wishlist_index_configure_id_{id}.xmlLayout from this file is applied to the specific product by Entity ID value. E.g. wishlist_index_configure_id_45.xml
wishlist_index_configure_sku_{sku}.xmlLayout from this file is applied to the specific product by SKU value. E.g. wishlist_index_configure_sku_24-WG080.xml
如无特殊说明或标注,任何个人或组织,复制、转载、采集本站内容请注明:
本文来源于:【Magento中文网】,并添加本文地址链接。
如未按上述操作复制或转载,本站有权追究法律责任。
若本站内容侵犯了原著者的合法权益,可联系我们进行处理。