24/7 Support: 800.608.6482

Developer Docs

How To Guides

Template Feed Documentation

1. Overview

2. Template Based Feed Settings

3. “templatefeed” Item

4. Feed Data Reference Map

5. 5.24 Engine Functions

6. Advanced Mode

7. Code Samples

1. Overview

Template Based Feeds allow you create customized feeds for products, categories or customers. These template based feeds were designed with maximum flexibility and give you complete control over the output.

Template based feeds can be triggered to run by 3 different methods:

  1. Manually run via the admin
  2. Setup a Scheduled Task to Run at set intervals
  3. Hit a URL to run the feed

The Output of the feed also supports multiple formats including:

  1. Write the feed to a file on the server
  2. Email the feed either as an attachment or include in the body of the email
  3. Directly output to the screen (Via a URL)

Output Feed

Template Based Feed Settings

Enable URI Access

With this checked it will allow you to setup a URI to trigger the feed. Each time the URI is hit, the feed will be run. To setup the URI for a feed go to:

  1. URI Management -> URIs Tab
  2. Click the Plus Sign to add a new URI
  3. Configure the Feed URI and make sure the Destination is set to Feed.


The Feed would then be accessible to be run via the following URL:


URI Access Key

This is an optional field which allows you to password protect the URI to limit access to run the feed.

The parameter to use this field is Feed_AccessKey=value

URI Access Key

Example To Run Feed

