vassign
<mvt:assign name="g.var" value="l.settings:product:code" />
sassign
<mvt:assign name="g.var" value=" 'hello world' " />
concat
<mvt:assign name="g.var" value=" 'The product code is: ' $ l.settings:product:code" />
Addition
<mvt:assign name="g.sum" value="10 + 10" />
<mvt:comment>
g.sum = 20
</mvt:comment>
&mvt:global:sum;
Subtraction
<mvt:assign name="g.difference" value="10 - 7" /> // g.difference = 3 <mvt:eval expr=" (5+7) + 8 "/> //outputs 20
Multiplication and Division
<mvt:assign name="g.product" value="(5*5) + 10" /> //g.product = 35 <mvt:assign name="g.var" value="(8/4)" />
<mvt:comment>
g.var = 2
</mvt:comment>
<mvt:do name="l.result" file="g.Module_Root $ g.Store:currncy_mod:module" value="CurrencyModule_AddFormatting( g.Store:currncy_mod, 1.25 )" />
vproduct_find
<mvt:do name="l.return" file="g.Module_Library_DB" value="Product_Load_Code( g.Product_Code, l.settings:product )" /> &mvte:product:name; &mvt:product:price;
render
<mvt:do name="l.result" file="g.Module_Feature_TUI_MGR" value="TemplateManager_Render_Page( 'ABUS' )" />
Custom field Read
<mvt:item name="customfields" param="Read_Product_Code( 'product_code', 'custom_field_code', l.settings:customfields )" />
Custom Field Write
<mvt:item name="customfields" param="Write_Product_Code( 'product_code', 'custom_field_code', 'value' )" />
All Custom Field Functions
<mvt:do name="l.result" file="g.Module_Library_DB" value="Category_Load_Code( 'category_code', l.settings:current_category )" />
Load Category
<mvt:do name="l.result" file="g.Module_Library_DB" value="Category_Load_Code( 'category_code', l.settings:current_category )" />
Parent Category / childof
<mvt:do name="l.result" file="g.Module_Library_DB" value="Category_Load_Code( 'category_code', l.settings:current_category )" />
<mvt:do name="l.result" file="g.Module_Library_DB" value="Category_Load_ID( l.settings:current_category:parent_id, l.settings:parent_category )" />
subcat
<mvt:comment>
load current category data
</mvt:comment
>
<mvt:do name="l.result" file="g.Module_Library_DB" value="Category_Load_Code( g.Category_Code, l.settings:current_category )" />
<mvt:do name="l.result" file="g.Module_Library_DB" value="CategoryList_Load_Parent( l.settings:current_category:id, l.settings:sub_categories )" />
<mvt:foreach iterator="subcat" array="sub_categories">
&mvt:subcat:active;
&mvt:subcat:agrpcount;
&mvt:subcat:code;
&mvt:subcat:disp_order;
&mvt:subcat:id;
&mvt:subcat:name;
&mvt:subcat:parent_id;
</mvt:foreach>
parentcat
<mvt:comment>
load all categories with no parent i.e. all top level categories
</mvt:comment>
<mvt:do name="l.result" file="g.Module_Library_DB" value="CategoryList_Load_Parent( '', l.settings:parent_categories )" />
<mvt:foreach iterator="parent" array="parent_categories">
&mvt:parent:code;<br>
</mvt:foreach>
setcookie
<mvt:comment>
unix timestamp for expiration date
</mvt:comment
>
<mvt:assign name="g.expires" value="s.time_t + (60 * 60 * 24 * 5)" /> // 5 days from today
<mvt:assign name="g.cookie_name" value="'mycookie'" />
<mvt:assign name="g.cookie_value" value="'hello world'" />
<mvt:do file="g.module_library_utilities" name="g.null" value="SetCookie(g.Output_Cookies, g.cookie_name, g.cookie_value , g.cookiedomain , g.expires, g.cookiepath, 0 )" />
<mvt:do file="g.module_library_utilities" name="g.null" value="OutputCookies( g.Output_Cookies )" />
smtp
<mvt:do file="g.module_library_utilities" name="g.email_sent" value="SendEmail(g.to_email,g.from_email,'',g.subject,'',g.message)" />
sexists
<mvt:comment>
check to see if a file exists on the server
</mvt:comment
>
<mvt:assign name="g.file_found" value="sexists( '/mm5/images/image.jpg' )" />
<mvt:if expr="g.file_found EQ 1">
File Found!
<mvt:else>
File Not Found!
</mvt:if>
cxp
<mvt:comment>
load all products assigned to a specific category
</mvt:comment>
<mvt:do name="l.result" file="g.Module_Library_DB" value="Category_Load_Code( 'category_code', l.settings:current_category )" />
<mvt:do name="l.result" file="g.Module_Library_DB" value="Runtime_ProductList_Load_Offset_Category( l.settings:current_category:id, g.Offset, 100, g.NextOffset, l.settings:products )" />
<mvt:foreach iterator="product" array="products">
&mvt:product:code;<br>
</mvt:foreach>
vacreate / sacreate
<mvt:comment>
create an array from a comma separate list of elements
</mvt:comment>
<mvt:assign name="g.list" value="'apples,oranges,bananas,grapes'" />
<mvt:assign name="l.count" value="1" />
<mvt:assign name="l.token" value="gettoken(g.list, ',' , l.count)" />
<mvt:while expr="NOT ISNULL l.token">
<mvt:assign name="l.array_length" value="miva_array_insert( l.settings:my_array, l.token, -1 )" />
<mvt:assign name="l.count" value="l.count + 1" />
<mvt:assign name="l.token" value="gettoken(g.list, ',' , l.count)" />
</mvt:while>
<mvt:foreach iterator="array_element" array="my_array">
&mvt:array_element;<br>
</mvt:foreach>
callurl
<mvt:call ACTION="'http://www.domain.com/page.html?parameter=abc'" METHOD="'GET'">
<mvt:eval expr = "s.callvalue " />
</mvt:call>
Load Product Images
<mvt:do name="l.image_count" file="g.Module_Library_DB" value="ProductImageDataList_Load_Product(l.settings:product:id, l.settings:imagedata)" />
<mvt:foreach iterator="data" array="imagedata">
Image Data:<br>
&mvt:data:image:id;<br>
&mvt:data:image:height;<br>
&mvt:data:image:width;<br>
&mvt:data:image:image;<br>
&mvt:data:image:refcount;<br>
ImageType Data:<br>
&mvt:data:imagetype:code;<br>
&mvt:data:imagetype:descrip;<br>
</mvt:foreach>
Load Single Image From ImageType
<mvt:do name="l.success" file="g.Module_Library_DB" value="ProductImage_Load_Type(l.settings:product:id, 1, l.settings:imagetype)" />
<mvt:do name="l.success" file="g.Module_Library_DB" value="Image_Load_ID(l.settings:imagetype:image_id, l.settings:imagedata)" />
<mvt:assign name="g.socialImage" value="g.baseurl $ l.settings:imagedata:image" />
Load Canonical URI
<mvt:assign name="l.uri:store_id" value="g.Store:id" />
<mvt:assign name="l.uri:screen" value="''" />
<mvt:assign name="l.uri:page_id" value="0" />
<mvt:assign name="l.uri:cat_id" value="0" />
<mvt:assign name="l.uri:product_id" value="1" />
<mvt:do file="g.Module_Feature_URI_DB" name="l.have_uri" value="URI_Load_Item_Canonical( l.uri, l.settings:canonical_uri )" />
<mvt:if expr="l.have_uri">
&mvt:canonical_uri:canonical; <br>
&mvt:canonical_uri:cat_id;<br>
&mvt:canonical_uri:page_id;<br>
&mvt:canonical_uri:status;<br>
&mvt:canonical_uri:store_id;<br>
&mvt:canonical_uri:uri;<br>
</mvt:if>
Load All Categories
<mvt:do name="l.settings:category_count" file="g.Module_Library_DB" value="Runtime_CategoryList_Load_All( l.settings:categories )" />
<mvt:foreach iterator="category" array="categories">
&mvt:category:code;<br>
&mvt:category:name;<br>
</mvt:foreach>
Load Assigned Categories For Product
<mvt:do name="l.result" file="g.Module_Library_DB" value="CategoryList_Load_Offset_Product_Assigned(l.settings:product:id,0,'','',0,l.null, g.assigned_categories )" />
<mvt:foreach iterator="category" array="global:assigned_categories">
&mvt:category:active;<br>
&mvt:category:code;<br>
&mvt:category:id;<br>
&mvt:category:name;<br>
</mvt:foreach>
Display Predicted Discount Price
<mvt:comment>
Load a few sample products from category backpacks
</mvt:comment>
<mvt:do name="l.result" file="g.Module_Library_DB" value="Category_Load_Code( 'backpacks', l.settings:current_category )" />
<mvt:do name="l.result" file="g.Module_Library_DB" value="Runtime_ProductList_Load_Offset_Category( l.settings:current_category:id, g.Offset, 100, g.NextOffset, l.settings:products )" />
<mvt:comment>
pass array of products into function. price and formatted_price get replaced in products structure with the predicted discounted price.
This will only work on product level discounts.
</mvt:comment>
<mvt:assign name="g.product_count" value="miva_array_elements( l.settings:products )" />
<mvt:do name="l.success" file="g.module_feature_tui_ut" value="CommonComponentFields_Initialize_Product_Discounts_Runtime( l.settings:products, g.product_count )" />
<mvt:foreach iterator="product" array="products">
Product Code: &mvt:product:code;<br>
Discount Count: &mvt:product:discount_count;<br>
Formatted Price: &mvt:product:formatted_price;<br>
<mvt:foreach iterator="discount" array="product:discounts">
Description:&mvt:discount:descrip;<br>
Discount: &mvt:discount:discount;<br>
Formatted Discount: &mvt:discount:formatted_discount;<br>
</mvt:foreach>
<br>
</mvt:foreach>
Load Master Product, Based on Variant Part Code/ID
<mvt:comment>
lookup product:id based of a variant product code
</mvt:comment>
<mvt:do name="l.success" file="g.Module_Library_DB" value="Product_Load_Code( 'shirt_large_blue', l.settings:product )" />
<mvt:comment>
lookup variant information about that product id
</mvt:comment>
<mvt:do name="l.productvariantpart_count" file="g.Module_Library_DB" value="ProductVariantPartList_Load_Part(l.settings:product:id, l.settings:productvariantparts)" />
<mvt:foreach iterator="part" array="productvariantparts">
Part ID: &mvt:part:part_id;<br>
Master Product ID: &mvt:part:product_id; <br>
Quantity: &mvt:part:quantity; <br>
Variant Id: &mvt:part:variant_id;<br>
</mvt:foreach>
<br>
<mvt:comment>
lookup master product information
</mvt:comment>
<mvt:do name="l.success" file="g.Module_Library_DB" value="Product_Load_ID( l.settings:productvariantparts[1]:product_id, l.settings:product )" />
&mvt:product:name;<br>
&mvt:product:code;<br>
&mvt:product:formatted_price;<br>
<mvt:comment>
Array
</mvt:comment>
<mvt:assign name="l.people[1]" value="'Rick'" />
<mvt:assign name="l.people[2]" value="'Philp'" />
<mvt:assign name="l.people[3]" value="'Nathan'" />
<mvt:assign name="l.people[4]" value="'Russ'" />
<mvt:assign name="l.people[5]" value="'Wayne'" />
<mvt:assign name="l.settings:people" value="l.people" />
<mvt:foreach iterator = "person" array = "people" >
&mvt:person;<br>
</mvt:foreach>
<mvt:assign name="g.count" value="miva_array_elements(l.people)" />
&mvte:global:count;
<mvt:comment>
A structure which contains an array, which contains a structure
l.settings:people[1]:info:name;
l.settings:people[1]:info:birthday;
l.settings:people[1]:info:address;
</mvt:comment>
&mvt:people[1]:info:name;