Product Feeds

Feeds of relevant articles are needed for external sales portals (e.g. Google, Facebook etc). Users can generate such feeds easily and quickly in Makaira with the help of feed engine.

Feeds are retrievable via a URL. A time consuming setup for such time-controlled creation of a feed is therefore not necessary. If feeds are used for automatic processing in other systems, Makaira offers a notification by email in case something goes wrong.
Contact the support if you want to use this option.

❗️

The content of a feed is always up to date because it is generated dynamically with each call to the API.


Create a feed

There are three steps required to create a feed:

  • Article selection
  • Basic settings
  • Data structure and output

Article selection

1. Which articles should be exported?
Example task: You want to create a feed that exports all active articles of a certain manufacturer, which are available in the colors red, green or blue.

a) Filter of father articles
Creation of primary stream, which defines a filter over all available parent articles. For example: All active items from the manufacturer "Adidas".

1920

b) Filter for variants
Creation of secondary streams, which filters the variants per parent article (only relevant if variants are to be exported as well). For example: all active items that are available (i.e. stock>0) and are of color(attribute) "red" or "green" or "blue".

1920

📘

The search logic filters all parent articles by means of the primary product stream. If variants are also exported, all variants per parent article are filtered by means of the secondary product stream. If no secondary product stream is specified, each parent article contains all its variants.


Basic settings

1920

2. URL, format and common

  • Name: the configurable part of the URL under which the feed will be called later. (allowed characters are letters and digits, everything else will be converted to an underscore)
  • Stream: filters for parent articles (mandatory); the stream configured in step *1a.
  • Export father items: Parent articles are exported in my feed.
  • Export variants: Variants of father items are exported in my feed.
  • Export father items only if no variants exist.

Stream: Filter for variants (optional)

1903

Variants configured in step 1b are exported if necessary, otherwise all variants per parent item are delivered by default.

Content-Type
the data format in which the feed should be created
(technically: the value for the HTTP header “Content-Type”)

Separator for fields
(CSV only) defines the separator of the data columns in the feed
Field wrapper
(CSV only) defines the character with which data values should be flanked
Show column names in first row?
(CSV only) the first row in the feed should contain the column names
Header
(not for CSV)
Twig-Template
rendered in front of all articles
Footer
(not for CSV) Twig-Template rendered after the last article.
Example: XML Header & Footer

1920

String for end of line
Defines a string which is written at the end of each article/variant (no template)

Optional variables (expert mode)
Twig-Template, which is included before each template of the data fields (for global functions/variables, e.g. store URL).

Example: global variables or functions

1920

Data structure & output

3. Which article data should be exported?
Example task: You want to export the following items data in your feed:

  • the item number
  • the name
  • the price (formatted to 2 decimal places)
  • the detailed description (maximum 200 characters)

You create the data structure for your feed under Adjust structure from the feed overview.

1920

In the first column you should enter the title. The second column should contain the data field from which the value for the respective entry in the feed should be taken.

Example: Structure for the task described above;

1920

Formating the price always to 2 decimal places: To do this, we click Edit Output in the corresponding line to edit the default template.

1903

The expression used for this will output our item in the desired format. For a detailed explanation of the possibilities of the template engine used see Twig-Templates.

Trimming the description text to 200 characters:

1920

Using the optional variables (see basic settings)

{{ item|length > maxLongDesc ? item|slice(0, (maxLongDesc - 3)) ~ '...' : item }}

In the end, our feed structure should look something like this:

1920

Twig-Template

What is a Twig template?
Twig is a template engine for Symfony. A complete overview of all tags, filters, functions, tests and operators included in the Twig base package can be found in the Twig Documentation, All with detailed examples.

Predefined template variables
1. Header & Footer
language
the language used in the feed (selection via URL)

header
Labeling of all data columns

fields
Field identifier of the data columns

2. Feed content variables
iCountLine
contains the current line number

language
the language used in the feed (selection via URL)

header
Labeling of all data columns

fields
Field identifier of the data columns

item
current data value

feedItem
current data set (complete document)

iCountVariantMax
Total number of all variants of a parent article

3. Variables for feed content for variants (also called makaira-product)
iCountParent
Counter of parent articles containing variants (useful when rendering variants only).

parent
current father article (only when rendering a variant)

4. Feed content variables for products (also called makaira-productgroup)
iCountVariant
Counter of the current variant

makaira-product
Array of all variants of the product or all variants that match the configured variant stream. Attention: Only available if both products and variants are output in the feed.

📘

To test the feed, it is recommended to create a primary stream that filters only a few articles. This way, the feed requires few resources or time during the testing phase.