Custom Data Feeds

The Custom Data Feeds feature of Aurora allows you to create custom product data feeds using your own templates to share product data with third parties.

Introduction

A data feed is a file that represents system data in a format designed to be consumed by a third party.

Custom Data Feeds allow product data feeds to be created from your own templates, giving you the freedom to create feed files as you need them in any format required.

Data feeds can be scheduled to be generated daily, weekly, or monthly, to keep the feed files up to date automatically. They may also be run manually outside of a schedule if required.

Custom Data Feeds can be found under Tools > Custom Data Feeds.

Add a feed

To add a feed, click the Add New Custom Feed button.

Enter the details for the feed and click Add Feed to save.

Feed list

Configured feeds will appear on the feed list page.

The following table describes the purpose of each column:

HeadingPurpose
FilesWhether any feed files have been generated for this feed.
A blue icon indicates that files are available.
ScheduleA description of the schedule for this feed, if configured.
Next Scheduled RunWhen the feed is next scheduled to run, if at all.
StatusThe status of the last / current run.

Click the File icon to show feed file information:

Generated feed files can be downloaded using the links under Generated files.

If the feed encountered an error this will be shown in the Status column.

Clicking the error icon will expand the row to show details of the error:


📘

If a feed encounters an error, any existing feed files will not be removed or modified in any way.

Feed files are only updated/overwritten when the feed completes successfully.

Search and filter feeds

Feeds can be searched from the search box, and filtered using the cog icon.

Edit a feed

To edit a feed, click the name of the feed, or the pencil icon.

Change the details as necessary and click the Edit Feed button to save your changes.

📘

Feeds cannot be edited if the feed is currently running.

Delete a feed

To delete a feed click the Bin icon on the feed list:

After confirming deletion the feed will be removed and the feed files will no longer be available.

The feed templates will not be removed.

Running a feed

Feeds can be run in two ways:

  • By schedule
  • Manually

📘

If a scheduled or manual run is in progress it will not be possible to start a manual run for the same feed.

Similarly a scheduled run will be skipped if a run is in progress when a scheduled run for the same feed is due to start.

Manual runs cannot be started if a scheduled run is due to start within 5 minutes.


Scheduled runs

To run a feed at a regular interval the feed must be configured with a schedule, and the Scheduled Run Enabled checked:

The schedule can also be enabled or disabled at any time using the clock icon on the feed list:

Schedules will be summarised on the feed list:

When the schedule is enabled the icon will be green, and the Next Scheduled Run column will show exactly when the feed will next run:


Manual runs

To run a feed outside of a schedule, click the play icon:

After confirming the run, the feed will start generating as soon as the system can start processing it.

Feed status

When a manual run is requested, or a scheduled run is due, the Status column will indicate the run is pending with a yellow clock icon, and the date and time the run was started waiting to be processed.

Running feeds

Running feeds are shown in the Status column with a blue clock icon and the date and time the run started processing.

Successfully completed feeds are shown in the Status column with a green tick icon and the date and time the run finished processing.

Failed feeds are shown in the Status column with a red icon icon and the date and time the run failed.

Simultaneous runs

A maximum of 3 feeds can be running simultaneously.

Further feeds will be queued, and will not start processing until less than 3 feeds are running.

Feeds will not start simultaneously even if they have the exact same schedule, they will be separated by a few minutes.

Recommendations

To balance load on the system, we recommend that:

  • Feeds are scheduled to run out side of peak times
  • Feeds are scheduled to run at the same time

Feed files

Publish / unpublish

Generated feed files are web accessible.

If the feed is "Published" the feed files will be publicly accessible.

Otherwise, the feed files will only be accessible to logged in Aurora Admin users.

A feed can be "Published" or "Unpublished" by clicking the Eye icon on the feed list.

📘

Aurora supports up to a maximum of 100 published feeds.

📘

If a feed is "Unpublished" it can still be run, whether manually or by schedule.

Feed templates

Feeds are generated using a set of Smarty templates from the client template directory.

Each feeds templates must be kept in user created subdirectories of a data-feeds directory, for example:

templates/example.com/data-feeds/my-feed/
templates/example.com/data-feeds/other-feed/

Feed templates will be validated whenever a feed is run and any errors will be presented on the feed list page.

The templates must match the following template file name patterns:

Template file name patternDescription
feed.tpl.*The base template for the feed
product.tpl.*The template that renders each product

