Attributes Mapping

Table of Contents

General settings

The majority of the feed-specific attributes have been set up automaticaly but is some cases you may find usefull to adjust attribute behavior more specificaly.

  • Feed attribute - Name of the element/column in target XML/CSV feed.
  • XPath - Element location in XML feed.
  • Prefix - Constant prefix for exported value. The same for all products.
  • Default value - Constant value.The same for all products. This value is exported in case that Magento attribute is not chosen or its value is empty.
  • Magento attribute - The value of selected Magento product attribute is exported as feed attribute value.
  • Convert attribute - Described below in more detail.
  • Suffix - Constant suffix for exported value. The same for all products.
  • Export parent product attribute value - Export the parent product attribute value instead of Magento attribute value of given child product.
    • Yes - Export the parent product attribute value for all its child products.
    • No - Export of the parent product attribute value is disabled.
    • If empty - Export the parent product attribute value only if the attribute value of its child product is empty.
  • Chars limit - Character limitation for exported value.
  • Post-process action- Text processing functions for an exported value. The value is processed as a text string. This is multi-select option.
    • Cdata - Characted data. Text is enclosed in "<![CDATA[]>".
    • Remove end of lines - Removes end of character lines.
    • Remove spaces - Removes character spaces, e.g. tab, end of line, space etc.
    • Strip tags - Strips HTML and PHP tags.
    • Encode special chars - Converts special characters to HTML entities.
    • Decode special chars - Converts special HTML entities back to characters.
    • Encode html entities - Convert all applicable characters to HTML entities.
    • Decode html entities - Convert all HTML entities to their applicable characters.
    • Insert HTML line breaks - Inserts HTML line breaks (<br/>) before all newlines  (\r\n\n\r\n and \r) in a string.



Table row is disabled

Disabled row in Attribute mapping table means that the given row is already preconfigured according to the feed requirements and it is not possible to change that option.

Convert attribute value

In some cases you may need to convert Magento-stored attribute value to different XML feed value. Also, you canuse this feature for simple attribute translations.

Regular expressions

Upgrade to 6.5.0.0 or newer

Support for regular expressions was improved in connector version 6.5.0.0. Thus, we encourage you to upgrade. For details see issue XML-642.

You can use regular expressions to convert attribute values. Regular expressions must be enclosed in slashes:

Example
To convert all small "a" to big "A" letters in the attribute value, use the following regular expression:
From: /[a]/
To: A
This rule converts "BlackBerry 8100 Pearl" to "BlAckBerry 8100 PeArl".
 
To remove all HTML tags apart from I, EM, B, STRONG, UL, LI, U and BR
From: /\<((?!i\>|\/i|i\/|em\>|\/em|em\/|b\>|\/b|b\/|strong\>|\/strong|strong\/|ul\>|\/ul|ul\/|li\>|\/li|li\/|u\>|\/u|u\/|br\>|\/br|br\/)([^\>]*))\>/
To: empty

To transform all non-empty strings into TRUE
From: /.+/
To: empty

To export only image file name, instead of full image url. 
From: /.+\//
To: empty
For example value http://www.domain.com/media/catalog/product/t/0/t0001_love.jpg is transformed into t0001_love.jpg
 
To export sub-string till 2nd space.
From: /([^\s]+\s{1}[^\s]+)(.*)/
To: $1
For example value Invicta Speedway Chronograf 9211 is transformed into Invicta Speedway
 
To transform string which contains WOMEN to WOMEN and other strings to MEN.
Input: MEN, SNEAKERS or SNEAKERS, WOMEN

From: /.*WOMEN.*/  To: WOMEN
From: /^(?!WOMEN).*/  To: MEN

PHP function preg_replace () is used for conversions.

Attribute merging

This feature may be very usefull for better SEO!

In the columns Prefix and Suffix you may use special expressions allowing you to merge any attribute values and/or combine attribute values with constat values.

Example
Color-{{attribute_code1}}-size-{{attribute_code2}}


Price margin

Since Koongo Connector version 6.5.0.0 you may use basic mathematical operations to handle price attributes or any numeric attribute values:

  • +, -, *, /
Example
In Prefix or Sufix column you may use following expression to increases price by 15%.
[[{{price_final_include_tax}} * 1.15]]

// increasing the price by 25
[[{{price_final_include_tax}} + 25]]

Note that attribute code you may find in attribute detail under Catalog > Attributes > Manage Attributes.

Conditions

Empty Attribute Condition

You can set a condition to export non-empty values only.

Empty Attribute Condition example
// if value of the 'name' attribute is not empty the 'name' value is used, otherwise it is used the value of the 'description' attribute
  [[('{{name}}' != '') ? '{{name}}': '{{description}}']]
 
// note double curling brackets surrounding attribute codes

Attribute Value Condition

You can define a value condition to modify exported value based on the input value.

Attribute Value Condition example
// if product price is higher than 100 then use product price as the final price, otherwise increase the price for 20 (adding 20 as shipping costs)
[[({{price_final_include_tax}} > 100) ? {{price_final_include_tax}} : {{price_final_include_tax}} + 20]]
 
// note double curling brackets surrounding attribute codes

Addition of a new attribute

If the given feed template allows it, you can add custom attributes at the end of Attributes mapping table:

Troubleshooting

Magento attribute displayed in red color

Following attributes missing in product flat catalog

Price including VAT export

Related articles