ChannelEngine: replacement tags for channel mappings
About this article
This article describes how to use replacement tags to map product content and offer attributes within a channel plugin.
Table of contents
Replacement tags using ChannelEngine fields
Replacement tags using custom fields
Introduction
Replacement tags provide you with another node of control when performing the content and offer mappings. Use replacement tags to edit your product data directly in the Mapping step, without modifying your source content in the product feed.
Replacement tags have the format {CE:FieldName} or {MY:FieldName}, where CE and MY define the kind of attribute (default and custom, respectively), while FieldName is the name of the field from ChannelEngine that you want to use.
Use a replacement tag when mapping a content or offer attribute. Select Fixed value or Advanced rules from the attribute's mapping options dropdown.
Replacement tags using ChannelEngine fields
Replacement tags using ChannelEngine fields have the format {CE:FieldName}. ChannelEngine fields have standard names, listed below.
Replacement tags using ChannelEngine fields
| Replacement tag | ChannelEngine field |
| {CE:Name} | Name/Title |
| {CE:Description} | Description |
| {CE:Details} | Details |
| {CE:MerchantProductNo} | Merchant product number |
| {CE:VendorProductNo} | Vendor product number |
| {CE:Ean} | GTIN (e.g.: EAN, UPC, etc.) |
| {CE:Brand} | Brand |
| {CE:Stock} | Stock |
| {CE:Size} | Size |
| {CE:GroupNo} | Parent SKU |
| {CE:GroupNo2} | Grandparent SKU |
| {CE:Color} | Color |
| {CE:CategoryTrail} | Category |
| {CE:Price} | Price |
| {CE:ListPrice} | Catalog price |
| {CE:PurchasePrice} | Purchase price |
| {CE:MinPrice} | Minimum price |
| {CE:MaxPrice} | Maximum price |
| {CE:VatRate} | VAT % |
| {CE:DiscountRate} | Discount |
| {CE:Margin} | Margin % |
| {CE:ShippingCost} | Shipping cost |
| {CE:ShippingTime} | Shipping time (days) |
| {CE:Url} | Product URL |
| {CE:ImageUrl} | Image URL |
| {CE:ExtraImageUrl1},{CE:ExtraImageUrl2}, {CE:ExtraImageUrl3}, etc. | Extra image URL 1, Extra image URL 2, Extra image URL 3, etc. |
Replacement tags using custom fields
Replacement tags using custom fields have the format {MY:FieldName}. Your custom field names are the ones you defined when you created the custom fields.
Special characters
If the name of your custom field contains special characters, such as { } or |, make sure to properly escape them using double quotation marks (""). To do so, place the entire name of your custom field inside double quotation marks. E.g.: "Description|Amazon|Full" or "Weight{kg}".
Unless special characters are properly escaped, ChannelEngine interprets them incorrectly – which can result in errors.
Using translated attributes
If you use ChannelEngine's translation feature to translate attributes like Description, make sure to use the correct structure: MY:NameOfOriginalField|Origin:2-LetterLanguageCode.
The Origin is where the attribute comes from. Description, for example, is a default ChannelEngine field, so the appropriate input is |CE:. However, translated attributes are considered as custom fields on ChannelEngine – so |MY: is the correct input. Note that the translation feature changes the NameOfOriginalField to all capitals, if it is a ChannelEngine field.
E.g.:
- {MY:COLOR|CE:FR} - takes the French-translated value of the Color attribute.
- {MY:DESCRIPTION|CE:DE|Ellipsize{2000}} - takes the German-translated value of the Description attribute, uses it, and limits its number of characters to 2,000.
- {MY:Gender|MY:NL|ToUpper} - takes the Dutch-translated value of the Gender attribute and changes it to uppercase.
Advanced replacement tags
Besides replacing the value of an attribute using replacement tags, it is possible to apply advanced actions to the content of the replacement tag. The following actions are supported:
Advanced actions on replacement tags
| Action | Example | Value | Result |
|---|---|---|---|
| Replace text | {CE:Description|Replace{Shoes|Sneakers}} | Red Shoes | Red Sneakers |
| To uppercase | {CE:Description|ToUpper} | Red Shoes | RED SHOES |
| To uppercase* | {MY:"Description|for|Amazon"|ToUpper} | Red Shoes | RED SHOES |
| To lowercase | {CE:Description|ToLower} | Red Shoes | red shoes |
| To title case | {CE:Description|ToTitle} | reD sHoes | Red Shoes |
| To EAN13 | {CE:Ean|ToEan13} | 050743174049 | 0050743174049 |
| Trim spaces | {CE:Description|Trim} | Red Shoes | Red Shoes |
| Extract text | {CE:Description|Extract{^(w+)|$1||}} | Red Shoes | Red |
| Remove text | {CE:Description|Remove{Red}} | Red Shoes | Shoes |
| Take left section of text | {CE:Description|Left{5}} | Red Shoes | Red S |
| Take right section of text | {CE:Description|Right{5}} | Red Shoes | Shoes |
| Ellipsize text | {CE:Description|Ellipsize{6}} | Red Shoes | Red S… |
| Wordwrap text | {CE:Description|Wordwrap{6}} | Red Shoes | Red |
| Round number | {CE:DiscountRate|Round{1}} | 22.48 | 22.5 |
| Round number to ceiling (up) | {CE:DiscountRate|RoundCeiling} | 8.46 | 9 |
| Round number to floor (down) | {CE:DiscountRate|RoundFloor} | 2.96 | 2 |
| Convert GTIN to ISBN-10** | {CE:Ean|ToIsbn10} | 978-0-14-044913-9 |
0-14-044913-2 |
| Multiply number | {MY:Weight|Multiply{1000}} | 0.125 | 125 |
| Divide number | {MY:Weight|Divide{1000}} | 12740 | 12.74 |
| Divide number* | {MY:"Weight|in|kg"|Divide{1000}} | 1875 | 18.75 |
It is also possible to chain multiple actions together. The output of the previous action is then used as the input for the next action.
E.g.:
- Replacement tag {CE:Description|Replace{shoes|sneakers}|ToUpper}
- Take ChannelEngine Description ? ' New red shoes
- Replace shoes with sneakers ? ' New red sneakers
- Convert to uppercase ? ' NEW RED SNEAKERS
A detailed explanation of the main actions available can be seen below:
- ToTitle - transforms the inputted text to title case. Unlike ToLower and ToUpper, it only capitalizes the first letter of each word – which is useful for titles. If you input 'red shoes', it converts it to 'Red Shoes'. Note that any word in all capitals is considered an acronym, therefore it is not converted. If the description value is 'RED SHOES', {CE:Description|ToTitle} still outputs RED SHOES. In these cases, consider chaining it with ToLower first using ({CE:Description|ToLower|ToTitle}).
- ToEan13 - converts any valid EAN input to the EAN13 format. 12-digit EANs receive a 0 as a prefix, 14-digit EANs that start with a 0 have it removed. If you submit an invalid EAN, the output is empty, so only use this replacement tag on a valid EAN input. Note that you could use this to significantly change the EAN of a product, which may have consequences if you have offers online.
-
Extract - extracts the text section that complies with the regular expression used. {CE:Description|Extract{^(w+)|$1}}, for example, extracts the first word of the Description field.
NB: extracting and altering text requires knowledge of regular expressions. Every capture group is represented by a dollar sign ($) and the number of the group. This allows you to place the extracted values in an adjusted order. To create and test regular expressions, check out RegExr. - Remove - removes all the occurrences of the specified parameters. It can be used to remove specific, disallowed words from descriptions for marketplaces. However, as this may result in incorrect or odd sentences, it is preferred to alter texts in the source system.
- Left - breaks the text at a set number of characters, submitted between brackets – starting from the left-hand side of the input. While the use of this option is not advised, it can be used to create short descriptions with a maximum number of characters you might not have as a separate attribute.
- Right - breaks the text at a set number of characters, submitted between brackets, starting from the right-hand side of the input. While the use of this option is not advised, it can be used to create short descriptions with a maximum number of characters you might not have as a separate attribute.
- Ellipsize - breaks the text at a set number of characters, submitted between brackets, and adds an ellipsis (...) at its end to make clear that the text has been cut off. While the use of this option is not advised, it can be used to create short descriptions with a maximum number of characters you might not have as a separate attribute.
- Wordwrap - breaks the text at a set number of characters, submitted between the brackets, and breaks the text at the last white space (thus word) – before reaching the maximum number of characters. It can be used to shorten long titles or short descriptions, for which most marketplaces have fixed character limits.
- Round - rounds any numeric value with the number of decimals you provide between brackets, with a maximum of 2 decimal points. E.g.: if you input 4, the output is still 2 decimals points. Note that if the value is ambiguous (e.g.: .5), it is rounded up. So {CE:DiscountRate|Round{0}} with a DiscountRate of 22.50 results in 23 as the output.
- RoundCeiling - rounds up any numeric value to the nearest integer that is equal or higher than the input. E.g.: if you have 2.11 as the input and apply RoundCeiling to it, the output is 3.
- RoundFloor - rounds down any numeric value to the nearest integer that is equal or lower than the input. E.g.: if you have 2.99 as the input and apply RoundFloor to it, the output is 2.
- Multiply - multiplies a numeric value with a numeric input (whole numbers only!), submitted between brackets. E.g.: if you have 1.125 as the input and apply Multiply{1000} to it, the output is 1,125. The maximum input value allowed is 1,000,000, and any out-of-bounds or non-numeric value results in the input returning unchanged.
- Divide - divides a numeric value with a numeric input (whole numbers only!), submitted between the brackets. E.g.: if you have 12,500 as the input and apply Divide{2000} to it, the output is 6.25. The maximum input value allowed is 1,000,000, and any out-of-bounds or non-numeric value results in the input returning unchanged.
Comments
0 comments
Article is closed for comments.