Templates must be given an extension that matches the feed “File name extension” setting, for example:

Feed file name extension settingFeed template nameProduct template name
xmlfeed.tpl.xmlproduct.tpl.xml
jsonfeed.tpl.jsonproduct.tpl.json
csvfeed.tpl.csvproduct.tpl.csv
ymlfeed.tpl.ymlproduct.tpl.yml

Feed template

The feed template feed.tpl.* is used to render the main part of the feed file.

It will be provided with the following Smarty variables:

NameTypeDescription
$categoriesArrayHolds an array of all product categories and their data.
$products_contentStringHolds the combined rendered content generated by the product.tpl.* template.

The feed template MUST use this variable exactly once, in the format {$products_content} - the template will be validated before each run to confirm this.
$product_countIntegerThe total number of products that are processed

Example template:

<catalog xmlns:xsi="http://www.w3.org/2001/XMLSchemainstance">
    <categories size="{$categories|count}">
        {foreach $categories as $category}
        <category id="{$category.id}">
            <parent_id>{$category.category_parent}</parent_id>
            <is_active>{$category.display_category}</is_active>
            <name><![CDATA[{$category.category_name}]]></name>
        </category>
        {/foreach}
    </categories>
    <products size="{$product_count}">
        {$products_content}
    </products>
</catalog>

Product template

The product template product.tpl.* is used to generate the content relating to a single product.

It will be used iteratively, for each product in the feed.

Products will be processed by this template either in order from new to old, or in product list order if the feed is configured with a product list.

It will be provided with the following Smarty variables:

NameTypeDescription
$productArrayAn array containing all data for a single product.

This data will be equivalent to the product data available to product listing templates as described here: https://docs.auroracommerce.com/docs/product-details
$iterationIntegerThe current iteration of all products for the current file.

Example template:

### Feed files

Generated feed files are web accessible.

If the feed is set to "Published", the feed files will be publicly accessible.

Otherwise, the feed files will only be accessible to logged in Aurora Admin users.




# Feed scheduling

Feeds can be configured to run according to a schedule.

To configure the schedule simply open the feed configuration, select the desired schedule, and clikc Save <product id="{$product.id}">
    <sku>{$product.product_reference}</sku>
    <name>
        <![CDATA[{$product.product_name}]]>
    </name>
    <short_desc>
        <![CDATA[{$product.product_description}]]>
    </short_desc>
    <long_desc>
        <![CDATA[{$product.product_description}]]>
    </long_desc>
    <url>
        <![CDATA[{get_product_url id=$product.id}]]>
    </url>
    <img_url>
        <![CDATA[{product_image_uri product=$product host="example.org"}]]>
    </img_url>
    <price>{$product.product_price}</price>
    <promotion>{$product.product_price_was}</promotion>
    <salable>{$product.product_live}</salable>
    <in_stock>{if $product.product_stock} > 0}1{else}0{/if}</in_stock>
    <stock_qty>{$product.product_stock} </stock_qty>
    <categories>
        {foreach $product.categories as $category_id}
        <id>{$category_id}</id>
        {/foreach}
    </categories>
</product>

Feed file naming

Feed files are named according to the feed settings:

Feed NamePathFile NameFile ExtensionLanguagesExample generated feed file path
My Feedmy-feedfeed1xmlEnglish/data-feeds/my-feed/feed1-en-gb.xml
Other Feedother-feedfeed2xmlEnglish, Spanish/data-feeds/other-feed/feed2-en-gb.xml
/data-feeds/other-feed/feed2-es.xml

If the Number of products per file option is used, the feed files will be split up and a number suffix applied accordingly.

The files will include the number suffix if the total number of products processed is less than the Number of products per file value (i.e. when only a single file is generated).

The following table shows the same examples as the previous table, but with Number of products per file enabled.

Feed NamePathFile NameFile ExtensionLanguagesExample generated feed file path
My Feedmy-feedfeed1xmlEnglish/data-feeds/my-feed/feed1-en-gb_1.xml
/data-feeds/my-feed/feed1-en-gb_2.xml
/data-feeds/my-feed/feed1-en-gb_3.xml
Other Feedother-feedfeed2xmlEnglish, Spanish/data-feeds/other-feed/feed2-en-gb_1.xml
/data-feeds/other-feed/feed2-en-gb_2.xml
/data-feeds/other-feed/feed2-es_1.xml
/data-feeds/other-feed/feed2-es_2.xml