bkubicki / module-configurable-product-attribute-handles
Module adds to catalog frontend custom layout handles based on configurable product
Installs: 41
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:magento2-module
Requires
- php: ~7.3.0||~7.3.0
- magento/module-catalog: 103.0.*||103.0.*
- magento/module-configurable-product: 100.3.*||100.4.*
This package is auto-updated.
Last update: 2024-12-09 14:24:45 UTC
README
Overview
Module adds custom frontend layout handles\extension points for easier frontend customization of configurable product.
Features
- product card - handles basing on product super attributes, pattern:
catalog_product_view_type_configurable_super_{{attribute_code}}
- product card - specific templates for configurable options block. Block
vendor/magento/module-swatches/Block/Product/Renderer/Configurable.php:443
allows only two templates (one fromMagento_Swatches
and the default one fromMagento_ConfigurableProduct
), ignoring any layout instructions. By adding some data in layout, we can change template for custom one, based on product super attributes:
<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>
Such an instruction can be combined with product super attributes handles, but it doesn't have to be.
- product listing - possibility to define additional renderers for configurable super products, pattern:
configurable_super_{{attribute_code}}'
. Usage example:
<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"/>
Don't forget to add alias for renderer, as it is used for renderer picking.
Please see attached module to fully understand possible usage of these features.
Prerequisites
- PHP 7.3|7.4
Installation
To install the extension use the following commands:
composer require bkubicki/module-configurable-product-attribute-handles
Versioning
We use SemVer for versioning. For the versions available, see the tags on this repository.
Changelog
See changelog here.
Authors
License
This project is licensed under the MIT License - see the LICENSE file for details.