Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Miva - Product Category Breadcrumb Trail Text
<mvt:comment>
Create Breadcrumb Trails for a Product
------------------------------------------------
SAMPLE OUTPUT:
Apparel > Shirts > Long-Sleeve|Brands > Nike > Shirts|Seasonal > Winter > Shirts
LOGIC:
Loads all categories from a `l.settings:product:id`
Loops over each of the product's assign categories
Loads each category's "Category Cascade List" (an array of the category's parent categories / breadcrumb-trail-categories)
Concatenates the necessary strings for each "Category Cascade List" and assigned-category.
</mvt:comment>
<mvt:do name="l.result" file="g.Module_Library_DB" value="CategoryList_Load_Offset_Product_Assigned(l.settings:product:id,0,'','',0,l.null, l.settings:product:categories )" />
<mvt:foreach iterator="category" array="product:categories">
<mvt:assign name="l.breadcrumb" value="''" />
<mvt:do file="g.Module_Root $ '/modules/component/cmp-mv-prodctgy-meta.mvc'" name="l.success" value="CategoryCascadeList_Load_Category( l.settings:category, l.settings:category:cascade_list )" />
<mvt:foreach iterator="cascade_category" array="category:cascade_list">
<mvt:if expr="l.breadcrumb">
<mvt:assign name="l.breadcrumb" value="l.breadcrumb $ '>'" />
</mvt:if>
<mvt:assign name="l.breadcrumb" value="l.breadcrumb $ l.settings:cascade_category:name" />
</mvt:foreach>
<mvt:if expr="l.settings:product:breadcrumbs">
<mvt:assign name="l.settings:product:breadcrumbs" value="l.settings:product:breadcrumbs $ '|'" />
</mvt:if>
<mvt:assign name="l.settings:product:breadcrumbs" value="l.settings:product:breadcrumbs $ l.breadcrumb" />
</mvt:foreach>
&mvt:record:code;,&mvt:record:name;,&mvt:record:price;,<mvt:if expr="l.settings:record:customfield:main">&mvte:global:domain:base_surl;&mvt:record:customfield:main;</mvt:if>,&mvt:record:url;,&mvt:record:descrip;,&mvt:record:breadcrumbs;,&mvt:record:customfield:item_manufacturer;&mvt:eol:crlf;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment