Indexing
Attributes

Attribute Mapping

3min

It is possible to map Magento attributes to Klevu attributes via di.xml The modules already map some attributes where the names in Klevu and Magento differ. e.g. Magento's short_description to Klevu's shortDescription.

The current product attribute mapping can be found in module-m2-indexing-products/etc/di.xml and looks like this:

module-m2-indexing-products/etc/di.xml


Adding Mapping for Attributes

If instead of using the Magento attribute description for the Klevu attribute description you wanted to use my_custom_attribute. Create your own module and add etc/di.xml like this

Vendor/Module/etc/di.xml


Now if you access my_custom_attribute in Magento admin you’ll see that the Klevu section can no longer be updated as it is mapped to a standard Klevu attribute and standard Klevu attributes are immutable. However, the description attribute will be editable as it is no longer mapped to a standard Klevu attribute.

If description is also set to be registered with Klevu this will cause an issue as there are 2 Magento attributes mapped to the same Klevu attribute (if no mapping is in place then an attribute will use its attribute code). Therefore mapping for description would also be required. e.g.

Vendor/Module/etc/di.xml


or

Vendor/Module/etc/di.xml




Updated 23 Sep 2024
Doc contributor
Did this page help you?