[https://www.domain.com/my-feed?Feed_AccessKey= eep76YAA](https://www.domain.com/my-feed?Feed_AccessKey= eep76YAA)

Enable File Creation

With this checked, file feed will be written to a file on the server vs being output to the screen.

File Location

Enable Run Feed

There are two locations Miva will write the Feed to:

Data (Private) is the MivaData folder. This is typically located in the following folder: private/mivadata on the server. This is a non-web accessible folder on your server. The only way to get to the feed would be via FTP or download the feed from the admin. This is the recommended location when creating feeds of customer data. Script (Public) refers to your web root. This is the root of your website and is publically accessible to anyone on the web. This is typically In the httpdocs folder.

Filename – The filename must start with a /and it will be relative to the root of the location you choose (mivadata or script). If you choose Data and put in a file name of /myfeed.csv, the file will be written to the root of the mivadata folder. However, you can also specify sub folders (which you must create yourself via FTP manually before the feed can be created). For example if you have the following path:

Enable File Creation

The feed would get written to this location:


The file would be located here:


Enable Email Creation

This setting allows you to email a file as an attachment or included In the body of the email. This setting is independent of the “Enable File Creation” so if both are check, both actions will occur.

Email Type

If attachment is selected as the Email Type, new fields will be displayed.

Email Type


There are 3 different templates to choose from. The template determines which set of data to make available in the template.

Template Type

Template Based Feeds are tied to a page template. When a new template based feed is created the following steps happen automatically:

  1. A new page with the code “TEMPLATEFEED_” + feed code gets created. For example:

  3. The item template feeds gets assigned to the page and the item tag is inserted in the page:
  4. Google Feed

    To customize your template based feed you can go to User Interface -> Pages and find your template, or you can edit the feed and it will provide a link directly to the page to edit:

    Customize Template Feed


    The templatefeed item is what controls the output of the feed.

    It has two editing modes:

    Point & Click Mode (default) – This provides you an interface to select what data fields you want included in your feed. In point and click mode the header row and order of fields are fixed.

    Point & Click

    Advanced Mode –This gives you access to the code that is being used to generate the feed including the header template, iterator template, and footer template

    Template Based Feed Settings


    Options include Product, Category or Customer. This determines what data you’ll have access to in your feed. To change this value, select a new value from the drop down and hit update. This will reload the page with new fields available to add to the feed.

    Template Based Feed


    This setting determines what subset of data gets loaded within the data selected in Mode above. This allows you to only load data you need In your feed, making the processing time much faster than if you always loaded all products, categories or customers. Options for products include:

    All – Load All Products

    Active –Load all active products

    Available – Load all products not in an availability group

    In Category – Load all products in a specific category. This field can also be a comma separated list of category codes for multiple categories

    In Price Group – Load all products in a specific price group. This field can also be a comma separated list of price group codes for multiple groups

    In Availability Group - Load all products in a specific availability group. This field can also be a comma separated list of availability group codes for multiple groups

    Not In Category – Load all products not in this category (comma separated list accepted)

    Not In Price Group – Load all products not in this price group (comma separated list accepted)

    Not In Availability Group – Load all products not in this availability group (comma separated list accepted)

    Load Products


    By default any data loaded will be properly escaped to support a CSV format. This can be changed to none, if another format is being used.



    This allows you to set the delimited that will be used to separate each field


    Predict Product Discounts

    This allows you to load any price group prices for products. If you are using any type of price group to give discounts to products, this box should be checked.

    Load Variants

    By default only master products will be included in a feed. Checking this box will allow the variant products to be include as well. If this box is checked and product is setup with inventory varints, only the variants will be included in the feed and not the master. However access to the master products data will be available if needed.

    Advanced Mode

    Advanced Module gives you access to the page template generating the feed to customize it for your specific needs. This included modifying the header row and customizing the order and type of data that gets exported.

    In Advanced Mode there are access to 3 different templates:

    Header Template – This controls the header row for the data being output

    Iterator Template – This is for template controlling the output for each row of data.

    Footer Template – This gets added on to the end of the feed after all the data has been output.

    Header Template Example:

    Template Example

    Iterator Template Example:


    No matter what type of data being exported, (product, category, customer) the variable used will always be use the “record” structure.

    Example: &mvt:record:code; or &mvt:record:name;

    Feed Data Reference Map:

    Line Breaks

    &mvt:eol:crlf; - Carriage Return & Line Feed

    &mvt:eol:cr; - Carriage Return

    &mvt:eol:lf; - Line Feed
































    Custom Fields






    Attributes When Not Loading Variant Products

    Attributes will be an array, where color and size is the attribute code.

    &mvt:record:attributes:color[1]; (value = red)

    &mvt:record:attributes:color[2]; (value = blue)

    &mvt:record:attributes:size[1]; (value = small)

    &mvt:record:attributes:size[2]; (value = medium)

    Attributes When Loading Variant Products

    Each variant will reference a specific attribute combination so the variables will not be an array



    In this example color and size are the attribute codes. If that variant only one attribute there would only be one available.

    Variant Product Data

    If you are including inventory variants, each variant record will be returned. It will contain a mix of the master product data long with the variant data. The variant data can be reference through the following structure:

























    Variant Custom Fields






    Variant Images


    Product Images

    Only Images which have image types can be included in feeds. In order to export images, under utilities the “Product Images Custom Fields” module must be installed


    Where main is the image type












































    Custom Customer Fields


    New 5.24 Engine Built In Functions

    miva_strip_html( string, allowed_tags )

    string: The string to remove HTML tags from

    allowed_tags: A comma separated list of tags that will NOT be stripped from the string

    Example Usage:

    miva_cdata_encode( data )

    miva_csv_encode( string, delimiter )

    Record Encoding

    By default &mvt:record variables will be encoded in a CSV format. This can be changed to none using the encoding drop down.

    Code Samples

    Assigned Categories

    Output Color Attribute as List

    Output Size Attribute As List

    Output Specific Sized Product Image

    This code will look for the existence of an image at the dimensions you specify on the server. If it does not exist, it will be generated

    Feed Completion Call Back

    This code makes an http request to the URL specified when the feed has completed running.

This website uses cookies to identify visitors, track visitors to our website, store login session information and to remember your user preferences. By continuing to use this site you agree to our use of cookies. Learn More.

This website uses cookies. By continuing to use this site you agree to our use of cookies. Learn More.


Copyright © 1997 – 2024 Miva®, Miva Merchant®, MivaPay®, MivaCon®, Camp Miva®, Miva Connect®, Miva, Inc. All Rights Reserved.