bheyde
5/13/2016 - 11:52 PM

Feed Customization Examples

Feed Customization Examples

//load a specific sized image to include in feed

<mvt:assign name="l.constraints[1]:height" value="600" />
<mvt:assign name="l.constraints[1]:width" value="600" />
<mvt:assign name="l.imagetype_codes[1]" value="'main'" />

<mvt:assign name="l.constraints_count" value="miva_array_elements( l.constraints )" />
<mvt:assign name="l.imagetypecode_count" value="miva_array_elements( l.imagetype_codes )" />

<mvt:do file="g.Module_Library_DB" name="l.imagedata_count" value="ProductImageDataList_Load_Product_TypeCodes_Constrained(1, l.imagetype_codes, l.imagetypecode_count , l.constraints,l.constraints_count,l.settings:productimagedatalist)" />


<mvt:if expr="ISNULL l.settings:productimagedatalist[1]:generatedimages[1]:image">
	<mvt:do file="g.Module_Library_DB" name="l.ok" value="GeneratedImage_FindOrInsert_Image_Dimensions( l.settings:productimagedatalist[1]:image, l.constraints[1]:width, l.constraints[1]:height, l.settings:generatedimage )" />
	&mvt:generatedimage:image;
<mvt:else>
	&mvt:productimagedatalist[1]:generatedimages[1]:image;
</mvt:if>
//call external url when feed is complete. Put this code in the Feed Footer so it get
//called after the feed iterator is finished.

<mvt:comment>Make a call to external URL notifying feed is complete</mvt:comment>
<mvt:assign name="l.url" value="'http://www.google.com'" />
<mvt:call action="l.url" method="'GET'">
</mvt:call>
//Loading a list of all categories a product is assigned to. Include them as a pipe seperate list

<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:foreach iterator="category" array="global:assigned_categories">
		<mvt:assign name="g.category_list" value="g.category_list $ l.settings:category:name $ '|'" />             
	</mvt:foreach>

	<mvt:assign name="g.category_list" value="substring( g.category_list, 1, len( g.category_list )-1 )" />
	<mvt:assign name="g.category_list" value="miva_csv_encode( g.category_list, '|' )" />
	
</mvt:if>

Output: &mvt:global:category_list;