Data Feed Generator Tags

Here you will learn how to use tags to properly configure the template that will be later generated by the Magento 2 Data Feed Generator Extension. You will also find the full list of tags that can be in a template.

The Order of Using Tags

As you can see, a template consists of three separate sections: the header, the body and the footer. The header and footer are repeated only once, so only document tags can be used here. Otherwise, the system will automatically delete any other tags (like catalog tags or product tags) in the file that will be displayed to the user. The body of the template is repeatable and is generated every time for each catalog or product depending on the type of feed (products or categories). For instance, if there are one hundred categories in the feed, the system will generate one hundred blocks of texts that will appear between the header and the footer, and data for changing tags will be generated for each category separately. For example, if there is a tag {category.name}, there will be a separate category name in each of the one hundred blocks of texts.

To create a template, use tags written in the following format:

{entity.property[|modifierName:modifierParam]}

For instance: {product.name}, {product.description|truncate:500}

You can use document tags in the body irrespective of the type of the feed. You can also use tags of categories if the type of the feed is ‘category’, tags of products if the type of the feed is ‘product’. When using the type of the feed “Product’, the system will automatically use the category data this product belongs to for processing category tags.

Example (the type of the feed ‘Product’):

<item>
    <title>{product.name}</title>
    <description>{product.description}</description>
    <pubDate>{product.updated_at}</pubDate>
    <link>{product.url}</link>
</item>

The Extension will generate several blocks according to the number of products available. The result will be as follows:

<item>
    <title>BlackBerry 8100 Pearl</title>
    <description>Like the BlackBerry 7105t, the BlackBerry 8100 Pearl is The BlackBerry 8100 Pearl sports 
a large 240 x 260 screen that supports over 65,000 colors-- plenty of real estate to view your e-mails,
Web browser content, messaging sessions, and attachments.</description>
    <pubDate>2013-04-30 12:56:37</pubDate>
    <link>http://www.private-sales-v20.plumrocket.net/all/electronics/blackberry-8100-pearl.html</link>
</item>

The List of Tags

Document Tags

There is a list of all document tags in the table below.

TagDescription
{site.now}Current time in the format “Y-m-d H:i:s”
{site.name}The name of the store according to global setings
{site.phone}Store contact phone number
{site.address}Store address
{site.url}URL store address
{count}The number of positions in the feed. It can only be used in Footer Template

Formatting Tags:

TagDescription
{no_br}

{/no_br}
Removes the hyphens replacing them with space gaps in order to prevent words overlapping
{no_html}

{/no_html}
Removes all tags (Note! It does not produce tag codes but totally removes a tag)
{no_quotes}

{/no_quotes}
Removes quotation marks

These tags can be randomly and partially overlapped. Below are the examples of usage:

{no_br}{ho_html}{product.description}{/no_html}{/no_br}
{ho_html}{no_br}{product.description}{/no_html}{/no_br}

Category Tags (Catalog Tags)

There is a list of all category tags in the table below. The tag writing is carried out in the following way: {category.XXX}, where XXX is one of the tags like {category.meta_description} will show the meta description of the current category.

TagDescription
children_countThe number of subcategories in a category
created_atThe time and date of category creation
descriptionCategory description
entity_idCategory ID
imageFile name of image, example “shirt.jpg”
image_urlFull url of image, example “http://www.example.com/media/category/image/p/12/s/shirt.jpg” (Recommend)
meta_titleCategory meta title
meta_keywordsCategory meta keywords
meta_descriptionCategory meta description
nameCategory title
parent_idParent category ID
privatesale_date_startThe date and time of sales beginning (Private Sales Extension Required)
privatesale_date_endThe date and time of sales ending (Private Sales Extension Required)
thumbnailThumbnail file name, example “shirt.jpg”
thumbnail_urlFull url of thumbnail, example “http://www.example.com/media/category/cache/128×24/h/shirt.jpg”
updated_atThe date and time of the latest category update
urlAbsolute category path
open_urlAbsolute category path for guests (Url Manager Extension Required)
url_keyCategory name in URL
url_pathRelative Category path
brand_nameBrand name (Shop by Brand Extension Required)
brand_commentComment to the brand (Shop by Brand Extension Required)
brand_linkBrand link (Shop by Brand Extension Required)
brand_imageBrand image (Shop by Brand Extension Required)

Products Tags

There is a list of all product tags in the table below. The tag writing is carried out in the following way: {product.XXX}, where XXX is an arbitrary tag like {product.name} – the name of the product.

TagDescription
created_atThe Date and time of product creation
descriptionProduct Description
entity_idProduct ID
imageProduct image relative path to product page
image_urlProduct image absolute path to product page
meta_descriptionProduct meta description
meta_keywordProduct meta keyword
meta_titleProduct meta title
nameProduct title
news_from_dateThe date marking the “New Product” status
news_to_dateThe final date of the “New Product” status
priceThe Price of a product
price_with_currencyProduct price in currency
short_descriptionShort description of a product
skuStock-keeping unit of a product
small_imageProduct image relative path to cart page
small_image_urlProduct image absolute path to cart page
soldThe quantity of sold products
special_from_dateThe date marking the beginning of special price of the product
special_to_dateThe date marking the end of special price of the product
special_priceSpecial Price. If the field is empty regular price will be displayed
thumbnailProduct image relative path to the list of products
thumbnail_urlProduct image absolute path to the list of products
qtyThe quantity of products available in stock
updated_atThe date and time of the latest product update
urlAbsolute product path
open_urlAbsolute product path for guests (Url Manager Extension Required)
url_keyProduct name in URL
url_pathRelative product path
weightProduct weight

Extended Tags:

TagDescription
{product.child_items}

{/product.child_items}
Block with child items
{product.child}

{/product.child}
The block with child items is added to {product.child_items}, and does not work beyond it. Its content will be repeated for each child item of the parent one, when tags parsing is launched.

Child Tags

Child tags coincide with those used for Product Tags (see described above), except for .child_items and .child. The tags {child.xxx} are available and processed only if they belong to the block {product.child} … {/product.child}. Otherwise, these will be removed from the result.

Below are the examples of tags usage.

{product.child_items}
    <variants>
        {product.child}
            <variant>
                <sku>{child.sku}</sku>
                <color>{child.color}</color>
                <size>{child.size}</size>
                <detail_url>{product.url}</detail_url>
            </variant>
        {/product.child}
    </variants>
{/product.child_items}

As a result, if you use the code described above, the XML structure will look like this:

<variants>
    <variant>
        <sku>ZOO0241-LB</sku>
        <color>BLACK</color>
        <size>L</size>
        <detail_url>http://www.shopeer.com/product.html?id=10802</detail_url>
    </variant>
    <variant>
        <sku>ZOO0241-MN</sku>
        <color>NAVY</color>
        <size>M</size>
        <detail_url>http://www.shopeer.com/product.html?id=10935</detail_url>
    </variant>
    <variant>
        <sku>ZOO0241-SR</sku>
        <color>RED</color>
        <size>S</size>
        <detail_url>http://www.shopeer.com/product.html?id=12618</detail_url>
    </variant>
</variants>

The List of Modifiers

Modifiers change values before pasting into text. You can add one or more modifiers to each tag:

date_format

Formats the date value to the specified format. It can only be used for values that contain a date or timestamp.

Format: replace:{search}:{replace}
Example of deleting a character: {product.meta_keyword|replace:,:}
Example of character replacement: {category.breadcrumb_path|replace: > : /}

truncate

Truncates the string if it is longer than the specified length. Also adds an ellipsis at the end by default. Ellipsis are taken into account in a given length.

Format: truncate:{length}:[{string for end}]
Example: {product.description|truncate:500}

size

Allows you to resize the image. Works only for product.image_url, product.thumbnail_url, product.small_image_url.

Format: size:{width}:[{height}]
Example: {product.image_url|size:500:400}

replace

Replaces a character or string with the specified string (you can specify an empty string). Works for all data except an array.

Format: replace:{search}:{replace}
Example of deleting a character: {product.meta_keyword|replace:,:}
Example of symbol replacement: {category.breadcrumb_path|replace: > : /}

limit

Sets limits for values. Works only with arrays.

Format: limit:{length} 
Example: {product.categories|limit:30}

repeat

Sets the entity to be repeated several times. Works only for paired tags and nested arrays.

Format: repeat:{child_entity_name}  
Example: {product.media_gallery|repeat:gallery_image}

Example of the use:

{product.media_gallery|repeat:gallery_image|limit:10}
    {gallery_image.url}
{/product.media_gallery}

Was this article helpful?