24/7 Support: 800.608.6482

How To Guides

How To Guides

Feed Management

1. Overview

2. Template Based Feed Settings

3. “templatefeed” Item

4. Feed Data Reference Map

5. 5.24 Engine Functions

6. Code Samples

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)

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

Template Feed

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

https://www.domain.com/my-feed

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

Template Feed

Example To Run Feed

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

File Location

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:

File Creation

The feed would get written to this location:

https://www.domain.com/feeds/google-shopping.csv

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 Creation

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

Email Type

Template

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

Email 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:
  2. Template Feed

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

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:

Google Feed

THE TEMPLATEFEED ITEM

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.

Template Feed

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

Mode

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

Load

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

Encoding

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.

Encoding

Delimiter

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

Delimeter

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 variants, 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. When including inventory variants in the feed, the master product data will be included as &mvt:record: and the variant data will be &mvt:record:variant:. If you need a feed that only includes variants data you can limit the master product data from displaying like this:

<mvt:if expr="NOT ISNULL l.settings:record:variant">
  
  //output variant data records here
  
</mvt:if>

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:

Header Template Example

Iterator 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

Miva Feeds

Line Breaks

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

&mvt:eol:cr; - Carriage Return

&mvt:eol:lf; - Line Feed

Products

&mvt:record:active;

&mvt:record:agrpcount;

&mvt:record:cancat_id;

&mvt:record:canonical_category;

&mvt:record:alternate_display_page;

&mvt:record:page_title;

&mvt:record:canonical_uri;

&mvt:record:catcount;

&mvt:record:code;

&mvt:record:cost;

&mvt:record:cost_formatted;

&mvt:record:descrip;

&mvt:record:disp_order;

&mvt:record:id;

&mvt:record:inventory;

&mvt:record:name;

&mvt:record:original_price;

&mvt:record:orginial_price_formatted;

&mvt:record:page_id;

&mvt:record:pgrpcount;

&mvt:record:price;

&mvt:record:price_formatted;

&mvt:record:shipping_height;

&mvt:record:shipping_length;

&mvt:record:shipping_width;

&mvt:record:sku;

&mvt:record:thumbnail;

&mvt:record:image;

&mvt:record:taxable;

&mvt:record:weight;

Custom Fields

&mvt:record:customfield;

&mvt:record:customfield:footer;

&mvt:record:customfield:header;

&mvt:record:customfield:description;

&mvt:record:customfield:keywords;

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

&mvt:record:attributes:color;

&mvt:record:attributes:size;

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:

&mvt:record:variant:active;

&mvt:record:variant:agrpcount;

&mvt:record:variant:cancat_id;

&mvt:record:variant:catcount;

&mvt:record:variant:code;

&mvt:record:variant:cost;

&mvt:record:variant:cost_formatted;

&mvt:record:variant:descrip;

&mvt:record:variant:disp_order;

&mvt:record:variant:id;

&mvt:record:variant:name;

&mvt:record:variant:page_id;

&mvt:record:variant:pgrpcount;

&mvt:record:variant:price;

&mvt:record:variant:price_formatted;

&mvt:record:variant:taxable;

&mvt:record:variant:weight;

&mvt:record:variant:image;

&mvt:record:variant:thumbnail;

&mvt:record:variant:sku;

&mvt:record:variant:inventory;

&mvt:record:variant:shipping_width;

&mvt:record:variant:shipping_length;

&mvt:record:variant:shipping_height;

Variant Custom Fields

&mvt:record:variant:customfield;

&mvt:record:variant:customfield:description;

&mvt:record:variant:customfield:keywords;

&mvt:record:variant:customfield:footer;

&mvt:record:variant:customfield:header;

Variant Images

&mvt:record:variant:customfield:main;

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

&mvt:record:customfield:main;

Where main is the image type

Categories

&mvt:record:code;

&mvt:record:name;

&mvt:record:page_title;

&mvt:record:active;

&mvt:record:parent_category;

&mvt:record:alternate_display_page;

&mvt:record:canonical_uri;

&mvt:record:customfield:footer;

&mvt:record:customfield:header;

&mvt:record:customfield:category_title_image;

&mvt:record:customfield:category_tree_image;

&mvt:record:customfield:description;

&mvt:record:customfield:keywords;

Customers

&mvt:record:login;

&mvt:record:pw_email;

&mvt:record:business_account;

&mvt:record:ship_fname;

&mvt:record:ship_lname;

&mvt:record:ship_email;

&mvt:record:ship_phone;

&mvt:record:ship_fax;

&mvt:record:ship_comp;

&mvt:record:ship_addr1;

&mvt:record:ship_addr2;

&mvt:record:ship_city;

&mvt:record:ship_state;

&mvt:record:ship_zip;

&mvt:record:ship_cntry;

&mvt:record:bill_fname;

&mvt:record:bill_lname;

&mvt:record:bill_email;

&mvt:record:bill_phone;

&mvt:record:bill_fax;

&mvt:record:bill_comp;

&mvt:record:bill_addr1;

&mvt:record:bill_addr2;

&mvt:record:bill_city;

&mvt:record:bill_state;

&mvt:record:bill_zip;

&mvt:record:bill_cntry;

Custom Customer Fields

&mvt:record:customfield:;

New 5.24 Engine Built In Functions

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

Create Expiration Data Variable 30 Days in the Future

This code allows you to create a variable that will output the expiration date 30 days from today. This code can go in the feed header and then the variable &mvt:global:future_date; can be used anywhere you need to output the date.

Looking for Developer Docs?

We have a whole section for that, including: Developer Training Series, Template Language docs, Module Development tutorials and much, much more.

Head to the Developer Section

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.

Accept

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