html Miva - Google和Listrak数据Feed
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了html Miva - Google和Listrak数据Feed相关的知识,希望对你有一定的参考价值。
<mvt:comment>
<!--
Feed:
Google Shopping & Listrak
About
This page is designed to generate their Google & Listrak datafeeds through paginated redirects or refreshes.
File Outputs:
/feeds/output/google.txt
/feeds/output/listrak.txt
URL
http://www.example.com/mm5/merchant.mvc?Screen=feed-google-merchant
Parameters
auth
About: This parameter is used to help password protect the regeneration of their feed.
Requirement: Required
Data Type: String
Default: NULL
Possible Values: o8syU567D88o94yh
dev
About:
Passing any value will by-pass the live version of the feed
It will excecute the <mvt:item name="content"/> instead of the rest of the live feed.
It also outputs the files into a dev directory
Requirement: Optional
Data Type: Boolean
Default: NULL
Possible Values: 1, TRUE, Yes, etc.
continue
About:
This controlls the method for getting to the next page in the pagination.
You would only want to ommit this value for debugging a specific page.
Requirement: Required (for producting a complete feed), but Optional (if troubleshooting a specific page)
Data Type: String
Default: NULL
Possible Values:
redirect
301 Redirect to next page (Helpful for regenerating entire feed through CLI or Cron Job)
refresh
a Meta Refresh will be used to get to the next page. (Helpful for regerating the feed through a Browser)
output
About:
This controls where the data feed information goes
Requirement: Optional
Data Type: String
Default:
Possible Values:
screen
This will print the information that is written to the feed file to the Browser instead
debug
This will dump all the data that has been loaded for a product
Product_Code
About:
This will skip every product in the feed until if finds the specified Product_Code.
Once it finds the product code, it will output that information and write it to it's own file
Requirement: Optional (Only used for troubleshooting)
Data Type: String
Default: NULL
Possible Values:
Any master product code in the store
AllOffset
About:
This directs the starting point for Miva's Product List pagination.
If specified it will skip that amount of products.
Requirement: Optional
Data Type: Integer
Default: 0
Possible Values:
Any Positive Integer
Per_Page
About:
This directs the number of items to show on one page of Miva's Product List pagination.
Requirement: Optional
Data Type: Integer
Default: 50
Possible Values:
Any Positive Integer, typically a number from 1-500
Exit
About:
This will override the g.continue parameter and stop the feed from continuing.
It is typically set within the feed generation process when a g.Product_Code is passed & found
Requirement: Optional
Data Type: Boolean
Default: NULL
Possible Values: 1, TRUE, Yes, etc.
Example Uses
Regenerate Live Feed Through Command Line or Cron Job
date; curl -o NUL --location --max-redirs 100000 --data "auth=o8syU567D88o94yh&continue=redirect" http://www.example.com/mm5/merchant.mvc?Screen=feed-google-merchant; date; echo -e "\a";
Regenerate Dev Feed Through Command Line
date; curl -o NUL --location --max-redirs 100000 --data "auth=o8syU567D88o94yh&continue=redirect&dev=1" http://www.example.com/mm5/merchant.mvc?Screen=feed-google-merchant; date; echo -e "\a";
Regenerate Live Feed Through Browser
http://www.example.com/mm5/merchant.mvc?Screen=feed-google-merchant?auth=o8syU567D88o94yh&continue=refresh
Regenerate Dev Feed Through Browser
http://www.example.com/mm5/merchant.mvc?Screen=feed-google-merchant?auth=o8syU567D88o94yh&continue=refresh&dev=1
Troubeshoout specific product through Browser
http://www.example.com/mm5/merchant.mvc?Screen=feed-google-merchant?auth=o8syU567D88o94yh&continue=refresh&output=debug&Product_Code=PRODUCT_CODE
-->
</mvt:comment>
<mvt:comment><!-- Password Protect this Page --></mvt:comment>
<mvt:if expr="g.auth NE 'o8syU567D88o94yh'">
Access Denied
<mvt:exit/>
</mvt:if>
<mvt:comment><!-- Helper Variables --></mvt:comment>
<mvt:assign name="g.tab" value="asciichar(9)"/>
<mvt:assign name="g.newline" value="asciichar(10)"/>
<mvt:assign name="g.return" value="asciichar(13)"/>
<mvt:assign name="g.pipe" value="asciichar(124)"/>
<mvt:assign name="g.comma" value="asciichar(44)"/>
<mvt:assign name="g.quote" value="asciichar(34)"/>
<mvt:assign name="g.period" value="asciichar(46)"/>
<mvt:assign name="g.delimiter" value="asciichar(9)"/>
<mvt:item name="ry_toolbelt" param="datetime_format|g.expiration_date|s.dyn_time_t + (86400 * 29)|'mm/dd/yyyy'" />
<mvt:comment><!-- Choose version to run --></mvt:comment>
<mvt:if expr="g.dev">
<mvt:item name="hdft" param="footer" />
<mvt:else>
<mvt:item name="hdft" param="header" />
</mvt:if>
<mvt:comment><!-- LIVE FEED --></mvt:comment>
<mvt:assign name="g.file_folder" value="'/feeds/output/'"/>
<mvt:comment><!-- File Config Variables - Google --></mvt:comment>
<mvt:if expr="ISNULL g.google_temp_file_name">
<mvt:assign name="g.google_temp_file_name" value="'google.temp'"/>
</mvt:if>
<mvt:if expr="g.Product_Code">
<mvt:assign name="g.google_temp_file_name" value="'google_' $ g.Product_Code $ '.temp'"/>
</mvt:if>
<mvt:assign name="g.google_temp_file_path" value="g.file_folder $ g.google_temp_file_name"/>
<mvt:assign name="g.google_final_file_path" value="glosub( g.google_temp_file_path, '.temp', '.txt' )"/>
<mvt:comment><!-- Unique ID File Helper --></mvt:comment>
<mvt:if expr="ISNULL g.google_ids_temp_file_name">
<mvt:assign name="g.google_ids_temp_file_name" value="'google_ids.temp'"/>
</mvt:if>
<mvt:if expr="g.Product_Code">
<mvt:assign name="g.google_ids_temp_file_name" value="'google_ids_' $ g.Product_Code $ '.temp'"/>
</mvt:if>
<mvt:assign name="g.google_ids_temp_file_path" value="g.file_folder $ g.google_ids_temp_file_name"/>
<mvt:comment><!-- File Config Variables - Listrak --></mvt:comment>
<mvt:if expr="ISNULL g.listrak_temp_file_name">
<mvt:assign name="g.listrak_temp_file_name" value="'listrak.temp'"/>
</mvt:if>
<mvt:assign name="g.listrak_temp_file_path" value="g.file_folder $ g.listrak_temp_file_name"/>
<mvt:assign name="g.listrak_final_file_path" value="glosub( g.listrak_temp_file_path, '.temp', '.txt' )"/>
<mvt:assign name="g.header_row" value="
'id' $ g.delimiter $
'item_group_id' $ g.delimiter $
'code' $ g.delimiter $
'title' $ g.delimiter $
'description' $ g.delimiter $
'google_product_category' $ g.delimiter $
'product_type' $ g.delimiter $
'general_product_type' $ g.delimiter $
'departments' $ g.delimiter $
'link' $ g.delimiter $
'image_link' $ g.delimiter $
'condition' $ g.delimiter $
'availability' $ g.delimiter $
'count_onhand' $ g.delimiter $
'flag' $ g.delimiter $
'price' $ g.delimiter $
'brand' $ g.delimiter $
'gender' $ g.delimiter $
'age_group' $ g.delimiter $
'color' $ g.delimiter $
'size' $ g.delimiter $
'master_flag' $ g.delimiter $
'expiration_date' $
g.newline
"/>
<mvt:comment><!-- Delete File if it exists, create new file with header row --></mvt:comment>
<mvt:if expr="ISNULL g.Per_Page">
<mvt:assign name="g.Per_Page" value="50" />
</mvt:if>
<mvt:if expr="ISNULL g.AllOffset">
<mvt:assign name="g.AllOffset" value="0" />
</mvt:if>
<mvt:if expr="g.output EQ 'screen'">
&mvt:global:header_row;
<mvt:else>
<mvt:comment><!-- Create/Delete File - Google --></mvt:comment>
<mvt:if expr="g.AllOffset LT g.Per_Page">
<mvt:if expr="sexists(g.google_temp_file_path)">
<mvt:if expr="sdelete(g.google_temp_file_path)">
<mvt:assign name="l.result" value="file_create(g.google_temp_file_path, 'script', g.header_row)"/>
</mvt:if>
<mvt:else>
<mvt:assign name="l.result" value="file_create(g.google_temp_file_path, 'script', g.header_row)"/>
</mvt:if>
</mvt:if>
<mvt:comment><!-- Create/Delete File - Google IDs --></mvt:comment>
<mvt:if expr="g.AllOffset LT g.Per_Page">
<mvt:if expr="sexists(g.google_ids_temp_file_path)">
<mvt:if expr="sdelete(g.google_ids_temp_file_path)">
<mvt:assign name="l.result" value="file_create(g.google_ids_temp_file_path, 'script', g.comma)"/>
</mvt:if>
<mvt:else>
<mvt:assign name="l.result" value="file_create(g.google_ids_temp_file_path, 'script', g.comma)"/>
</mvt:if>
</mvt:if>
<mvt:comment><!-- Create/Delete File - Listrak --></mvt:comment>
<mvt:if expr="g.AllOffset LT g.Per_Page">
<mvt:if expr="sexists(g.listrak_temp_file_path)">
<mvt:if expr="sdelete(g.listrak_temp_file_path)">
<mvt:assign name="l.result" value="file_create(g.listrak_temp_file_path, 'script', g.header_row)"/>
</mvt:if>
<mvt:else>
<mvt:assign name="l.result" value="file_create(g.listrak_temp_file_path, 'script', g.header_row)"/>
</mvt:if>
</mvt:if>
</mvt:if>
<mvt:assign name="g.duplicate_ids:result" value="file_read( g.google_ids_temp_file_path, 'script', g.duplicate_ids:string )" />
<mvt:assign name="g.duplicate_ids:array" value="miva_array_deserialize( g.duplicate_ids:string )" />
<mvt:comment><!-- Loop over all of the products --></mvt:comment>
<mvt:foreach iterator="product" array="all_products:products">
<mvt:if expr="g.Product_Code">
<mvt:if expr="g.Product_Code EQ l.settings:product:code">
<mvt:assign name="g.Exit" value="1" />
<mvt:else>
<mvt:foreachcontinue/>
</mvt:if>
</mvt:if>
<mvt:comment><!-- Don't add product to feed if it is excluded from searchspring by custom field or if it is Rejected from the Google Feed --></mvt:comment>
<mvt:if expr="l.settings:product:customfields:customfield_values:exclude OR l.settings:product:customfields:customfield_values:google_feed_status EQ 'Rejected'">
<mvt:foreachcontinue/>
</mvt:if>
<mvt:comment><!-- Get product_type and check if it is a "discontinued" product --></mvt:comment>
<mvt:item name="ry_toolbelt" param="Product_Categories|g.incatcount|l.all_settings:product:code" />
<mvt:if expr="g.incatcount GT 0">
<mvt:foreach iterator="cat" array="product_categories">
<mvt:if expr="'|' $ l.settings:cat:code $ '|' CIN '|discontinued|ghost|Sizing|street-sizing|'">
<mvt:assign name="l.settings:product:discontinued" value="1" />
<mvt:foreachstop/>
</mvt:if>
<mvt:if expr="NOT miva_array_find(l.settings:cat:name, l.settings:product:category_names, 1)">
<mvt:assign name="l.index" value="miva_array_insert( l.settings:product:category_names, l.settings:cat:name, -1 )" />
</mvt:if>
<mvt:item name="toolkit" param="breadcrumb|b_count|l.all_settings:cat:code" />
<mvt:if expr="g.b_count EQ 0 OR l.settings:breadcrumbs[1]:code EQ 'vt'">
<mvt:foreachcontinue/>
</mvt:if>
<mvt:foreach iterator="breadcrumb" array="breadcrumbs">
<mvt:if expr="'|' $ l.settings:breadcrumb:code $ '|' CIN '|discontinued|ghost|Sizing|street-sizing|'">
<mvt:assign name="l.settings:product:discontinued" value="1" />
<mvt:foreachstop/>
</mvt:if>
<mvt:if expr="l.settings:cat:product_type">
<mvt:assign name="l.settings:cat:product_type" value="l.settings:cat:product_type $ ' > ' $ l.settings:breadcrumb:name" />
<mvt:else>
<mvt:assign name="l.settings:cat:product_type" value="l.settings:breadcrumb:name" />
</mvt:if>
<mvt:if expr="NOT (l.settings:breadcrumbs[1]:code CIN 'ATV,CasualWear,dirt-bike-gear,street-gear,MTB-BMX-GEAR,SNOW-COLD-WEATHER')">
<mvt:foreachcontinue/>
</mvt:if>
<mvt:if expr="'Brand' CIN l.settings:breadcrumbs[2]:name OR
'Specials' CIN l.settings:breadcrumb:name OR
'Clearance' CIN l.settings:breadcrumb:name OR
'Closeout' CIN l.settings:breadcrumb:name">
<mvt:foreachcontinue/>
</mvt:if>
<mvt:if expr="POS3 EQ 1">
<mvt:assign name="l.settings:cat:general_product_type" value="l.settings:breadcrumb:name" />
<mvt:elseif expr="POS3 EQ 2">
<mvt:assign name="l.settings:cat:general_product_type" value="l.settings:cat:general_product_type $ ' > ' $ l.settings:breadcrumb:name" />
<mvt:elseif expr="POS3 EQ 3">
<mvt:assign name="l.settings:cat:general_product_type" value="l.settings:cat:general_product_type $ ' ' $ l.settings:breadcrumb:name" />
</mvt:if>
<mvt:if expr="POS3 EQ 1">
<mvt:assign name="l.settings:cat:department" value="l.settings:breadcrumb:name" />
</mvt:if>
</mvt:foreach><mvt:comment><!-- breadcrumb --></mvt:comment>
<mvt:assign name="l.settings:cat:breadcrumbs" value="l.settings:breadcrumbs" />
<mvt:if expr="l.settings:product:discontinued">
<mvt:item name="customfields" param="Write_Product_ID(l.settings:product:id, 'status', 'Discontinued')" />
<mvt:foreachstop/>
<mvt:else>
<mvt:item name="customfields" param="Write_Product_ID(l.settings:product:id, 'status', '')" />
</mvt:if>
<mvt:if expr="l.settings:product:product_type">
<mvt:assign name="l.settings:product:product_type" value="l.settings:product:product_type $ ','" />
</mvt:if>
<mvt:assign name="l.settings:product:product_type" value="l.settings:product:product_type $ l.settings:cat:product_type" />
<mvt:if expr="l.settings:cat:general_product_type AND miva_array_find( l.settings:cat:general_product_type, l.settings:product:general_product_type:list, 1 ) EQ 0">
<mvt:assign name="l.index" value="miva_array_insert(l.settings:product:general_product_type:list, l.settings:cat:general_product_type, -1)" />
<mvt:if expr="('Dirt' CIN l.settings:cat:general_product_type) EQ 1">
<mvt:if expr="len(l.settings:product:general_product_type:dirt) LT len(l.settings:cat:general_product_type)">
<mvt:assign name="l.settings:product:general_product_type:dirt" value="l.settings:cat:general_product_type" />
</mvt:if>
<mvt:elseif expr="('Street' CIN l.settings:cat:general_product_type) EQ 1">
<mvt:if expr="len(l.settings:product:general_product_type:street) LT len(l.settings:cat:general_product_type)">
<mvt:assign name="l.settings:product:general_product_type:street" value="l.settings:cat:general_product_type" />
</mvt:if>
<mvt:elseif expr="('ATV' CIN l.settings:cat:general_product_type) EQ 1">
<mvt:if expr="len(l.settings:product:general_product_type:atv) LT len(l.settings:cat:general_product_type)">
<mvt:assign name="l.settings:product:general_product_type:atv" value="l.settings:cat:general_product_type" />
</mvt:if>
<mvt:elseif expr="('Casual' CIN l.settings:cat:general_product_type) EQ 1">
<mvt:if expr="len(l.settings:product:general_product_type:casual) LT len(l.settings:cat:general_product_type)">
<mvt:assign name="l.settings:product:general_product_type:casual" value="l.settings:cat:general_product_type" />
</mvt:if>
<mvt:elseif expr="('Snow' CIN l.settings:cat:general_product_type) EQ 1">
<mvt:if expr="len(l.settings:product:general_product_type:snow) LT len(l.settings:cat:general_product_type)">
<mvt:assign name="l.settings:product:general_product_type:snow" value="l.settings:cat:general_product_type" />
</mvt:if>
<mvt:elseif expr="('MTB' CIN l.settings:cat:general_product_type) EQ 1">
<mvt:if expr="len(l.settings:product:general_product_type:mtb) LT len(l.settings:cat:general_product_type)">
<mvt:assign name="l.settings:product:general_product_type:mtb" value="l.settings:cat:general_product_type" />
</mvt:if>
</mvt:if>
</mvt:if>
<mvt:if expr="NOT (l.settings:cat:department CIN l.settings:product:departments) AND l.settings:cat:department">
<mvt:if expr="l.settings:product:departments">
<mvt:assign name="l.settings:product:departments" value="l.settings:product:departments $ ', ' $ l.settings:cat:department" />
<mvt:else>
<mvt:assign name="l.settings:product:departments" value="l.settings:cat:department" />
</mvt:if>
</mvt:if>
</mvt:foreach><mvt:comment><!-- incategory --></mvt:comment>
<mvt:assign name="l.settings:product:incategories" value="l.settings:product_categories" />
</mvt:if>
<mvt:comment><!-- Don't add product to feed if it is discontinued --></mvt:comment>
<mvt:if expr="l.settings:product:discontinued">
<mvt:foreachcontinue/>
</mvt:if>
<mvt:comment><!-- Determine Trump General Product Type --></mvt:comment>
<mvt:if expr="l.settings:product:general_product_type:casual">
<mvt:assign name="l.settings:product:general_product_type:trump" value="l.settings:product:general_product_type:casual" />
<mvt:elseif expr="l.settings:product:general_product_type:dirt">
<mvt:assign name="l.settings:product:general_product_type:trump" value="l.settings:product:general_product_type:dirt" />
<mvt:elseif expr="l.settings:product:general_product_type:street">
<mvt:assign name="l.settings:product:general_product_type:trump" value="l.settings:product:general_product_type:street" />
<mvt:elseif expr="l.settings:product:general_product_type:atv">
<mvt:assign name="l.settings:product:general_product_type:trump" value="l.settings:product:general_product_type:atv" />
<mvt:elseif expr="l.settings:product:general_product_type:snow">
<mvt:assign name="l.settings:product:general_product_type:trump" value="l.settings:product:general_product_type:snow" />
<mvt:elseif expr="l.settings:product:general_product_type:mtb">
<mvt:assign name="l.settings:product:general_product_type:trump" value="l.settings:product:general_product_type:mtb" />
</mvt:if>
<mvt:comment><!-- Look Up Brand & Alternate Display Page --></mvt:comment>
<mvt:assign name="g.sql_select" value="'SELECT p.page_id, sp.brand FROM ' $ g.store_table_prefix $ 'Products AS p LEFT JOIN ' $ g.store_table_prefix $ 'SS_SPProducts sp ON p.id = sp.product_id WHERE p.id = ' $ l.settings:product:id $ ' LIMIT 1'" />
<mvt:item name="ry_toolbelt" param="query|g.sql_select|results" />
<mvt:assign name="l.settings:product:brand" value="l.settings:results[1]:brand" />
<mvt:comment><!-- Clean Description --></mvt:comment>
<mvt:item name="toolkit" param="nohtml|l.all_settings:product:descrip|l.all_settings:product:descrip" />
<mvt:assign name="l.settings:product:descrip" value="glosub( l.settings:product:descrip, g.newline, '' )" />
<mvt:assign name="l.settings:product:descrip" value="glosub( l.settings:product:descrip, g.tab, '' )" />
<mvt:assign name="l.settings:product:descrip" value="glosub( l.settings:product:descrip, g.return, '' )" />
<mvt:assign name="l.settings:product:descrip" value="trim(glosub( l.settings:product:descrip, ' ', ' ' ))" />
<mvt:comment><!-- Misc. Product Details --></mvt:comment>
<mvt:assign name="l.settings:product:item_group_id" value="l.settings:product:id" />
<mvt:assign name="l.settings:product:link" value="'http://www.example.com/p/' $ l.settings:product:code" />
<mvt:if expr="l.settings:product:customfield_values:productimagecustomfields:main">
<mvt:assign name="l.settings:product:image" value="'http://www.example.com/mm5/' $ l.settings:product:customfield_values:productimagecustomfields:main" />
</mvt:if>
<mvt:assign name="l.settings:product:condition" value="'new'" />
<mvt:assign name="l.settings:product:count_onhand" value="0" />
<mvt:if expr="'women' CIN l.settings:product:name OR 'girl' CIN l.settings:product:name">
<mvt:assign name="l.settings:product:gender" value="'female'" />
<mvt:else>
<mvt:assign name="l.settings:product:gender" value="'unisex'" />
</mvt:if>
<mvt:if expr="'youth' CIN l.settings:product:name OR 'peewee' CIN l.settings:product:name">
<mvt:assign name="l.settings:product:age_group" value="'kids'" />
<mvt:else>
<mvt:assign name="l.settings:product:age_group" value="'adult'" />
</mvt:if>
<mvt:comment><!-- Reset Price for "Best Price" products --></mvt:comment>
<mvt:if expr="l.settings:product:formatted_price EQ '$0.00' OR l.settings:product:formatted_price EQ 'Best Price'">
<mvt:foreachcontinue/>
<mvt:assign name="l.settings:product:price" value="0" />
</mvt:if>
<mvt:comment><!-- Loop Over Variants OR Attributes --></mvt:comment>
<mvt:assign name="l.settings:product:total_quantity" value="0"/>
<mvt:item name="toolkit" param="variantarray|l.all_settings:product:vcount|l.all_settings:product:code" />
<mvt:comment><!-- page_id 279 is PROD_COMBO --></mvt:comment>
<mvt:if expr="l.settings:product:page_id EQ '279' AND l.settings:product:vcount GT 0">
<mvt:comment><!-- Loop Over Variants (New Inventory Method) --></mvt:comment>
<mvt:foreach iterator="variant" array="variants">
<mvt:assign name="l.settings:variant:size" value="''" />
<mvt:assign name="l.settings:variant:color" value="''" />
<mvt:assign name="l.settings:variant:link" value="l.settings:product:link" />
<mvt:comment><!-- Loop Over Variant Options --></mvt:comment>
<mvt:foreach iterator="option" array="variant:variant_options">
<mvt:if expr="l.settings:option:opt_code">
<mvt:assign name="l.settings:variant:link" value="l.settings:variant:link $ '/option/' $ l.settings:option:opt_code" />
</mvt:if>
<mvt:comment><!-- Color --></mvt:comment>
<mvt:if expr="'color' CIN l.settings:option:attr_code">
<mvt:assign name="l.settings:variant:color" value="l.settings:option:opt_prompt" />
</mvt:if>
<mvt:comment><!-- Size --></mvt:comment>
<mvt:if expr="'size' CIN l.settings:option:attr_code AND NOT( 'lens' CIN l.settings:option:attr_prompt)">
<mvt:if expr="' US (' CIN l.settings:option:opt_prompt">
<mvt:assign name="l.settings:option:opt_prompt" value="gettoken(l.settings:option:opt_prompt, ' US (', 1)" />
</mvt:if>
<mvt:if expr="'EU/' CIN l.settings:option:opt_prompt">
<mvt:assign name="l.settings:option:opt_prompt" value="glosub(gettoken(l.settings:option:opt_prompt, 'EU/', 2), 'US', '')" />
</mvt:if>
<mvt:if expr="' EU (' CIN l.settings:option:opt_prompt">
<mvt:assign name="l.settings:option:opt_prompt" value="glosub(gettoken(l.settings:option:opt_prompt, ' EU (', 2), ' US)', '')" />
</mvt:if>
<mvt:if expr="' (' CIN l.settings:option:opt_prompt">
<mvt:assign name="l.settings:option:opt_prompt" value="gettoken(l.settings:option:opt_prompt, ' (', 1)" />
</mvt:if>
<mvt:assign name="l.settings:variant:size" value="l.settings:option:opt_prompt" />
</mvt:if>
</mvt:foreach>
<mvt:if expr="l.settings:variant:color AND isalpha( l.settings:variant:color )">
<mvt:if expr="l.settings:product:color">
<mvt:assign name="l.settings:product:color" value="l.settings:product:color $ ','" />
</mvt:if>
<mvt:assign name="l.settings:product:color" value="l.settings:variant:color" />
<mvt:if expr="ISNULL l.settings:product:color_single">
<mvt:assign name="l.settings:product:color_single" value="l.settings:variant:color" />
</mvt:if>
</mvt:if>
<mvt:if expr="l.settings:variant:size">
<mvt:if expr="l.settings:product:size">
<mvt:assign name="l.settings:product:size" value="l.settings:product:size $ ','" />
</mvt:if>
<mvt:assign name="l.settings:product:size" value="l.settings:variant:size" />
<mvt:if expr="ISNULL l.settings:product:size_single">
<mvt:assign name="l.settings:product:size_single" value="l.settings:variant:size" />
</mvt:if>
</mvt:if>
<mvt:comment><!-- Item Group ID --></mvt:comment>
<mvt:comment>
<!--
<mvt:if expr="miva_array_elements(l.settings:variant:variant_options) GT 1 AND ( l.settings:variant:color AND l.settings:variant:size)">
<mvt:assign name="l.settings:variant:item_group_id" value="l.settings:product:item_group_id" />
<mvt:else>
<mvt:assign name="l.settings:variant:item_group_id" value="''" />
<mvt:assign name="l.settings:product:item_group_id" value="''" />
</mvt:if
-->
</mvt:comment>
<mvt:comment><!-- Availability --></mvt:comment>
<mvt:assign name="l.settings:product:count_onhand" value="l.settings:product:count_onhand + l.settings:variant:count_onhand" />
<mvt:if expr="l.settings:variant:count_onhand GT 0">
<mvt:assign name="l.settings:variant:availability" value="'in stock'" />
<mvt:else>
<mvt:assign name="l.settings:variant:availability" value="'out of stock'" />
</mvt:if>
<mvt:comment><!-- Misc. Variant Details --></mvt:comment>
<mvt:item name="toolkit" param="customimagec|l.all_settings:variant:image|l.all_settings:variant:variant_code|main" />
<mvt:if expr="l.settings:variant:image">
<mvt:assign name="l.settings:variant:image" value="'http://' $ g.domain:name $ '/mm5/' $ l.settings:variant:image" />
<mvt:elseif expr="l.settings:product:customfield_values:productimagecustomfields:main">
<mvt:comment>if variant image fails try to get master image</mvt:comment>
<mvt:assign name="l.settings:variant:image" value="'http://' $ g.domain:name $ '/mm5/' $ l.settings:product:customfield_values:productimagecustomfields:main" />
</mvt:if>
<mvt:if expr="ISNULL l.settings:variant:price">
<mvt:assign name="l.settings:variant:price" value="l.settings:product:price" />
</mvt:if>
<mvt:assign name="l.settings:variant:id" value="l.settings:variant:variant_id" />
<mvt:assign name="l.settings:variant:code" value="trim(gettoken(l.settings:variant:variant_code, '*', 1))" />
<mvt:if expr="'Apparel & Accessories' CIN l.settings:product:customfield_values:customfields:google_category AND ISNULL l.settings:variant:color AND ISNULL l.settings:variant:size">
<mvt:foreachcontinue/>
</mvt:if>
<mvt:if expr="miva_array_find( l.settings:variant:code, g.duplicate_ids:array, 1 )">
<mvt:foreachcontinue/>
<mvt:else>
<mvt:assign name="l.index" value="miva_array_insert( g.duplicate_ids:array, l.settings:variant:code, -1 )" />
<mvt:assign name="g.ids_row" value="l.settings:variant:code $ ','" />
<mvt:assign name="l.result" value="file_append( g.google_ids_temp_file_path, 'script', g.ids_row)"/>
</mvt:if>
<mvt:assign name="l.settings:variant:link" value="glosub(l.settings:variant:link, ' ', '')" />
<mvt:assign name="l.settings:variant:link" value="glosub(l.settings:variant:link, g.delimiter, '')" />
<mvt:comment><!-- Write Variant File Row --></mvt:comment>
<mvt:assign name="g.file_row" value="
l.settings:variant:code $ g.delimiter $
l.settings:product:code $ g.delimiter $
l.settings:variant:code $ g.delimiter $
l.settings:product:name $ g.delimiter $
l.settings:product:descrip $ g.delimiter $
l.settings:product:customfield_values:customfields:google_category $ g.delimiter $
l.settings:product:product_type $ g.delimiter $
l.settings:product:general_product_type:trump $ g.delimiter $
l.settings:product:departments $ g.delimiter $
l.settings:variant:link $ g.delimiter $
l.settings:variant:image $ g.delimiter $
l.settings:product:condition $ g.delimiter $
l.settings:variant:availability $ g.delimiter $
l.settings:variant:count_onhand $ g.delimiter $
l.settings:product:customfield_values:customfields:flag $ g.delimiter $
l.settings:variant:price $ g.delimiter $
l.settings:product:brand $ g.delimiter $
l.settings:product:gender $ g.delimiter $
l.settings:product:age_group $ g.delimiter $
l.settings:variant:color $ g.delimiter $
l.settings:variant:size $ g.delimiter $
'v' $ g.delimiter $
g.expiration_date $
g.newline
"/>
<mvt:if expr="g.output EQ 'screen'">
&mvt:global:file_row;
<mvt:else>
<mvt:assign name="g.write_line" value="file_append( g.listrak_temp_file_path, 'script', g.file_row )"/>
<mvt:if expr="l.settings:variant:count_onhand GT 0">
<mvt:assign name="g.write_line" value="file_append( g.google_temp_file_path, 'script', g.file_row )"/>
</mvt:if>
</mvt:if>
</mvt:foreach>
<mvt:assign name="l.settings:product:variants" value="l.settings:variants" />
<mvt:else>
<mvt:comment><!-- Loop Over Attributes (Old Inventory Method) --></mvt:comment>
<mvt:item name="product_attributes" param="product:id" />
<mvt:foreach iterator="attribute" array="attributes">
<mvt:if expr="l.settings:attribute:code EQ 'CUSTOM_BG'">
<mvt:foreachcontinue/>
</mvt:if>
<mvt:if expr="('Add ' CIN l.settings:attribute:prompt) EQ 1 OR '?' CIN l.settings:attribute:prompt OR 'nothanks' CIN l.settings:variant:code OR 'No Thanks' CIN l.settings:variant:code">
<mvt:foreachcontinue/>
</mvt:if>
<mvt:comment><!-- Price for "Best Price" products --></mvt:comment>
<mvt:if expr="l.settings:product:formatted_price EQ 'Best Price'">
<mvt:foreachcontinue/>
<mvt:assign name="l.settings:product:price" value="0" />
</mvt:if>
<mvt:comment><!-- Loop Over Attribute Options --></mvt:comment>
<mvt:foreach iterator="option" array="attribute:options">
<mvt:assign name="l.settings:variant" value="''" />
<mvt:item name="btodattr" param="showQty|l.all_settings:option:code" />
<mvt:assign name="l.settings:option:ems_check_attr" value="g.ems_check_attr" />
<mvt:comment><!-- Skip, if forced out of stock --></mvt:comment>
<mvt:if expr="l.settings:option:ems_check_attr:hide EQ 1 OR NOT l.settings:option:ems_check_attr:quantity OR l.settings:option:ems_check_attr:invprod NE 1">
<mvt:foreachcontinue/>
</mvt:if>
<mvt:comment><!-- Price --></mvt:comment>
<mvt:assign name="l.settings:variant:price" value="l.settings:option:price + l.settings:product:price" />
<mvt:comment><!-- Color --></mvt:comment>
<mvt:if expr="'color' CIN l.settings:attribute:code OR l.settings:attribute:code EQ 'color' OR 'colorsize' CIN l.settings:attribute:code OR l.settings:attribute:code EQ 'jersey_size' OR 'Color_Size' CIN l.settings:attribute:code">
<mvt:assign name="l.settings:option:color" value="l.settings:option:prompt" />
<mvt:if expr="'_' CIN l.settings:option:color">
<mvt:assign name="l.settings:option:color" value="gettoken(l.settings:option:color, '_', 1)" />
</mvt:if>
<mvt:assign name="l.settings:variant:color" value="l.settings:option:color" />
</mvt:if>
<mvt:comment><!-- Size --></mvt:comment>
<mvt:if expr="('size' CIN l.settings:attribute:code OR l.settings:attribute:code EQ 'size' OR 'colorsize' CIN l.settings:attribute:code OR l.settings:attribute:code EQ 'jersey_size' OR 'Color_Size' CIN l.settings:attribute:code) AND NOT( '(' CIN l.settings:option:prompt)">
<mvt:assign name="l.settings:option:size" value="l.settings:option:prompt" />
<mvt:if expr="'_' CIN l.settings:option:size">
<mvt:assign name="l.settings:option:size" value="gettoken(l.settings:option:size, '_', 2)" />
</mvt:if>
<mvt:if expr="' US (' CIN l.settings:option:size">
<mvt:assign name="l.settings:option:size" value="gettoken(l.settings:option:size, ' US (', 1)" />
</mvt:if>
<mvt:if expr="'EU/' CIN l.settings:option:size">
<mvt:assign name="l.settings:option:size" value="glosub(gettoken(l.settings:option:size, 'EU/', 2), 'US', '')" />
</mvt:if>
<mvt:if expr="' EU (' CIN l.settings:option:size">
<mvt:assign name="l.settings:option:size" value="glosub(gettoken(l.settings:option:size, ' EU (', 2), ' US)', '')" />
</mvt:if>
<mvt:if expr="' ($' CIN l.settings:option:size">
<mvt:assign name="l.settings:option:size" value="gettoken(l.settings:option:size, ' ($', 1)" />
</mvt:if>
<mvt:assign name="l.settings:variant:size" value="l.settings:option:size" />
</mvt:if>
<mvt:if expr="l.settings:variant:color">
<mvt:if expr="l.settings:product:color">
<mvt:assign name="l.settings:product:color" value="l.settings:product:color $ ','" />
</mvt:if>
<mvt:assign name="l.settings:product:color" value="l.settings:variant:color" />
<mvt:if expr="ISNULL l.settings:product:color_single">
<mvt:assign name="l.settings:product:color_single" value="l.settings:variant:color" />
</mvt:if>
</mvt:if>
<mvt:if expr="l.settings:variant:size">
<mvt:if expr="l.settings:product:size">
<mvt:assign name="l.settings:product:size" value="l.settings:product:size $ ','" />
</mvt:if>
<mvt:assign name="l.settings:product:size" value="l.settings:variant:size" />
<mvt:if expr="ISNULL l.settings:product:size_single">
<mvt:assign name="l.settings:product:size_single" value="l.settings:variant:size" />
</mvt:if>
</mvt:if>
<mvt:comment><!-- Item Group ID --></mvt:comment>
<mvt:comment>
<!--
<mvt:if expr="miva_array_elements(l.settings:attribute:options) GT 1 AND (l.settings:variant:color OR l.settings:variant:size)">
<mvt:assign name="l.settings:variant:item_group_id" value="l.settings:product:item_group_id" />
<mvt:else>
<mvt:assign name="l.settings:variant:item_group_id" value="''" />
<mvt:assign name="l.settings:product:item_group_id" value="''" />
</mvt:if>
-->
</mvt:comment>
<mvt:comment><!-- Availability --></mvt:comment>
<mvt:assign name="l.settings:variant:count_onhand" value="l.settings:option:ems_check_attr:quantity" />
<mvt:assign name="l.settings:product:count_onhand" value="l.settings:product:count_onhand + l.settings:variant:count_onhand" />
<mvt:if expr="l.settings:option:ems_check_attr:quantity GT 0">
<mvt:assign name="l.settings:variant:availability" value="'in stock'" />
<mvt:else>
<mvt:assign name="l.settings:variant:availability" value="'out of stock'" />
</mvt:if>
<mvt:comment><!-- Misc. Variant Details --></mvt:comment>
<mvt:assign name="l.settings:variant:id" value="l.settings:product:id $ '-' $ l.settings:option:id" />
<mvt:assign name="l.settings:variant:code" value="trim(gettoken(l.settings:option:code, '*', 1))" />
<mvt:if expr="l.settings:option:code">
<mvt:assign name="l.settings:variant:link" value="l.settings:product:link $ '/option/' $ l.settings:option:code" />
</mvt:if>
<mvt:if expr="toupper(l.settings:variant:code) EQ 'SELECT'">
<mvt:foreachcontinue/>
</mvt:if>
<mvt:if expr="'Apparel & Accessories' CIN l.settings:product:customfield_values:customfields:google_category AND ISNULL l.settings:variant:color AND ISNULL l.settings:variant:size">
<mvt:foreachcontinue/>
</mvt:if>
<mvt:if expr="NOT(l.settings:variant:price GT 0)">
<mvt:foreachcontinue/>
</mvt:if>
<mvt:if expr="miva_array_find( l.settings:variant:code, g.duplicate_ids:array, 1 )">
<mvt:foreachcontinue/>
<mvt:else>
<mvt:assign name="l.index" value="miva_array_insert( g.duplicate_ids:array, l.settings:variant:code, -1 )" />
<mvt:assign name="g.ids_row" value="l.settings:variant:code $ ','" />
<mvt:assign name="l.result" value="file_append( g.google_ids_temp_file_path, 'script', g.ids_row)"/>
</mvt:if>
<mvt:assign name="l.settings:variant:link" value="glosub(l.settings:variant:link, ' ', '')" />
<mvt:assign name="l.settings:variant:link" value="glosub(l.settings:variant:link, g.delimiter, '')" />
<mvt:comment><!-- Write Variant File Row --></mvt:comment>
<mvt:assign name="g.file_row" value="
l.settings:variant:code $ g.delimiter $
l.settings:product:code $ g.delimiter $
l.settings:variant:code $ g.delimiter $
l.settings:product:name $ g.delimiter $
l.settings:product:descrip $ g.delimiter $
l.settings:product:customfield_values:customfields:google_category $ g.delimiter $
l.settings:product:product_type $ g.delimiter $
l.settings:product:general_product_type:trump $ g.delimiter $
l.settings:product:departments $ g.delimiter $
l.settings:variant:link $ g.delimiter $
l.settings:product:image $ g.delimiter $
l.settings:product:condition $ g.delimiter $
l.settings:variant:availability $ g.delimiter $
l.settings:variant:count_onhand $ g.delimiter $
l.settings:product:customfield_values:customfields:flag $ g.delimiter $
l.settings:variant:price $ g.delimiter $
l.settings:product:brand $ g.delimiter $
l.settings:product:gender $ g.delimiter $
l.settings:product:age_group $ g.delimiter $
l.settings:variant:color $ g.delimiter $
l.settings:variant:size $ g.delimiter $
'v' $ g.delimiter $
g.expiration_date $
g.newline
"/>
<mvt:if expr="g.output EQ 'screen'">
&mvt:global:file_row;
<mvt:else>
<mvt:assign name="g.write_line" value="file_append( g.listrak_temp_file_path, 'script', g.file_row )"/>
<mvt:if expr="l.settings:variant:count_onhand GT 0">
<mvt:assign name="g.write_line" value="file_append( g.google_temp_file_path, 'script', g.file_row )"/>
</mvt:if>
</mvt:if>
</mvt:foreach>
</mvt:foreach>
<mvt:assign name="l.settings:product:attributes" value="l.settings:attributes" />
</mvt:if>
<mvt:if expr="l.settings:product:count_onhand GT 0">
<mvt:assign name="l.settings:product:availability" value="'in stock'" />
<mvt:else>
<mvt:assign name="l.settings:product:availability" value="'out of stock'" />
</mvt:if>
<mvt:if expr="NOT(l.settings:product:price GT 0)">
<mvt:foreachcontinue/>
</mvt:if>
<mvt:if expr="'Apparel & Accessories' CIN l.settings:product:customfield_values:customfields:google_category AND ISNULL l.settings:product:color_single AND ISNULL l.settings:product:size_single">
<mvt:foreachcontinue/>
</mvt:if>
<mvt:comment><!-- Write Master Product File Row --></mvt:comment>
<mvt:assign name="g.file_row" value="
l.settings:product:code $ g.delimiter $
l.settings:product:code $ g.delimiter $
l.settings:product:code $ g.delimiter $
l.settings:product:name $ g.delimiter $
l.settings:product:descrip $ g.delimiter $
l.settings:product:customfield_values:customfields:google_category $ g.delimiter $
l.settings:product:product_type $ g.delimiter $
l.settings:product:general_product_type:trump $ g.delimiter $
l.settings:product:departments $ g.delimiter $
l.settings:product:link $ g.delimiter $
l.settings:product:image $ g.delimiter $
l.settings:product:condition $ g.delimiter $
l.settings:product:availability $ g.delimiter $
l.settings:product:count_onhand $ g.delimiter $
l.settings:product:customfield_values:customfields:flag $ g.delimiter $
l.settings:product:price $ g.delimiter $
l.settings:product:brand $ g.delimiter $
l.settings:product:gender $ g.delimiter $
l.settings:product:age_group $ g.delimiter $
l.settings:product:color_single $ g.delimiter $
l.settings:product:size_single $ g.delimiter $
'm' $ g.delimiter $
g.expiration_date $
g.newline
"/>
<mvt:if expr="g.output EQ 'screen'">
&mvt:global:file_row;
<mvt:elseif expr="g.output EQ 'debug'">
<mvt:eval expr="decodeattribute(glosub(miva_array_serialize(l.settings:product), ',', '<br>'))" />
<hr>
<mvt:else>
<mvt:assign name="g.write_line" value="file_append( g.listrak_temp_file_path, 'script', g.file_row )"/>
</mvt:if>
</mvt:foreach>
<mvt:comment><!-- Pagination/Response --></mvt:comment>
<mvt:assign name="g.current_url" value="'http://' $ g.domain:name $ '/cs/feed-google-merchant?continue=' $ g.continue $ '&auth=' $ g.auth $ '&output=' $ g.output $ '&AllOffset=' $ g.AllOffset $ '&Per_Page=' $ g.Per_Page $ '&Product_Code=' $ g.Product_Code" />
<mvt:assign name="g.next_url" value="'http://' $ g.domain:name $ '/cs/feed-google-merchant?continue=' $ g.continue $ '&auth=' $ g.auth $ '&output=' $ g.output $ '&AllOffset=' $ g.AllNextOffset $ '&Per_Page=' $ g.Per_Page $ '&Product_Code=' $ g.Product_Code" />
<mvt:if expr="g.Exit">
<a href="&mvt:global:current_url;">&mvt:global:current_url;</a><br>
<a href="http://www.example.com&mvt:global:file_path;&mvt:global:file_name;">&mvte:global:file_name;</a><br>
<mvt:elseif expr="l.settings:all_products:page_links:current_page EQ l.settings:all_products:page_links:last_page">
Complete
<mvt:comment><!-- Rename Final File - Google --></mvt:comment>
<mvt:if expr="sexists(g.google_temp_file_path)">
<mvt:assign name="l.result" value="srename(g.google_temp_file_path, g.google_final_file_path)"/>
</mvt:if>
<mvt:if expr="sexists(g.google_ids_temp_file_path)">
<mvt:assign name="l.result" value="sdelete(g.google_ids_temp_file_path)"/>
</mvt:if>
<mvt:comment><!-- Rename Final File - Listrak --></mvt:comment>
<mvt:if expr="sexists(g.listrak_temp_file_path)">
<mvt:assign name="l.result" value="srename(g.listrak_temp_file_path, g.listrak_final_file_path)"/>
</mvt:if>
<mvt:else>
<mvt:if expr="g.AllNextOffset GT 0 AND ISNULL g.Exit">
Continue|&mvt:global:AllNextOffset;
<mvt:if expr="g.continue EQ 'redirect'">
<mvt:assign name="l.header" value="miva_output_header( 'Status', '301 Moved Permanently' )" />
<mvt:assign name="l.header" value="miva_output_header( 'Location', g.next_url )" />
<mvt:elseif expr="g.continue EQ 'refresh'">
<meta http-equiv="refresh" content="0;URL='&mvte:global:next_url;'" />
</mvt:if>
<mvt:else>
Complete
</mvt:if>
</mvt:if>
<mvt:comment><!-- DEV FEED --></mvt:comment>
<mvt:assign name="g.file_folder" value="'/feeds/output/dev/'"/>
<mvt:comment><!-- File Config Variables - Google --></mvt:comment>
<mvt:if expr="ISNULL g.google_temp_file_name">
<mvt:assign name="g.google_temp_file_name" value="'google.temp'"/>
</mvt:if>
<mvt:if expr="g.Product_Code">
<mvt:assign name="g.google_temp_file_name" value="'google_' $ g.Product_Code $ '.temp'"/>
</mvt:if>
<mvt:assign name="g.google_temp_file_path" value="g.file_folder $ g.google_temp_file_name"/>
<mvt:assign name="g.google_final_file_path" value="glosub( g.google_temp_file_path, '.temp', '.txt' )"/>
<mvt:comment><!-- Unique ID File Helper --></mvt:comment>
<mvt:if expr="ISNULL g.google_ids_temp_file_name">
<mvt:assign name="g.google_ids_temp_file_name" value="'google_ids.temp'"/>
</mvt:if>
<mvt:if expr="g.Product_Code">
<mvt:assign name="g.google_ids_temp_file_name" value="'google_ids_' $ g.Product_Code $ '.temp'"/>
</mvt:if>
<mvt:assign name="g.google_ids_temp_file_path" value="g.file_folder $ g.google_ids_temp_file_name"/>
<mvt:comment><!-- File Config Variables - Listrak --></mvt:comment>
<mvt:if expr="ISNULL g.listrak_temp_file_name">
<mvt:assign name="g.listrak_temp_file_name" value="'listrak.temp'"/>
</mvt:if>
<mvt:assign name="g.listrak_temp_file_path" value="g.file_folder $ g.listrak_temp_file_name"/>
<mvt:assign name="g.listrak_final_file_path" value="glosub( g.listrak_temp_file_path, '.temp', '.txt' )"/>
<mvt:assign name="g.header_row" value="
'id' $ g.delimiter $
'item_group_id' $ g.delimiter $
'code' $ g.delimiter $
'title' $ g.delimiter $
'description' $ g.delimiter $
'google_product_category' $ g.delimiter $
'product_type' $ g.delimiter $
'general_product_type' $ g.delimiter $
'departments' $ g.delimiter $
'link' $ g.delimiter $
'image_link' $ g.delimiter $
'condition' $ g.delimiter $
'availability' $ g.delimiter $
'count_onhand' $ g.delimiter $
'flag' $ g.delimiter $
'price' $ g.delimiter $
'brand' $ g.delimiter $
'gender' $ g.delimiter $
'age_group' $ g.delimiter $
'color' $ g.delimiter $
'size' $ g.delimiter $
'master_flag' $ g.delimiter $
'expiration_date' $
g.newline
"/>
<mvt:comment><!-- Delete File if it exists, create new file with header row --></mvt:comment>
<mvt:if expr="ISNULL g.Per_Page">
<mvt:assign name="g.Per_Page" value="50" />
</mvt:if>
<mvt:if expr="ISNULL g.AllOffset">
<mvt:assign name="g.AllOffset" value="0" />
</mvt:if>
<mvt:if expr="g.output EQ 'screen'">
&mvt:global:header_row;
<mvt:else>
<mvt:comment><!-- Create/Delete File - Google --></mvt:comment>
<mvt:if expr="g.AllOffset LT g.Per_Page">
<mvt:if expr="sexists(g.google_temp_file_path)">
<mvt:if expr="sdelete(g.google_temp_file_path)">
<mvt:assign name="l.result" value="file_create(g.google_temp_file_path, 'script', g.header_row)"/>
</mvt:if>
<mvt:else>
<mvt:assign name="l.result" value="file_create(g.google_temp_file_path, 'script', g.header_row)"/>
</mvt:if>
</mvt:if>
<mvt:comment><!-- Create/Delete File - Google IDs --></mvt:comment>
<mvt:if expr="g.AllOffset LT g.Per_Page">
<mvt:if expr="sexists(g.google_ids_temp_file_path)">
<mvt:if expr="sdelete(g.google_ids_temp_file_path)">
<mvt:assign name="l.result" value="file_create(g.google_ids_temp_file_path, 'script', g.comma)"/>
</mvt:if>
<mvt:else>
<mvt:assign name="l.result" value="file_create(g.google_ids_temp_file_path, 'script', g.comma)"/>
</mvt:if>
</mvt:if>
<mvt:comment><!-- Create/Delete File - Listrak --></mvt:comment>
<mvt:if expr="g.AllOffset LT g.Per_Page">
<mvt:if expr="sexists(g.listrak_temp_file_path)">
<mvt:if expr="sdelete(g.listrak_temp_file_path)">
<mvt:assign name="l.result" value="file_create(g.listrak_temp_file_path, 'script', g.header_row)"/>
</mvt:if>
<mvt:else>
<mvt:assign name="l.result" value="file_create(g.listrak_temp_file_path, 'script', g.header_row)"/>
</mvt:if>
</mvt:if>
</mvt:if>
<mvt:assign name="g.duplicate_ids:result" value="file_read( g.google_ids_temp_file_path, 'script', g.duplicate_ids:string )" />
<mvt:assign name="g.duplicate_ids:array" value="miva_array_deserialize( g.duplicate_ids:string )" />
<mvt:comment><!-- Loop over all of the products --></mvt:comment>
<mvt:foreach iterator="product" array="all_products:products">
<mvt:if expr="g.Product_Code">
<mvt:if expr="g.Product_Code EQ l.settings:product:code">
<mvt:assign name="g.Exit" value="1" />
<mvt:else>
<mvt:foreachcontinue/>
</mvt:if>
</mvt:if>
<mvt:comment><!-- Don't add product to feed if it is excluded from searchspring by custom field or if it is Rejected from the Google Feed --></mvt:comment>
<mvt:if expr="l.settings:product:customfields:customfield_values:exclude OR l.settings:product:customfields:customfield_values:google_feed_status EQ 'Rejected'">
<mvt:foreachcontinue/>
</mvt:if>
<mvt:comment><!-- Get product_type and check if it is a "discontinued" product --></mvt:comment>
<mvt:item name="ry_toolbelt" param="Product_Categories|g.incatcount|l.all_settings:product:code" />
<mvt:if expr="g.incatcount GT 0">
<mvt:foreach iterator="cat" array="product_categories">
<mvt:if expr="'|' $ l.settings:cat:code $ '|' CIN '|discontinued|ghost|Sizing|street-sizing|'">
<mvt:assign name="l.settings:product:discontinued" value="1" />
<mvt:foreachstop/>
</mvt:if>
<mvt:if expr="NOT miva_array_find(l.settings:cat:name, l.settings:product:category_names, 1)">
<mvt:assign name="l.index" value="miva_array_insert( l.settings:product:category_names, l.settings:cat:name, -1 )" />
</mvt:if>
<mvt:item name="toolkit" param="breadcrumb|b_count|l.all_settings:cat:code" />
<mvt:if expr="g.b_count EQ 0 OR l.settings:breadcrumbs[1]:code EQ 'vt'">
<mvt:foreachcontinue/>
</mvt:if>
<mvt:foreach iterator="breadcrumb" array="breadcrumbs">
<mvt:if expr="'|' $ l.settings:breadcrumb:code $ '|' CIN '|discontinued|ghost|Sizing|street-sizing|'">
<mvt:assign name="l.settings:product:discontinued" value="1" />
<mvt:foreachstop/>
</mvt:if>
<mvt:if expr="l.settings:cat:product_type">
<mvt:assign name="l.settings:cat:product_type" value="l.settings:cat:product_type $ ' > ' $ l.settings:breadcrumb:name" />
<mvt:else>
<mvt:assign name="l.settings:cat:product_type" value="l.settings:breadcrumb:name" />
</mvt:if>
<mvt:if expr="NOT (l.settings:breadcrumbs[1]:code CIN 'ATV,CasualWear,dirt-bike-gear,street-gear,MTB-BMX-GEAR,SNOW-COLD-WEATHER')">
<mvt:foreachcontinue/>
</mvt:if>
<mvt:if expr="'Brand' CIN l.settings:breadcrumbs[2]:name OR
'Specials' CIN l.settings:breadcrumb:name OR
'Clearance' CIN l.settings:breadcrumb:name OR
'Closeout' CIN l.settings:breadcrumb:name">
<mvt:foreachcontinue/>
</mvt:if>
<mvt:if expr="POS3 EQ 1">
<mvt:assign name="l.settings:cat:general_product_type" value="l.settings:breadcrumb:name" />
<mvt:elseif expr="POS3 EQ 2">
<mvt:assign name="l.settings:cat:general_product_type" value="l.settings:cat:general_product_type $ ' > ' $ l.settings:breadcrumb:name" />
<mvt:elseif expr="POS3 EQ 3">
<mvt:assign name="l.settings:cat:general_product_type" value="l.settings:cat:general_product_type $ ' ' $ l.settings:breadcrumb:name" />
</mvt:if>
<mvt:if expr="POS3 EQ 1">
<mvt:assign name="l.settings:cat:department" value="l.settings:breadcrumb:name" />
</mvt:if>
</mvt:foreach><mvt:comment><!-- breadcrumb --></mvt:comment>
<mvt:assign name="l.settings:cat:breadcrumbs" value="l.settings:breadcrumbs" />
<mvt:if expr="l.settings:product:discontinued">
<mvt:item name="customfields" param="Write_Product_ID(l.settings:product:id, 'status', 'Discontinued')" />
<mvt:foreachstop/>
<mvt:else>
<mvt:item name="customfields" param="Write_Product_ID(l.settings:product:id, 'status', '')" />
</mvt:if>
<mvt:if expr="l.settings:product:product_type">
<mvt:assign name="l.settings:product:product_type" value="l.settings:product:product_type $ ','" />
</mvt:if>
<mvt:assign name="l.settings:product:product_type" value="l.settings:product:product_type $ l.settings:cat:product_type" />
<mvt:if expr="l.settings:cat:general_product_type AND miva_array_find( l.settings:cat:general_product_type, l.settings:product:general_product_type:list, 1 ) EQ 0">
<mvt:assign name="l.index" value="miva_array_insert(l.settings:product:general_product_type:list, l.settings:cat:general_product_type, -1)" />
<mvt:if expr="('Dirt' CIN l.settings:cat:general_product_type) EQ 1">
<mvt:if expr="len(l.settings:product:general_product_type:dirt) LT len(l.settings:cat:general_product_type)">
<mvt:assign name="l.settings:product:general_product_type:dirt" value="l.settings:cat:general_product_type" />
</mvt:if>
<mvt:elseif expr="('Street' CIN l.settings:cat:general_product_type) EQ 1">
<mvt:if expr="len(l.settings:product:general_product_type:street) LT len(l.settings:cat:general_product_type)">
<mvt:assign name="l.settings:product:general_product_type:street" value="l.settings:cat:general_product_type" />
</mvt:if>
<mvt:elseif expr="('ATV' CIN l.settings:cat:general_product_type) EQ 1">
<mvt:if expr="len(l.settings:product:general_product_type:atv) LT len(l.settings:cat:general_product_type)">
<mvt:assign name="l.settings:product:general_product_type:atv" value="l.settings:cat:general_product_type" />
</mvt:if>
<mvt:elseif expr="('Casual' CIN l.settings:cat:general_product_type) EQ 1">
<mvt:if expr="len(l.settings:product:general_product_type:casual) LT len(l.settings:cat:general_product_type)">
<mvt:assign name="l.settings:product:general_product_type:casual" value="l.settings:cat:general_product_type" />
</mvt:if>
<mvt:elseif expr="('Snow' CIN l.settings:cat:general_product_type) EQ 1">
<mvt:if expr="len(l.settings:product:general_product_type:snow) LT len(l.settings:cat:general_product_type)">
<mvt:assign name="l.settings:product:general_product_type:snow" value="l.settings:cat:general_product_type" />
</mvt:if>
<mvt:elseif expr="('MTB' CIN l.settings:cat:general_product_type) EQ 1">
<mvt:if expr="len(l.settings:product:general_product_type:mtb) LT len(l.settings:cat:general_product_type)">
<mvt:assign name="l.settings:product:general_product_type:mtb" value="l.settings:cat:general_product_type" />
</mvt:if>
</mvt:if>
</mvt:if>
<mvt:if expr="NOT (l.settings:cat:department CIN l.settings:product:departments) AND l.settings:cat:department">
<mvt:if expr="l.settings:product:departments">
<mvt:assign name="l.settings:product:departments" value="l.settings:product:departments $ ', ' $ l.settings:cat:department" />
<mvt:else>
<mvt:assign name="l.settings:product:departments" value="l.settings:cat:department" />
</mvt:if>
</mvt:if>
</mvt:foreach><mvt:comment><!-- incategory --></mvt:comment>
<mvt:assign name="l.settings:product:incategories" value="l.settings:product_categories" />
</mvt:if>
<mvt:comment><!-- Don't add product to feed if it is discontinued --></mvt:comment>
<mvt:if expr="l.settings:product:discontinued">
<mvt:foreachcontinue/>
</mvt:if>
<mvt:comment><!-- Determine Trump General Product Type --></mvt:comment>
<mvt:if expr="l.settings:product:general_product_type:casual">
<mvt:assign name="l.settings:product:general_product_type:trump" value="l.settings:product:general_product_type:casual" />
<mvt:elseif expr="l.settings:product:general_product_type:dirt">
<mvt:assign name="l.settings:product:general_product_type:trump" value="l.settings:product:general_product_type:dirt" />
<mvt:elseif expr="l.settings:product:general_product_type:street">
<mvt:assign name="l.settings:product:general_product_type:trump" value="l.settings:product:general_product_type:street" />
<mvt:elseif expr="l.settings:product:general_product_type:atv">
<mvt:assign name="l.settings:product:general_product_type:trump" value="l.settings:product:general_product_type:atv" />
<mvt:elseif expr="l.settings:product:general_product_type:snow">
<mvt:assign name="l.settings:product:general_product_type:trump" value="l.settings:product:general_product_type:snow" />
<mvt:elseif expr="l.settings:product:general_product_type:mtb">
<mvt:assign name="l.settings:product:general_product_type:trump" value="l.settings:product:general_product_type:mtb" />
</mvt:if>
<mvt:comment><!-- Look Up Brand & Alternate Display Page --></mvt:comment>
<mvt:assign name="g.sql_select" value="'SELECT p.page_id, sp.brand FROM ' $ g.store_table_prefix $ 'Products AS p LEFT JOIN ' $ g.store_table_prefix $ 'SS_SPProducts sp ON p.id = sp.product_id WHERE p.id = ' $ l.settings:product:id $ ' LIMIT 1'" />
<mvt:item name="ry_toolbelt" param="query|g.sql_select|results" />
<mvt:assign name="l.settings:product:brand" value="l.settings:results[1]:brand" />
<mvt:comment><!-- Clean Description --></mvt:comment>
<mvt:item name="toolkit" param="nohtml|l.all_settings:product:descrip|l.all_settings:product:descrip" />
<mvt:assign name="l.settings:product:descrip" value="glosub( l.settings:product:descrip, g.newline, '' )" />
<mvt:assign name="l.settings:product:descrip" value="glosub( l.settings:product:descrip, g.tab, '' )" />
<mvt:assign name="l.settings:product:descrip" value="glosub( l.settings:product:descrip, g.return, '' )" />
<mvt:assign name="l.settings:product:descrip" value="trim(glosub( l.settings:product:descrip, ' ', ' ' ))" />
<mvt:comment><!-- Misc. Product Details --></mvt:comment>
<mvt:assign name="l.settings:product:item_group_id" value="l.settings:product:id" />
<mvt:assign name="l.settings:product:link" value="'http://www.example.com/p/' $ l.settings:product:code" />
<mvt:if expr="l.settings:product:customfield_values:productimagecustomfields:main">
<mvt:assign name="l.settings:product:image" value="'http://www.example.com/mm5/' $ l.settings:product:customfield_values:productimagecustomfields:main" />
</mvt:if>
<mvt:assign name="l.settings:product:condition" value="'new'" />
<mvt:assign name="l.settings:product:count_onhand" value="0" />
<mvt:if expr="'women' CIN l.settings:product:name OR 'girl' CIN l.settings:product:name">
<mvt:assign name="l.settings:product:gender" value="'female'" />
<mvt:else>
<mvt:assign name="l.settings:product:gender" value="'unisex'" />
</mvt:if>
<mvt:if expr="'youth' CIN l.settings:product:name OR 'peewee' CIN l.settings:product:name">
<mvt:assign name="l.settings:product:age_group" value="'kids'" />
<mvt:else>
<mvt:assign name="l.settings:product:age_group" value="'adult'" />
</mvt:if>
<mvt:comment><!-- Reset Price for "Best Price" products --></mvt:comment>
<mvt:if expr="l.settings:product:formatted_price EQ '$0.00' OR l.settings:product:formatted_price EQ 'Best Price'">
<mvt:foreachcontinue/>
<mvt:assign name="l.settings:product:price" value="0" />
</mvt:if>
<mvt:comment><!-- Loop Over Variants OR Attributes --></mvt:comment>
<mvt:assign name="l.settings:product:total_quantity" value="0"/>
<mvt:item name="toolkit" param="variantarray|l.all_settings:product:vcount|l.all_settings:product:code" />
<mvt:comment><!-- page_id 279 is PROD_COMBO --></mvt:comment>
<mvt:if expr="l.settings:product:page_id EQ '279' AND l.settings:product:vcount GT 0">
<mvt:comment><!-- Loop Over Variants (New Inventory Method) --></mvt:comment>
<mvt:foreach iterator="variant" array="variants">
<mvt:assign name="l.settings:variant:size" value="''" />
<mvt:assign name="l.settings:variant:color" value="''" />
<mvt:assign name="l.settings:variant:link" value="l.settings:product:link" />
<mvt:comment><!-- Loop Over Variant Options --></mvt:comment>
<mvt:foreach iterator="option" array="variant:variant_options">
<mvt:if expr="l.settings:option:opt_code">
<mvt:assign name="l.settings:variant:link" value="l.settings:variant:link $ '/option/' $ l.settings:option:opt_code" />
</mvt:if>
<mvt:comment><!-- Color --></mvt:comment>
<mvt:if expr="'color' CIN l.settings:option:attr_code">
<mvt:assign name="l.settings:variant:color" value="l.settings:option:opt_prompt" />
</mvt:if>
<mvt:comment><!-- Size --></mvt:comment>
<mvt:if expr="'size' CIN l.settings:option:attr_code AND NOT( 'lens' CIN l.settings:option:attr_prompt)">
<mvt:if expr="' US (' CIN l.settings:option:opt_prompt">
<mvt:assign name="l.settings:option:opt_prompt" value="gettoken(l.settings:option:opt_prompt, ' US (', 1)" />
</mvt:if>
<mvt:if expr="'EU/' CIN l.settings:option:opt_prompt">
<mvt:assign name="l.settings:option:opt_prompt" value="glosub(gettoken(l.settings:option:opt_prompt, 'EU/', 2), 'US', '')" />
</mvt:if>
<mvt:if expr="' EU (' CIN l.settings:option:opt_prompt">
<mvt:assign name="l.settings:option:opt_prompt" value="glosub(gettoken(l.settings:option:opt_prompt, ' EU (', 2), ' US)', '')" />
</mvt:if>
<mvt:if expr="' (' CIN l.settings:option:opt_prompt">
<mvt:assign name="l.settings:option:opt_prompt" value="gettoken(l.settings:option:opt_prompt, ' (', 1)" />
</mvt:if>
<mvt:assign name="l.settings:variant:size" value="l.settings:option:opt_prompt" />
</mvt:if>
</mvt:foreach>
<mvt:if expr="l.settings:variant:color AND isalpha( l.settings:variant:color )">
<mvt:if expr="l.settings:product:color">
<mvt:assign name="l.settings:product:color" value="l.settings:product:color $ ','" />
</mvt:if>
<mvt:assign name="l.settings:product:color" value="l.settings:variant:color" />
<mvt:if expr="ISNULL l.settings:product:color_single">
<mvt:assign name="l.settings:product:color_single" value="l.settings:variant:color" />
</mvt:if>
</mvt:if>
<mvt:if expr="l.settings:variant:size">
<mvt:if expr="l.settings:product:size">
<mvt:assign name="l.settings:product:size" value="l.settings:product:size $ ','" />
</mvt:if>
<mvt:assign name="l.settings:product:size" value="l.settings:variant:size" />
<mvt:if expr="ISNULL l.settings:product:size_single">
<mvt:assign name="l.settings:product:size_single" value="l.settings:variant:size" />
</mvt:if>
</mvt:if>
<mvt:comment><!-- Item Group ID --></mvt:comment>
<mvt:comment>
<!--
<mvt:if expr="miva_array_elements(l.settings:variant:variant_options) GT 1 AND ( l.settings:variant:color AND l.settings:variant:size)">
<mvt:assign name="l.settings:variant:item_group_id" value="l.settings:product:item_group_id" />
<mvt:else>
<mvt:assign name="l.settings:variant:item_group_id" value="''" />
<mvt:assign name="l.settings:product:item_group_id" value="''" />
</mvt:if
-->
</mvt:comment>
<mvt:comment><!-- Availability --></mvt:comment>
<mvt:assign name="l.settings:product:count_onhand" value="l.settings:product:count_onhand + l.settings:variant:count_onhand" />
<mvt:if expr="l.settings:variant:count_onhand GT 0">
<mvt:assign name="l.settings:variant:availability" value="'in stock'" />
<mvt:else>
<mvt:assign name="l.settings:variant:availability" value="'out of stock'" />
</mvt:if>
<mvt:comment><!-- Misc. Variant Details --></mvt:comment>
<mvt:item name="toolkit" param="customimagec|l.all_settings:variant:image|l.all_settings:variant:variant_code|main" />
<mvt:if expr="l.settings:variant:image">
<mvt:assign name="l.settings:variant:image" value="'http://' $ g.domain:name $ '/mm5/' $ l.settings:variant:image" />
<mvt:elseif expr="l.settings:product:customfield_values:productimagecustomfields:main">
<mvt:comment>if variant image fails try to get master image</mvt:comment>
<mvt:assign name="l.settings:variant:image" value="'http://' $ g.domain:name $ '/mm5/' $ l.settings:product:customfield_values:productimagecustomfields:main" />
</mvt:if>
<mvt:if expr="ISNULL l.settings:variant:price">
<mvt:assign name="l.settings:variant:price" value="l.settings:product:price" />
</mvt:if>
<mvt:assign name="l.settings:variant:id" value="l.settings:variant:variant_id" />
<mvt:assign name="l.settings:variant:code" value="trim(gettoken(l.settings:variant:variant_code, '*', 1))" />
<mvt:if expr="'Apparel & Accessories' CIN l.settings:product:customfield_values:customfields:google_category AND ISNULL l.settings:variant:color AND ISNULL l.settings:variant:size">
<mvt:foreachcontinue/>
</mvt:if>
<mvt:if expr="miva_array_find( l.settings:variant:code, g.duplicate_ids:array, 1 )">
<mvt:foreachcontinue/>
<mvt:else>
<mvt:assign name="l.index" value="miva_array_insert( g.duplicate_ids:array, l.settings:variant:code, -1 )" />
<mvt:assign name="g.ids_row" value="l.settings:variant:code $ ','" />
<mvt:assign name="l.result" value="file_append( g.google_ids_temp_file_path, 'script', g.ids_row)"/>
</mvt:if>
<mvt:assign name="l.settings:variant:link" value="glosub(l.settings:variant:link, ' ', '')" />
<mvt:assign name="l.settings:variant:link" value="glosub(l.settings:variant:link, g.delimiter, '')" />
<mvt:comment><!-- Write Variant File Row --></mvt:comment>
<mvt:assign name="g.file_row" value="
l.settings:variant:code $ g.delimiter $
l.settings:product:code $ g.delimiter $
l.settings:variant:code $ g.delimiter $
l.settings:product:name $ g.delimiter $
l.settings:product:descrip $ g.delimiter $
l.settings:product:customfield_values:customfields:google_category $ g.delimiter $
l.settings:product:product_type $ g.delimiter $
l.settings:product:general_product_type:trump $ g.delimiter $
l.settings:product:departments $ g.delimiter $
l.settings:variant:link $ g.delimiter $
l.settings:variant:image $ g.delimiter $
l.settings:product:condition $ g.delimiter $
l.settings:variant:availability $ g.delimiter $
l.settings:variant:count_onhand $ g.delimiter $
l.settings:product:customfield_values:customfields:flag $ g.delimiter $
l.settings:variant:price $ g.delimiter $
l.settings:product:brand $ g.delimiter $
l.settings:product:gender $ g.delimiter $
l.settings:product:age_group $ g.delimiter $
l.settings:variant:color $ g.delimiter $
l.settings:variant:size $ g.delimiter $
'v' $ g.delimiter $
g.expiration_date $
g.newline
"/>
<mvt:if expr="g.output EQ 'screen'">
&mvt:global:file_row;
<mvt:else>
<mvt:assign name="g.write_line" value="file_append( g.listrak_temp_file_path, 'script', g.file_row )"/>
<mvt:if expr="l.settings:variant:count_onhand GT 0">
<mvt:assign name="g.write_line" value="file_append( g.google_temp_file_path, 'script', g.file_row )"/>
</mvt:if>
</mvt:if>
</mvt:foreach>
<mvt:assign name="l.settings:product:variants" value="l.settings:variants" />
<mvt:else>
<mvt:comment><!-- Loop Over Attributes (Old Inventory Method) --></mvt:comment>
<mvt:item name="product_attributes" param="product:id" />
<mvt:foreach iterator="attribute" array="attributes">
<mvt:if expr="l.settings:attribute:code EQ 'CUSTOM_BG'">
<mvt:foreachcontinue/>
</mvt:if>
<mvt:if expr="('Add ' CIN l.settings:attribute:prompt) EQ 1 OR '?' CIN l.settings:attribute:prompt OR 'nothanks' CIN l.settings:variant:code OR 'No Thanks' CIN l.settings:variant:code">
<mvt:foreachcontinue/>
</mvt:if>
<mvt:comment><!-- Price for "Best Price" products --></mvt:comment>
<mvt:if expr="l.settings:product:formatted_price EQ 'Best Price'">
<mvt:foreachcontinue/>
<mvt:assign name="l.settings:product:price" value="0" />
</mvt:if>
<mvt:comment><!-- Loop Over Attribute Options --></mvt:comment>
<mvt:foreach iterator="option" array="attribute:options">
<mvt:assign name="l.settings:variant" value="''" />
<mvt:item name="btodattr" param="showQty|l.all_settings:option:code" />
<mvt:assign name="l.settings:option:ems_check_attr" value="g.ems_check_attr" />
<mvt:comment><!-- Skip, if forced out of stock --></mvt:comment>
<mvt:if expr="l.settings:option:ems_check_attr:hide EQ 1 OR NOT l.settings:option:ems_check_attr:quantity OR l.settings:option:ems_check_attr:invprod NE 1">
<mvt:foreachcontinue/>
</mvt:if>
<mvt:comment><!-- Price --></mvt:comment>
<mvt:assign name="l.settings:variant:price" value="l.settings:option:price + l.settings:product:price" />
<mvt:comment><!-- Color --></mvt:comment>
<mvt:if expr="'color' CIN l.settings:attribute:code OR l.settings:attribute:code EQ 'color' OR 'colorsize' CIN l.settings:attribute:code OR l.settings:attribute:code EQ 'jersey_size' OR 'Color_Size' CIN l.settings:attribute:code">
<mvt:assign name="l.settings:option:color" value="l.settings:option:prompt" />
<mvt:if expr="'_' CIN l.settings:option:color">
<mvt:assign name="l.settings:option:color" value="gettoken(l.settings:option:color, '_', 1)" />
</mvt:if>
<mvt:assign name="l.settings:variant:color" value="l.settings:option:color" />
</mvt:if>
<mvt:comment><!-- Size --></mvt:comment>
<mvt:if expr="('size' CIN l.settings:attribute:code OR l.settings:attribute:code EQ 'size' OR 'colorsize' CIN l.settings:attribute:code OR l.settings:attribute:code EQ 'jersey_size' OR 'Color_Size' CIN l.settings:attribute:code) AND NOT( '(' CIN l.settings:option:prompt)">
<mvt:assign name="l.settings:option:size" value="l.settings:option:prompt" />
<mvt:if expr="'_' CIN l.settings:option:size">
<mvt:assign name="l.settings:option:size" value="gettoken(l.settings:option:size, '_', 2)" />
</mvt:if>
<mvt:if expr="' US (' CIN l.settings:option:size">
<mvt:assign name="l.settings:option:size" value="gettoken(l.settings:option:size, ' US (', 1)" />
</mvt:if>
<mvt:if expr="'EU/' CIN l.settings:option:size">
<mvt:assign name="l.settings:option:size" value="glosub(gettoken(l.settings:option:size, 'EU/', 2), 'US', '')" />
</mvt:if>
<mvt:if expr="' EU (' CIN l.settings:option:size">
<mvt:assign name="l.settings:option:size" value="glosub(gettoken(l.settings:option:size, ' EU (', 2), ' US)', '')" />
</mvt:if>
<mvt:if expr="' ($' CIN l.settings:option:size">
<mvt:assign name="l.settings:option:size" value="gettoken(l.settings:option:size, ' ($', 1)" />
</mvt:if>
<mvt:assign name="l.settings:variant:size" value="l.settings:option:size" />
</mvt:if>
<mvt:if expr="l.settings:variant:color">
<mvt:if expr="l.settings:product:color">
<mvt:assign name="l.settings:product:color" value="l.settings:product:color $ ','" />
</mvt:if>
<mvt:assign name="l.settings:product:color" value="l.settings:variant:color" />
<mvt:if expr="ISNULL l.settings:product:color_single">
<mvt:assign name="l.settings:product:color_single" value="l.settings:variant:color" />
</mvt:if>
</mvt:if>
<mvt:if expr="l.settings:variant:size">
<mvt:if expr="l.settings:product:size">
<mvt:assign name="l.settings:product:size" value="l.settings:product:size $ ','" />
</mvt:if>
<mvt:assign name="l.settings:product:size" value="l.settings:variant:size" />
<mvt:if expr="ISNULL l.settings:product:size_single">
<mvt:assign name="l.settings:product:size_single" value="l.settings:variant:size" />
</mvt:if>
</mvt:if>
<mvt:comment><!-- Item Group ID --></mvt:comment>
<mvt:comment>
<!--
<mvt:if expr="miva_array_elements(l.settings:attribute:options) GT 1 AND (l.settings:variant:color OR l.settings:variant:size)">
<mvt:assign name="l.settings:variant:item_group_id" value="l.settings:product:item_group_id" />
<mvt:else>
<mvt:assign name="l.settings:variant:item_group_id" value="''" />
<mvt:assign name="l.settings:product:item_group_id" value="''" />
</mvt:if>
-->
</mvt:comment>
<mvt:comment><!-- Availability --></mvt:comment>
<mvt:assign name="l.settings:variant:count_onhand" value="l.settings:option:ems_check_attr:quantity" />
<mvt:assign name="l.settings:product:count_onhand" value="l.settings:product:count_onhand + l.settings:variant:count_onhand" />
<mvt:if expr="l.settings:option:ems_check_attr:quantity GT 0">
<mvt:assign name="l.settings:variant:availability" value="'in stock'" />
<mvt:else>
<mvt:assign name="l.settings:variant:availability" value="'out of stock'" />
</mvt:if>
<mvt:comment><!-- Misc. Variant Details --></mvt:comment>
<mvt:assign name="l.settings:variant:id" value="l.settings:product:id $ '-' $ l.settings:option:id" />
<mvt:assign name="l.settings:variant:code" value="trim(gettoken(l.settings:option:code, '*', 1))" />
<mvt:if expr="l.settings:option:code">
<mvt:assign name="l.settings:variant:link" value="l.settings:product:link $ '/option/' $ l.settings:option:code" />
</mvt:if>
<mvt:if expr="toupper(l.settings:variant:code) EQ 'SELECT'">
<mvt:foreachcontinue/>
</mvt:if>
<mvt:if expr="'Apparel & Accessories' CIN l.settings:product:customfield_values:customfields:google_category AND ISNULL l.settings:variant:color AND ISNULL l.settings:variant:size">
<mvt:foreachcontinue/>
</mvt:if>
<mvt:if expr="NOT(l.settings:variant:price GT 0)">
<mvt:foreachcontinue/>
</mvt:if>
<mvt:if expr="miva_array_find( l.settings:variant:code, g.duplicate_ids:array, 1 )">
<mvt:foreachcontinue/>
<mvt:else>
<mvt:assign name="l.index" value="miva_array_insert( g.duplicate_ids:array, l.settings:variant:code, -1 )" />
<mvt:assign name="g.ids_row" value="l.settings:variant:code $ ','" />
<mvt:assign name="l.result" value="file_append( g.google_ids_temp_file_path, 'script', g.ids_row)"/>
</mvt:if>
<mvt:assign name="l.settings:variant:link" value="glosub(l.settings:variant:link, ' ', '')" />
<mvt:assign name="l.settings:variant:link" value="glosub(l.settings:variant:link, g.delimiter, '')" />
<mvt:comment><!-- Write Variant File Row --></mvt:comment>
<mvt:assign name="g.file_row" value="
l.settings:variant:code $ g.delimiter $
l.settings:product:code $ g.delimiter $
l.settings:variant:code $ g.delimiter $
l.settings:product:name $ g.delimiter $
l.settings:product:descrip $ g.delimiter $
l.settings:product:customfield_values:customfields:google_category $ g.delimiter $
l.settings:product:product_type $ g.delimiter $
l.settings:product:general_product_type:trump $ g.delimiter $
l.settings:product:departments $ g.delimiter $
l.settings:variant:link $ g.delimiter $
l.settings:product:image $ g.delimiter $
l.settings:product:condition $ g.delimiter $
l.settings:variant:availability $ g.delimiter $
l.settings:variant:count_onhand $ g.delimiter $
l.settings:product:customfield_values:customfields:flag $ g.delimiter $
l.settings:variant:price $ g.delimiter $
l.settings:product:brand $ g.delimiter $
l.settings:product:gender $ g.delimiter $
l.settings:product:age_group $ g.delimiter $
l.settings:variant:color $ g.delimiter $
l.settings:variant:size $ g.delimiter $
'v' $ g.delimiter $
g.expiration_date $
g.newline
"/>
<mvt:if expr="g.output EQ 'screen'">
&mvt:global:file_row;
<mvt:else>
<mvt:assign name="g.write_line" value="file_append( g.listrak_temp_file_path, 'script', g.file_row )"/>
<mvt:if expr="l.settings:variant:count_onhand GT 0">
<mvt:assign name="g.write_line" value="file_append( g.google_temp_file_path, 'script', g.file_row )"/>
</mvt:if>
</mvt:if>
</mvt:foreach>
</mvt:foreach>
<mvt:assign name="l.settings:product:attributes" value="l.settings:attributes" />
</mvt:if>
<mvt:if expr="l.settings:product:count_onhand GT 0">
<mvt:assign name="l.settings:product:availability" value="'in stock'" />
<mvt:else>
<mvt:assign name="l.settings:product:availability" value="'out of stock'" />
</mvt:if>
<mvt:if expr="NOT(l.settings:product:price GT 0)">
<mvt:foreachcontinue/>
</mvt:if>
<mvt:if expr="'Apparel & Accessories' CIN l.settings:product:customfield_values:customfields:google_category AND ISNULL l.settings:product:color_single AND ISNULL l.settings:product:size_single">
<mvt:foreachcontinue/>
</mvt:if>
<mvt:comment><!-- Write Master Product File Row --></mvt:comment>
<mvt:assign name="g.file_row" value="
l.settings:product:code $ g.delimiter $
l.settings:product:code $ g.delimiter $
l.settings:product:code $ g.delimiter $
l.settings:product:name $ g.delimiter $
l.settings:product:descrip $ g.delimiter $
l.settings:product:customfield_values:customfields:google_category $ g.delimiter $
l.settings:product:product_type $ g.delimiter $
l.settings:product:general_product_type:trump $ g.delimiter $
l.settings:product:departments $ g.delimiter $
l.settings:product:link $ g.delimiter $
l.settings:product:image $ g.delimiter $
l.settings:product:condition $ g.delimiter $
l.settings:product:availability $ g.delimiter $
l.settings:product:count_onhand $ g.delimiter $
l.settings:product:customfield_values:customfields:flag $ g.delimiter $
l.settings:product:price $ g.delimiter $
l.settings:product:brand $ g.delimiter $
l.settings:product:gender $ g.delimiter $
l.settings:product:age_group $ g.delimiter $
l.settings:product:color_single $ g.delimiter $
l.settings:product:size_single $ g.delimiter $
'm' $ g.delimiter $
g.expiration_date $
g.newline
"/>
<mvt:if expr="g.output EQ 'screen'">
&mvt:global:file_row;
<mvt:elseif expr="g.output EQ 'debug'">
<mvt:eval expr="decodeattribute(glosub(miva_array_serialize(l.settings:product), ',', '<br>'))" />
<hr>
<mvt:else>
<mvt:assign name="g.write_line" value="file_append( g.listrak_temp_file_path, 'script', g.file_row )"/>
</mvt:if>
</mvt:foreach>
<mvt:comment><!-- Pagination/Response --></mvt:comment>
<mvt:assign name="g.current_url" value="'http://' $ g.domain:name $ '/cs/feed-google-merchant?continue=' $ g.continue $ '&auth=' $ g.auth $ '&output=' $ g.output $ '&AllOffset=' $ g.AllOffset $ '&Per_Page=' $ g.Per_Page $ '&Product_Code=' $ g.Product_Code" />
<mvt:assign name="g.next_url" value="'http://' $ g.domain:name $ '/cs/feed-google-merchant?continue=' $ g.continue $ '&auth=' $ g.auth $ '&output=' $ g.output $ '&AllOffset=' $ g.AllNextOffset $ '&Per_Page=' $ g.Per_Page $ '&Product_Code=' $ g.Product_Code" />
<mvt:if expr="g.Exit">
<a href="&mvt:global:current_url;">&mvt:global:current_url;</a><br>
<a href="http://www.example.com&mvt:global:file_path;&mvt:global:file_name;">&mvte:global:file_name;</a><br>
<mvt:elseif expr="l.settings:all_products:page_links:current_page EQ l.settings:all_products:page_links:last_page">
Complete
<mvt:comment><!-- Rename Final File - Google --></mvt:comment>
<mvt:if expr="sexists(g.google_temp_file_path)">
<mvt:assign name="l.result" value="srename(g.google_temp_file_path, g.google_final_file_path)"/>
</mvt:if>
<mvt:if expr="sexists(g.google_ids_temp_file_path)">
<mvt:assign name="l.result" value="sdelete(g.google_ids_temp_file_path)"/>
</mvt:if>
<mvt:comment><!-- Rename Final File - Listrak --></mvt:comment>
<mvt:if expr="sexists(g.listrak_temp_file_path)">
<mvt:assign name="l.result" value="srename(g.listrak_temp_file_path, g.listrak_final_file_path)"/>
</mvt:if>
<mvt:else>
<mvt:if expr="g.AllNextOffset GT 0 AND ISNULL g.Exit">
Continue|&mvt:global:AllNextOffset;
<mvt:if expr="g.continue EQ 'redirect'">
<mvt:assign name="l.header" value="miva_output_header( 'Status', '301 Moved Permanently' )" />
<mvt:assign name="l.header" value="miva_output_header( 'Location', g.next_url )" />
<mvt:elseif expr="g.continue EQ 'refresh'">
<meta http-equiv="refresh" content="0;URL='&mvte:global:next_url;'" />
</mvt:if>
<mvt:else>
Complete
</mvt:if>
</mvt:if>
以上是关于html Miva - Google和Listrak数据Feed的主要内容,如果未能解决你的问题,请参考以下文章
html Miva Google Shopping Feed