Sometimes, flexible conditions are required in order to export certain product information to the feed file. The Dynamic Attribute feature in the FeedPro extension offers the functionality that allows you to configure desired conditions according to which the necessary information will be added to the feed file.
The principle of the Dynamic attribute is as follows:
If a certain condition is true, then a certain value is output in the feed file.
To access the Dynamic attributes section in Magento® 2 admin panel, go to Marketing >> Manage Dynamic Attributes.
Screenshot: Dynamic attributes
In order to add a new Dynamic attribute, press the “Add New Dynamic Attribute” button.
Screenshot: Adding a Dynamic attribute
The configuration panel of a Dynamic attribute will open. Fill in the mandatory fields.
Screenshot: Attribute information
Under the Attribute information tab, set the Code and the Name of your Dynamic attribute.
The code is an internal attribute identifier that will help Magento® to distinguish your dynamic attribute from the standard product attributes. The code must be unique. It must not be identical to any other attribute code in your system. No spaces are allowed in the code.
The name of a dynamic attribute may be anything you wish, but it must also be unique. The existence of two or more attributes with identical names will lead to confusion in the system and wrong values being exported.
Save the settings as soon as all information is filled in.
Conditions and Values
Under Conditions and Values tab, configure the conditions according to which the dynamic attribute will function.
Screenshot: Conditions and Values
Select the product attribute that you wish to set as dynamic. Then select the Condition to be fulfilled in order for the necessary Value to be output.
The following conditions are available:
- not equal
- greater than
- less than
- greater than or equal to
- less than or equal to
- not like
Select the type of the output value. Available types are:
Attribute: the value of the attribute selected in the last column will be output in the feed instead of the attribute selected in the first column.
Static Value: the text entered in the ‘Value’ field will be output statically in the feed for the products that meet the specified condition.
Percent from value: mostly used for the price attributes in order to output discounted or special prices as a percentage of the general product price.
Configurable values: used to output the values of the specified attributes for Configurable products in the feed.
You can add or remove conditions using the "Add Condition" or "Delete" buttons.
Add New Value
You can add new values with condition(s) using the "Add New Value" button.
Use Default Attribute
Select the Attribute that will be used for the products which do not meet the specified conditions.
As soon as all attributes are configured, save the settings. In order to add the Dynamic attribute to the feed, go to Content settings and create a new field for your Dynamic attribute. If your feed format is XML, use the Dynamic attribute code from the Attribute information tab to include the attribute to XML feed structure.