In Mergado, variables represent particular values of an element.
For example, if your feed includes the
PRICE_VATelement containing a product price incl. VAT, then that price is different for each product. Therefore the
PRICE_VATelement contains a variable numeric value, which we can refer to as a variable. So for each product, the variable has a different value.
Each variable has a unique name, which is usually identical to the name of the given element. This makes it easier to identify which element values does the variable represent.
When using variables in Mergado, put the percent (%) sign around the variable name. E.g.
%PRODUCTNAME%is a variable of the
To manage variables in Mergado, use the Variables link in the main menu of the export home page.
Most often you use variables to fill a new element with values from a different element (using rules). You can also use variables to separate variable parts of text from an element. Let’s say your product name includes size and color parameters that vary from product to product. Using variables you can get the information about size and color for each product and save these values to the
You want to create a new product name from different elements to contain: manufacturer + original product name from store + product size parameter. To do this, you create a new OVERWRITE rule that will overwrite the PRODUCTNAME element with these 3 variables:
%PARAM_SIZE%. An example of such product name after the rule is applied would be Adidas Men T-shirt XXL.
To create a new variable, go to Variables page and click New variable. Then:
- 1.Choose an element from which the variable should be created
- 2.Put a regular expression, that represents a way to select a text in a given element
- 3.In the Test text field, you will see a randomly selected value of the chosen element based on the regular expression that you provided. When you click the two arrows sign, the value will randomly change.
- 4.Click Test expression
- 5.If you are not happy with the result, you can modify the expression and test again.
- 6.Once you are happy with the result, just enter a name for the new variable and click Save variable.
Creating a new variable example:
Further information about variables and how to use them can be found on our blog.