bkubicki/module-configurable-product-attribute-handles

模块向目录前端添加基于可配置产品的自定义布局处理程序

1.0.0 2021-06-09 06:18 UTC

This package is auto-updated.

Last update: 2024-09-09 13:48:21 UTC


README

概述

模块添加自定义前端布局处理程序和扩展点,以便更容易地自定义可配置产品。

功能

  • 产品卡片 - 基于产品超级属性的处理器,模式:catalog_product_view_type_configurable_super_{{attribute_code}}
  • 产品卡片 - 可配置选项块的特定模板。块 vendor/magento/module-swatches/Block/Product/Renderer/Configurable.php:443 只允许两个模板(来自 Magento_Swatches 的一个和来自 Magento_ConfigurableProduct 的默认模板),忽略任何布局指令。通过在布局中添加一些数据,我们可以根据产品超级属性更改模板
<referenceBlock name="product.info.options.swatches">
    <arguments>
        <argument name="configurable_super_templates" xsi:type="array">
            <item name="configurable_super_colour" xsi:type="string">Vendor_Module::product/view/type/options/configurable-super-colour.phtml</item>
        </argument>
    </arguments>
</referenceBlock>

此类指令可以与产品超级属性处理器结合使用,但不必如此。

  • 产品列表 - 定义可配置超级产品的额外渲染器,模式:configurable_super_{{attribute_code}}'。使用示例
<block name="category.product.type.details.renderers.configurable_super_example_attribute" as="configurable_super_example_attribute"
       template="Vendor_Module::product/listing/super-example-attribute-renderer.phtml"/>

别忘了添加渲染器的别名,因为它是用于选择渲染器的。

请参阅附加模块,以全面了解这些功能的可能用法。

先决条件

  • PHP 7.3|7.4

安装

要安装此扩展,请使用以下命令

 composer require bkubicki/module-configurable-product-attribute-handles

版本控制

我们使用 SemVer 进行版本控制。有关可用的版本,请参阅此存储库的标签

变更日志

请在此处查看变更日志

作者

许可

此项目根据 MIT 许可证授权 - 有关详细信息,请参阅LICENSE 文件。