Last active
August 7, 2020 19:38
-
-
Save jasonandmonte/857f06d424c136045124dfe2de241591 to your computer and use it in GitHub Desktop.
Miva feed iterator template with product attributes and categories.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<mvt:comment> | |
| Lookup Categories each product is assigned to and output them as a single | |
| pipe (|) seperated list | |
</mvt:comment> | |
<mvt:assign name="g.assigned_categories" value="''" /> | |
<mvt:assign name="g.category_list" value="''" /> | |
<mvt:do name="l.result" file="g.Module_Library_DB" value="CategoryList_Load_Offset_Product_Assigned(l.settings:record:id,0,'','',0,l.null, g.assigned_categories )" /> | |
<mvt:if expr="NOT ISNULL g.assigned_categories"> | |
<mvt:assign name="g.category_list" value="''" /> | |
<mvt:foreach iterator="category" array="global:assigned_categories"> | |
<mvt:assign name="g.category_list" value="g.category_list $ l.settings:category:name $ '|'" /> | |
</mvt:foreach> | |
<mvt:comment>Clear trailing pipe '|'</mvt:comment> | |
<mvt:assign name="g.category_list" value="substring( g.category_list, 1, len( g.category_list )-1 )" /> | |
<mvt:comment>Manage csv parsing issue by removing commas from string</mvt:comment> | |
<mvt:assign name="g.category_list" value="glosub(g.category_list, ',', ' ' )" /> | |
<mvt:assign name="g.category_list" value="miva_csv_encode( g.category_list, '|' )" /> | |
</mvt:if> | |
<mvt:comment> | |
| CATEGORY LIST OUTPUT | |
</mvt:comment> | |
&mvt:global:category_list;, | |
<mvt:comment> | |
| Product Attributes --> Options Access | |
</mvt:comment> | |
<mvt:do file="g.Module_Library_DB" name="l.success" value="AttributeList_Load_Product(l.settings:record:id, l.settings:record:attributes)" /> | |
<mvt:assign name="g.attribute_data" value="l.settings:record:attributes" /> | |
<mvt:comment>Options Row Records code,prompt,image,type,etc.</mvt:comment> | |
<mvt:assign name="g.option_list" value="''" /> | |
<mvt:foreach iterator="attribute" array="record:attributes"> | |
<mvt:do file="g.Module_Library_DB" name="l.success" value="OptionList_Load_Attribute( l.settings:attribute:id, l.settings:attribute:options )" /> | |
<mvt:assign name="g.option_list" value="l.settings:attribute:options" /> | |
</mvt:foreach> | |
<mvt:comment>Option Prompt Values</mvt:comment> | |
<mvt:assign name="g.option_titles" value="''" /> | |
<mvt:foreach iterator="option" array="attribute:options"> | |
<mvt:assign name="g.option_titles" value="g.option_titles $ l.settings:option:prompt $ '|'" /> | |
</mvt:foreach> | |
<mvt:assign name="g.option_titles" value="substring( g.option_titles, 1, len( g.option_titles )-1 )" /> | |
<mvt:assign name="g.option_titles" value="miva_csv_encode( g.option_titles, '|')" /> | |
<mvt:comment> | |
| ATTRIBUTE OPTIONS OUTPUT | |
</mvt:comment> | |
&mvt:global:option_titles;, | |
<mvt:comment> | |
| Product Shipping Methods | |
</mvt:comment> | |
<mvt:do file="g.Module_Feature_SHP_DB" name="l.success" value="ProductShippingMethodList_Load_Product(l.settings:record:id, l.settings:record:shippingmethods)" /> | |
<mvt:assign name="g.ship_methods" value="''" /> | |
<mvt:foreach iterator="method" array="record:shippingmethods"> | |
<mvt:assign name="g.ship_methods" value="g.ship_methods $ l.settings:method:meth_code $ '|'" /> | |
</mvt:foreach> | |
<mvt:assign name="g.ship_methods" value="substring( g.ship_methods, 1, len( g.ship_methods )-1 )" /> | |
<mvt:assign name="g.ship_methods" value="miva_csv_encode( g.ship_methods, '|')" /> | |
<mvt:comment> | |
| PRODUCT SHIPPING METHODS OUTPUT | |
</mvt:comment> | |
&mvt:global:ship_methods;, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment