AttributeFields transformer

Generates a json with all the attributes for the product Concrete. If the pipeline has data like this:

[
    'attribute_key_1' => 'deAttributeKey1Test',
    'value_1' => 'deValue1Test',
    'attribute_key_2' => 'deAttributeKey2Test',
    'value_2' => 'deValue2Test',
],

Its gonna combine the key name and value that it looks like this:

{
    "deAttributeKey1Test": "deValue1Test"
}

Setting the fromPrefix means, its gonna look for the keyword provided. For example if fromPrefix = attribute_key_, its gonna look for every appearance with a counter at the end. attribute_key_1, attribute_key_2 and so on. And then get the Data from the provided valuePrefix.

To build the Transformer, it should look like this:

<product-attribute-fields to="productAttributes"
    fromPrefix="attribute_key_"
    valuePrefix="value_"
/>

Attributes:

  • to - name of the field to be created, its the key name which holds the generated json

  • fromPrefix - name of the field to be transformed, prefix means it starts with it

  • valuePrefix - name of the field to read the value, prefix means it starts with it

At the end, its gonna generate an Entry like this:

"productAttributes": "{\"deAttributeKey1Test\":\"deValue1Test\",\"deAttributeKey2Test\":\"deValue2Test\"}"