Feed-Engine

For external sales portals (e.g. Google, Facebok etc.) feeds of relevant articles are needed. With the help of the feed engine you can generate such feeds easily and quickly in Makaira. Feeds are retrievable via a URL and are created anew with each retrieval. A time-consuming setup for the time-controlled creation of a feed is therefore not necessary. If feeds are used for automatic processing in other systems, we offer a notification by mail 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 retrieval.

 

Article selection

1. Which articles should be exported ?

Task (example)
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 for father articles

Creation of a primary stream, which defines a filter over all available parent articles

Example: all active items and manufacturer equal to "Adidas".

image-1602062604441.png

b) Filter for variants
Creation of a secondary Streams, which filters the variants per parent article (only relevant if variants are to be exported as well)

Example: all active items that are available (stock > 0) and attribute "color" equals "red" or "green" or "blue".

image-1602062608637.png

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

2. URL, format and co.

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 - filter for parent articles (mandatory)
the stream configured in step 1.a

image-1602063650277.png

Export parent article?
Parent articles should be exported in my feed
Parent articles should be exported in my feed?
Variants should be exported in my feed
Export parent article only if no variants exist
  • there are variants exported in my feed and parent articles which have no variants
  • "none" means, the parent article can have variants, but the filter for variants will result in an empty set
  • this option requires that Export parent article? is enabled

Example: variants only

image-1602063666228.png

Stream - Filter for variants (optional)
if necessary, the stream configured in step 1.b, otherwise all variants per parent item are delivered by default

image-1602063691589.png

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
(no CSV)
Twig-Template
rendered in front of all articles
Footer
(no CSV) Twig-Template rendered after the last article.

Example: XML Header & Footer

image-1602063707429.png

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

image-1602063717257.png

optonal variables(expert mode)

...

Data structure & output

3. Which article data should be exported ?

Task (example)

You want to export the following item data in your feed:

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

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

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 constructed above

image-1602064137376.png

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

image-1602064144986.png

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.

To trim the description text to 200 characters, we also edit this template.

image-1602064148803.png

Using the optional variables (see basic settings) we can make this formatting flexible here.

image-1602064152494.png

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

image-1602064165699.png

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

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

 

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

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)
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.