Store Utility Settings


Items and Functions

Page Templates included in the zip file.

  • CONTACT.txt -- Contact Us Email Form and installation instructions.
  • DELETE_BASKETS.txt -- Demonstrates how to automatically delete expired baskets twice a day.
  • FEATURED.txt -- Featured Products main template and installation instructions.
  • FEATURED_layout.txt -- Featured Products 3 column layout.
  • LOOKUP_LOGIN.txt -- Used with the Lookup|Login item to email a customer their Login name.
  • MINI.txt -- MINI basket template and instructions.
  • NOIE6.txt -- Notifies IE6 users that they need an updated browser. Provides images and links to major browsers.
  • NTFD_with301_redirects.txt -- Demonstrates how to do 301 category redirects withing the NTFD page.
  • PASSWORD.txt -- Demonstrates how to password protect a Storemorph page.
  • RANDP_v.txt -- Random Product template; (verticle layout). and instructions.
  • SEOLINKS_Demo.txt -- Demonstrates usethe of the SeoLiks and SeoLink items to create dynamic short links.
  • SESSIONS.txt -- Demonstrates a complete password protected application using session cookies.
  • TELL.mvt -- Tell a Friend form. Email a link to a product or category page to your friends
  • TELL_Docs.txt -- Instructions for Tell a Friend.
  • TELLSEND.mvt -- Tell a Friend send-email script. Study this script to learn how to use pages to send email and write subroutines.
Back to Top

Assign

Read Me First

Assigns expression results to the variable; where varname could be any array, global, or local variable name and expression contains any valid MivaScript expression and/or functions. Most MivaScript functions are included in the Script Builder below, but this does not represent all possible combinations.

Variable names start with g. for global variables and l.all_settings for local variables. Variable name can contain letters, numbers, the characters period and underscore.

Expressions can consist of numbers ( 3.1416 ), string literals enclosed in single quotes ( 'Music' ), operators (e.g. /, *, +, -, $, IN, CIN, EIN, ECIN, AND, OR, NOT, EQ, NE, GE, LE, LT, GT, ROUND, CRYPT, MOD, SUBSTR, POW), as well as nested MivaScript . Most expressions that can be compiled by the MivaScript compiler can be evaluated here.

Arrays can be assigned using a variable as the index For example assign|l.all_settings:products[g.ndx]:shortname|substring(l.all_settings:products[g.ndx]:name,1,10)

Variables by Reference using { }: Given a string that contains a variable name, You can assign a value to the variable contained in the string. This allows you to create variable names dynamically.

Special Characters: Several characters can not be evaluated directly, due to limitation of the page template compiler. These include:
Double Quotes: " = = asciichar(34)
Ampersand: & = asciichar(38)
Pipe: | = asciichar(124)

<mvt:item name="ry_toolbelt" param="assign|g.varname|expression" />;
Examples 1, Simple Expressions:

<mvt:item name="ry_toolbelt" param="assign|g.markup|g.price + 20.99"" />;
  
Example 2, Nested MivaScript functions:
<mvt:item name="ry_toolbelt" param="assign|g.cat|tolower(glosub(l.all_settings:product:code,'-',''))" />;

<mvt:item name="ry_toolbelt" param="assign|g.imagefile|'/mm5/images/' $ g.cat $ '.jpg'" />;
<mvt:item name="ry_toolbelt" param="assign|g.found|sexist(g.imagefile)" />;
  
Example 3, Array assignment:
Array indexes can be numbers [1] or variables like [g.counter] or [l.all_settings:counter]
<mvt:item name="ry_toolbelt" param="assign|l.all_settings:MyArray[1]:code|'123456'" />

  
<mvt:item name="ry_toolbelt" param="assign|g.ndx|g.ndx + 1" />
<mvt:item name="ry_toolbelt" param="assign|l.all_settings:MyArray[g.ndx]:code|'abc123'" />

  
output: #&mvt:global:ndx; = &mvt:MyArray[1]:code; displays #1 = abc123
  
Example 4, Advanced, Build your own variable names, structures and arrays:
Notice the {   } characters.
<mvt:item name="ry_toolbelt" param="assign|g.name|'fieldname'" />;

<mvt:item name="ry_toolbelt" param="assign|g.varname|'l.all_settings:mydata:' $ g.name" />;
<mvt:item name="ry_toolbelt" param="assign|{ g.varname }|'PCInet' $ '.com'" />;
  
output: &mvt:mydata:fieldname; displays PCInet.com

Script Builder: function description:
 

item: (copy and paste this value)
Back to Top

Additional Functions

Function Examples These are new low level functions added to the language not available in Mivascript. Then can be used in any Toolbelt expression alone or combined with other functions just like other MivaScript functions. These include:

Body_innerHTML() Capitalize() Compress() EncodeHtml() DecodeHtml() GettokenCount() Hardbreak() isAlphaNumPlus() isEmail() isURL() Left() NumberFormat() PercentFormat() RemoveChars() Replace() Right() StripHTML() Table_Exists() Varlist()

Body_innerHTML(string_expr)
<mvt:item name="ry_toolbelt" param="assign|g.page|file_read(index.htm, 'script', g.sfnt)" />

<mvt:item name="ry_toolbelt" param="eval|Body_innerHTML(g.sfnt)" />
After reading a webpage into a string using the Call or Screen commands; or the fileread() function,
this function returns the portion of the page between the <body> tag.
  
Capitalize(string_expr, char_separator)
<mvt:item name="ry_toolbelt" param="assign|g.result|Capitalize(g.string, g.separator)" />

Capitalizes each word in a string or list.
  
Compress(string_expr)
<mvt:item name="ry_toolbelt" param="assign|g.result|Compress(g.string)" />
Returns string after removing tabs, leading and trailing spaces and blank lines.
  
EncodeHtml(string_expr)
<mvt:item name="ry_toolbelt" param="assign|g.eString|EncodeHtml('Home')" />

&mvt:global:eString; outputs &#72;&#111;&#109;&#101;
Encodes each character in a string as &#nnn; where nnn is the ascii character code.
  
DecodeHtml(string_expr)
<mvt:item name="ry_toolbelt" param="assign|g.eString|DecodeHtml('&#72;&#111;&#109;&#101;')" />

&mvt:global:eString; outputs Home
Reverses EncodeHtml(); Decodes each html character string &#nnn; where nnn is the ascii character code.
  
HardBreak(string_expr)
This function converts every space in a string (i.e. ascii char 32) into a breag tag <br>
  
isAlphaNumPlus(string_expr, string_extrachars) Returns true (1) if all characters in string are either
alphabetic, digits, or one of the extra characters. This is useful if you must validate a string
that may also contain specific characters e.g. spaces, periods, commas or other punctuation.
<mvt:item name="ry_toolbelt" param="assign|g.IsValid|isAlphaNumPlus(g.List, ' .')" />

Return 1 if the string contains letters, number spaces and periods.
  
isEmail(string_expr)
<mvt:item name="ry_toolbelt" param="assign|g.IsValid|isEmail(g.email_address)" />
Return 1 if a valid formatted email address string is found else returns 0.
  
isURL(string_expr)
<mvt:item name="ry_toolbelt" param="assign|g.IsValid|isURL(g.web_address)" />

Return 1 if a valid web address string is found else returns 0. Does not confirm the address.
  
GettokenCount(string_expr)
<mvt:item name="ry_toolbelt" param="assign|g.count|gettoken_count(g.string, g.separator)" />
Returns the number of items (tokens) in a separated list. For example:
Number of items in a comma separated list: gettoken_count(g.CSVstring, ',')
Number if lines in a text file: gettoken_count(g.datafile, asciichar(10))
  
Left(string_expr, [number or search_string])
<mvt:item name="ry_toolbelt" param="assign|g.result|Left(g.string, g.number OR 'search_string')" />

Returns the left portion of g.string up to the number of characters OR first occurrence of search_string;
must be an exact match.
  
NumberFormat(numeric_expression, decimal_places)
<mvt:item name="ry_toolbelt" param="assign|g.population|NumberFormat(g.budget, 2)" />
Returns the number formally formatted (e.g. 307006550.796 becomes 307,006,550.80)
  
PercentFormat(numeric_expression, decimal_places)
<mvt:item name="ry_toolbelt" param="assign|g.markupPF|PercentFormat(g.markup, 0)>" />

Returns the number as a percent (e.g. 0.1551 becomes 15.51%)
  
Replace(string_expr, search_string, replace_string, g.startPosition)
<mvt:item name="ry_toolbelt" param="assign|g.result|Replace(g.string, g.search, g.replace, g.start)" />
Replace some characters with other characters in a string. g.startPosition MUST be a variable
(defaults to 1) and will be returned containing the next character position after the replace.
  
RemoveChars(source_string_expr, g.remove_chars_string)
<mvt:item name="ry_toolbelt" param="assign|g.phone|RemoveChars(l.all_settings:ship_phone, '( )-.,')" />

Returns the source string with each character in the list removed.
The example strips all formatting characters from a phone number. Right(string_expr, [number or search_string]) <mvt:item name="ry_toolbelt" param="assign|g.result|Right(g.string, g.number OR 'search_string')" /> Returns the right portion of g.string up to the number of characters OR last occurrence of search_string; must be an exact match. <mvt:item name="ry_toolbelt" param="assign|g.return|StripHTML(g.string)" /> Returns a string with all html stripped out. Striphtml(string_expr) <mvt:item name="ry_toolbelt" param="assign|g.result|Striphtml(g.string)" /> This function returns string with all html stripped out. Table_Exists(string_tablename) <mvt:item name="ry_toolbelt" param="assign|g.found|Table_Exists(g.mysql_tablename)" /> Return 1 if the mysql_tablename is found else returns 0. Varlist(scope, string_filter OR '', l.all_settings) <mvt:item name="ry_toolbelt" param="eval|Varlist(scope, filter, l.all_settings)" /> Like the Varlist item, this debugging function returns a sorted Report listing global, system or local variable names, entity expressions, and values. It provides the filter parameter to limit the output. By using assign instead of eval, you can take snapshots of data structures for later display. Scope: Must contain 'g', 'l', or 's' for global, local, or system variables. String filter: can contain a null string or a value indicating which variables you wish to return. l.all_settings: is required.
Back to Top

Array_Elements

This item returns a number of elements in an array.

<mvt:item name="ry_toolbelt" param="Array_Elements|g.length|array" />
  
Example:
<mvt:item name="ry_toolbelt" param="Array_Elements|g.length|l.all_settings:products" />

<mvt:if expr="g.length">
  (&mvt:global:length;) Products found
</mvt:if>
Back to Top

Availgroup

Description and Examples These fourteen items provide you with all the tools you need to manage customers, categories and products in availability groups. 

<mvt:item name="ry_toolbelt" param="availgroup|Load_All|g.count" />
<mvt:item name="ry_toolbelt" param="availgroup|Load_Name|g.pg_found|prgp_name_or_csv_list" />

 
<mvt:item name="ry_toolbelt" param="availgroup|Customer_Groups|g.count" />
<mvt:item name="ry_toolbelt" param="availgroup|Customer_Find|g.found|avgp_name_exprsn" />

<mvt:item name="ry_toolbelt" param="availgroup|Customer_Insert|g.result|avgp_name_exprsn" />
<mvt:item name="ry_toolbelt" param="availgroup|Customer_Delete|g.result|avgp_name_exprsn" />
 

<mvt:item name="ry_toolbelt" param="availgroup|Product_Groups|g.count|product_code_exprsn" />
<mvt:item name="ry_toolbelt" param="availgroup|Product_Find|g.found|avgp_name_exprsn|product_code_exprsn" />
<mvt:item name="ry_toolbelt" param="availgroup|Product_Insert|g.result|avgp_name_exprsn|product_code_exprsn" />

<mvt:item name="ry_toolbelt" param="availgroup|Product_Delete|g.result|g.product_code_exprsn" />
 
<mvt:item name="ry_toolbelt" param="availgroup|Category_Groups|g.count|category_code_exprsn" />

<mvt:item name="ry_toolbelt" param="availgroup|Category_Find|g.found|avgp_name_exprsn|category_code_exprsn" />
<mvt:item name="ry_toolbelt" param="availgroup|Category_Insert|g.result|avgp_name_exprsn|category_code_exprsn" />
<mvt:item name="ry_toolbelt" param="availgroup|Category_Delete|g.result|g.category_code_exprsn" />

Back to Top

Basket

Returns basket totals and more, assigned to a user selected variable name. This item is used in the MINI Basket template.

Usage: Add the item as the first line of any page or in the HEAD Tag Contents area.
See the OrderSubtotal item for use on the invoice page.

<mvt:item name="ry_toolbelt" param="basket|variablename" />
  
Example:
<mvt:item name="ry_toolbelt" param="basket|g.cart" />

  
&mvt:global:cart:length;<br>
&mvt:global:cart:weight;<br>
&mvt:global:cart:subtotal;<br>
&mvt:global:cart:subtotalF;<br>
&mvt:global:cart:charges;<br>
&mvt:global:cart:chargesF;<br>

&mvt:global:cart:total;<br>
&mvt:global:cart:totalF;<br>
  
<mvt:if expr="g.cart:length GT 0">
  Items in Basket: &mvt:global:cart:length;<br>
  Subtotal: &mvt:global:cart:subtotalF;

<mvt:else>
  Basket Empty
</mvt:if>
Back to Top

BasketButtons

This set of items add buttons to your basket screen to Empty the Basket, Checkout, and Continue Shopping.. They take the form of action, button prompt, CSS class, and outputs a form and button to perform the action.

Note: Do not place these buttons inside another form.

There are five actions, empty (empty the basket), checkout (start the checkout process), continue_lastprod, (Return to the last product in the basket), continue_lastcat, (Return to the first assigned category of the last product in the basket), and finally continue. (Return to the previous page before the basket.) The setup for the last action is more complex as explained below.

<mvt:item name="ry_toolbelt" param="basketbuttons|action|prompt|class" />

  
Examples:
<mvt:item name="ry_toolbelt" param="basketbuttons|empty|Empty Basket|submit120" />
<mvt:item name="ry_toolbelt" param="basketbuttons|checkout|Checkout Now|submit120" />

<mvt:item name="ry_toolbelt" param="basketbuttons|continue_lastcat|Continue Shopping|submit120" />
<mvt:item name="ry_toolbelt" param="basketbuttons|continue_lastprod|Continue Shopping|submit120" />

The Continue command button, when clicked, returns the user to the originating page. However, it requires additional setup steps.

  • 1. The basket link in the navigation bar or global header must be replaced using the link command.
  • 2. The continue command is be added to the BASK page.
  • 3. The Remove and Update buttons on the BASK page, Basket Contents template must both updated with the update_remove command.
    They should be added just before the </form> tags for both buttons.
<mvt:item name="ry_toolbelt" param="basketbuttons|continue|Continue Shopping|submit120" />

  
Example:
<mvt:item name="ry_toolbelt" param="basketbuttons|link|Basket|" />
  
This example is for the Remove button. Do the same for the Update button.
<mvt:item name="buttons" param="Remove" />

<mvt:item name="ry_toolbelt" param="basketbuttons|continue|update_remove" />
</form>
Back to Top

BasketCombined

This item makes 12 additional basket entities available.

Combine Price and Attribute prices. These entities allow you to display the combined price and remove the individual attribute prices from the basket display.

Basket Thumbnail and Image: Display the product thumbnail or image in the basket

Attribute Prompts and Images: Display the attribute/option prompts. Merchant normally displays attribute and option codes before the data. The item also makes the attribute or option prompts available, as configured on your product attributes screen. Using the prompt can clarify the basket display if your attributed codes, are cryptic. (e.g. code = XL, prompt = Extra Large). If the attribute or option also has an image, it also makes it available.

Use: Add the item to the top of any page that displays a basket or the top of the invoice page. There are no additional parameters. Edit the Basket Contents and Order Contents as needed.

Usage: <mvt:item name="ry_toolbelt" param="basketcombined" />

  
Basket Contents: (Note: the capital F at the end means currency formatted)
&mvt:item:Combined_PriceF; Product price + the sum of option prices. Use it in place of &mvt:item:formatted_price;
&mvt:item:Combined_SubtotalF; Combined_price * quantity. Use it in place of &mvt:item:formatted_subtotal;
&mvt:item:Options_PriceF; Sum of the option prices. Allows you to display the combined options price.
&mvt:item:Options_SubtotalF; Options_price * quantity. Allows you to display the extended combined options price.
  
&mvt:item:Combined_Price; These are non currency formatted versions of the above.
&mvt:item:Combined_Subtotal;
&mvt:item:Options_Price;
&mvt:item:Options_Subtotal;
  
Prompts:
Replace &mvt:option:attr_code; with &mvt:option:prompt;
  

Images:
<img src="&mvt:item:thumbnail;" border="0">
  
<mvt:if expr="l.settings:option:image">
  <img src="&mvt:option:image;" border="0" align="left">

</mvt:if>
Back to Top

Benchmark

These four items allow you to easily determine page template processing time or time sections of a page like foreach loops, screen, or call items.
The name parameter is a unique name or number given to each benchmark allowing you to have multiple benchmarks in the same page template.
There are four command keywords.
   start stores the starting time in g.benchmark:name:start.
   end stores the ending time in g.benchmark:name:end AND calculates the elapsed time stored in g.benchmark:name:elapsed.
   show outputs the result string e.g. "Benchmark name: Elapsed Time = 1.56425"
   hide is the same as show encapsulated in HTML remarks to hide the results in the page. e.g. <!--  -->

<mvt:item name="ry_toolbelt" param="benchmark|unique_name_literal|command_literal" />
  
<mvt:item name="ry_toolbelt" param="benchmark|name|start" />

<mvt:item name="ry_toolbelt" param="benchmark|name|end" />
<mvt:item name="ry_toolbelt" param="benchmark|name|show" />
<mvt:item name="ry_toolbelt" param="benchmark|name|hide" />

Back to Top

BreadCrumbs

When assigned to category or product pages, BreadCrumbs displays a history trail back to home. Domain SEO Settings are used to determine the format for the category links, so that changing the settings automatically changes the links.
A separator string is required including spaces (e.g. ' » '). NOTE: Storemorph chokes on the ampersand (&) inside string expressions. Notice the work-a-round using asciichar(38)
Fields Returned: id, code, href, name.

Copy and past the code below into the page template. It is common for designers to past the code into the page header.

<mvt:item name="ry_toolbelt" param="breadcrumbs|expression, literal, or RAW" /> &raquo; &mvt:category:name;
  
Example 1, Category Page:
<mvt:item name="ry_toolbelt" param="assign|g.sep|' ' $ asciichar(38) $ 'raquo; '" />

<mvt:item name="ry_toolbelt" param="breadcrumbs|g.sep" /> &raquo &mvt:category:name;
  
Example 2, Product Page:
<mvt:item name="ry_toolbelt" param="assign|g.sep|' ' $ asciichar(38) $ 'raquo; '" />

<mvt:item name="ry_toolbelt" param="breadcrumbs|g.sep" /> &raquo &mvt:product:name;

When used with the optional keyword raw only the data is returned allowing you to format the output as desired.


Example 3:
<mvt:item name="ry_toolbelt" param="breadcrumbs|RAW" />
  
<a href="http://&mvt:global:domain:name;/">Home</a>
<mvt:foreach iterator="crumb" array="breadcrumbs">

  > <a href="&mvt:crumb:href;" title="&mvt:crumb:name;">
    &mvt:crumb:name;</a>
</mvt:foreach>
> &mvt:category:name; OR &mvt:product:name;
  
View Returned Values:

<mvt:item name="ry_toolbelt" param="eval|varlist('l', 'breadcrumbs', l.all_settings)" />
Back to Top

Call

This item comes in two types. call_get and call_post. Given a URL expression, these items return the contents of any web page anywhere on the internet or your local intranet. Due to a documented bug in the way Storemorph handles the & (ampersand) character, the ampersand must be coded in a special way within your pages as shown below.

Ampersands in URLs:
Use the ~ (tilde) character in place of each & (ampersand), then replace them all at once.
<mvt:item name="ry_toolbelt" param="assign|g.url|g.sessionurl $ 'Screen=SFNT~Store_code=' $ g.Store_code" />
<mvt:item name="ry_toolbelt" param="assign|g.url|glosub(g.url,'~',asciichar(38))" />

call_get Given a url expression, this item returns the contents of the web page.

<mvt:item name="ry_toolbelt" param="call_get|g.returnpage|g.url_exprsn" />
  
Example:
<mvt:item name="ry_toolbelt" param="call_get|g.returnpage|'http://www.google.com'" />

&mvt:global:returnpage;

call_post Given a url expression and a fieldlist, this item posts the data and returns the contents of the web page.

<mvt:item name="ry_toolbelt" param="call_post|g.returnpage|g.url_exprsn|fieldlist" />
  
Example:
<mvt:item name="ry_toolbelt" param="call_post|g.returnpage|g.url|screen,store_code,category_code" />

&mvt:global:returnpage;
Back to Top

Category_Children

Category_Children loads all categories below (i.e. are assigned) to category_code into the array l.all_settings:category_children.

Additional Fields Returned: href, image_title, image_tree.

Parameters: Category_Code: Required expression. Contains the code for the category you wish to locate.

<mvt:item name="ry_toolbelt" param="category_children|g.Category_Code" />
<mvt:item name="ry_toolbelt" param="category_children|l.all_settings:category:code" />
  

Example: Display subcategory images with links
<mvt:if expr="l.settings:category_children">
  <mvt:foreach iterator="subcat" array="category_children">
    <div>
      <a href="&mvt:subcat:href">

        <img src="&mvt:subcat:image_tree;" border="0"><br>&mvte:subcat:name;
      </a>
    </div>
  </mvt:foreach>
</mvt:if>

  
View Returned Values:
<mvt:item name="ry_toolbelt" param="eval|varlist('l', 'category_children', l.all_settings)" />
Back to Top

Category_Images

This item loads the Category Title and Category Tree images into a user selected variable name.

<mvt:item name="ry_toolbelt" param="category_images|g.imgsrc|g.category_code" />
<mvt:item name="ry_toolbelt" param="category_images|g.imgsrc|l.all_settings:subcat:code" />
  

Example 1: Category Title image
<mvt:if expr="NOT ISNULL g.imgsrc:title">
  <img src="&mvt:global:imgsrc:title;">
</mvt:if>
  
Example 2: Category Tree image
<mvt:if expr="NOT ISNULL g.imgsrc:tree">
  <img src="&mvt:global:imgsrc:tree;">

</mvt:if>
Back to Top

Category_Load

Category_Load returns the specified category in the array l.all_settings:category letting you put any category information on any page.

Additional Fields Returned: href, image_title, image_tree.

Parameters:
found
: Required variable. Contains 1 if the category was found.
Category_Code: Required expression. Contains the code for the category you wish to load.

<mvt:item name="ry_toolbelt" param="Category_Load|g.found|g.Category_Code" />
  
<mvt:if expr="g.found">

  <a href="&mvt:category:href;" title="&mvte:category:name;">
    <img src="&mvte:category:image_title;" alt="&mvte:category:name;">
  </a>

</mvt:if>
  
View Returned Values:
<mvt:item name="ry_toolbelt" param="eval|varlist('l', 'category', l.all_settings)" />
Back to Top

Category_Meta

This item loads the Category Meta Tag Settings; Keywords and Description into a user selected variable name.

<mvt:item name="ry_toolbelt" param="category_meta|g.meta|g.category_code" />
<mvt:item name="ry_toolbelt" param="category_meta|g.meta|l.all_settings:category:code" /> 

  
Example 1: Category Meta keywords
<mvt:if expr="g.meta:keywords">
  <meta name="keywords" content="&mvt:meta:keywords" />
</mvt:if>
  

Example 2: Category Meta description
<mvt:if expr="g.meta:description">
  <meta name="description" content="&mvt:meta:description" />
</mvt:if>
Back to Top

Category_Paging

When placed on a category page, displays paging links as shown below:

Products found in this category: 102 Pages: 1 [2] 3 4 5 Page: 2 of 5

The variables shown are required; pagelength is a numeric value or variable containing the number of items on the page.

This item also has an optional parameter raw that returns the raw data stored in variables instead.
<mvt:item name="ry_toolbelt" param="category_paging|l.all_settings:category:id|g.offset|pagelength" />
<mvt:item name="ry_toolbelt" param="category_paging|l.all_settings:category:id|g.offset|pagelength|raw" />

  
Example:
<mvt:item name="ry_toolbelt" param="category_paging|l.all_settings:category:id|g.offset|'25'" />

Formatting is via CSS styles. This style sheet can be used as a starting point.

<style type="text/css">
#category_paging { text-align: right; }
#category_paging #cp_count { float: left; padding-right: 16px;}
#category_paging #cp_pages { float: left }
#category_paging #cp_page{ }
</style>

The raw form returns these variables.

g.cp:records or &mvt:global:cp:records;
g.cp:links or &mvt:global:cp:links;
g.cp:page or &mvt:global:cp:page;
Example:
<div id="category_paging">
    <div id="cp_count">Products in this category: &mvt:global:cp:records;</div>

    <div id="cp_pages">Pages: &mvt:global:cp:links;</div>
    <div id="cp_page"> Page: &mvt:global:cp:page;</div>
</div>

Back to Top

Category_Parents

Category_Parents loads the top level categories into the array l.all_settings:category_parents. This could be used to display all the top level category images on the storefront or as an alternative to the expanding category tree.

Additional Fields Returned: href, image_title, image_tree.

<mvt:item name="ry_toolbelt" param="category_parents" /> 

  
Example: display parent / top level categories
<mvt:if expr="l.settings:category_parents">
  <mvt:foreach iterator="topcat" array="category_children">
    <div>
      <a href="&mvt:topcat:href">

        <img src="&mvt:topcat:image_tree;" border="0"><br>&topcat:subcat:name;
      </a>
    </div>
  </mvt:foreach>
</mvt:if>

Back to Top

Category_Products

Product Items: Integration Guide.

Category_Products provides paging links (e.g. Page: [1] 2 3 4 ), user selectable sorting, and user selectable number of items to display per page. It returns all products assigned to the category, plus additional fields described below, allowing you to do more with less work. It can be used on the CTGY page template in conjunction with the Category Product List Layout or can be used as a replacement. It can also be used to create new alternate category page layouts as in the integration guide.

This item returns the products assigned to the category in the either the array l.all_settings:products for (MMUI stores) or l.all_settings:category_listing:products for (CSSUI stores).

 Pagination and sorting settings are returned in l.all_settings:prod_page.

Additional Fields Returned: href, price_original, formatted_price, formatted_cost and quantity (in basket)

Parameters:
length: Required variable. Contains the number of items returned.
Category_Code: Required expression. Contains the code for the category you wish to locate.
Maxitems: Required expression. This number sets the items displayed per page. Default value is 12. Assign  Maxitems = 'ALL' to display all records. You can set Maxitems as a fixed value or use the radio controls provided to make it user selectable.
SortBy: Contains one of the following keywords in the form of sortfield-direction. If omitted, the order set in Merchant is used (i.e. disp_order-asc).
id-desc = Newest Items
price-asc = Price LOW to high
price-desc = Price HIGH to low
name-asc = Name a-z
name-desc = Name z-a
code-asc = Code a-z
code-desc = Code a-z
default-asc = Default display order

Global Variables Used:
g.PageNum:
Is used in the pagination and sorting features.
g.SortBy:
Optional expression. A default sorting value can be set before calling the item as show below.
g.Sortby_Options: Optional expression. Lets you set a string before calling the item, to change the sort option values to use in the dropdown box.
This is a colon plus comma separated list formatted as keyword:prompt,keyword:prompt etc.
The default options are shown in the integration guide below. Edit as desired.

Integration:  Step 1. Paste this section directly above the closing tag  of the head section. </head>.


<!-- Style the pagination section. -->
<style type="text/css">
.paging { text-align: right; }
.paging .count { float: left; margin: 4px 24px 0 0; }
.paging .max { float:left; }
.paging .sort{ }
.paging .page{ float: left; margin-right: 48px;}
.paging .pages { float: left; }
.paging a.current { font-weight: bold; font-size; 13px; }
</style>
  
<!-- Optional: Set the maximum items to display -->
<mvt:if expr="ISNULL g.Maxitems">
<mvt:item name="ry_toolbelt" param="assign|g.Maxitems|8" />

</mvt:if>
  
<!-- Optional: Set the Maximum items radio button options -->
<mvt:item name="ry_toolbelt" param="assign|g.maxradio:min|8" />
<mvt:item name="ry_toolbelt" param="assign|g.maxradio:max|24" />

  
<!-- Optional: Set a default sort value -->
<mvt:if expr="ISNULL g.SortBy">
<mvt:item name="ry_toolbelt" param="assign|g.SortBy|'price-desc'" />
</mvt:if>
  

<!-- Optional: Set the options displayed in the sort list. Edit as desired. -->
<mvt:item name="ry_toolbelt" param="assign|g.Sortby_Options|
'id-desc:Newest Items,price-asc:Price LOW to high,price-desc:Price HIGH to low,' $
'name-asc:Name a-z,name-desc:Name z-a,code-asc:Code a-z,code-desc:Code a-z,'" />
  
<mvt:item name="ry_toolbelt" param="Category_Products|g.length|g.Category_Code|g.Maxitems|g.Sortby" />

Integration:  Step 2.  In the template search for the closing </h1> tag. Paste this section directly after the tag and any closing </mvt:if> that may be found with it.

<mvt:if expr="l.settings:prod_page:records GT 0">

    <div class="paging">
        <div class="count">PRODUCTS: <b>&mvt:prod_page:records;</b></div>
        <mvt:if expr="l.settings:prod_page:records GT 1">

            <div class="max">Show: &mvt:prod_page:maxradio;</div>
        </mvt:if>
        <mvt:if expr="l.settings:prod_page:records GT 1">
            <div class="sort">Sort By: &mvt:prod_page:sortselect; </div>

        </mvt:if>
        <mvt:if expr="l.settings:prod_page:count GT 1">
            <div class="page">Page: <b>&mvt:prod_page:current;</b> of &mvt:prod_page:count;</div>

            <div class="pages">Pages: &mvt:prod_page:links;</div>
        </mvt:if>
        <br style="clear: left">
    </div>

</mvt:if>

Integration:  Step 3. Click the Category Product List Layout tab. You will have to update the product links on this template to &mvte:product:href; Example: <a href="&mvte:product:href;"> Also find the part of the script that displays the Previous and Next buttons. Delete it and paste this in its place.

<mvt:if expr="l.settings:prod_page:records GT 0">

    <div class="paging">
        <mvt:if expr="l.settings:prod_page:count GT 1">
            <div class="page">Page: <b>&mvt:prod_page:current;</b> of &mvt:prod_page:count;</div>

            <div class="pages">Pages: &mvt:prod_page:links;</div>
        </mvt:if>
        <br style="clear: left">
    </div>

</mvt:if>

View Returned Values: To temporarily view the pages data paste this directly above the closing </body> tag.

<mvt:item name="ry_toolbelt" param="eval|varlist('l', 'products', l.all_settings)" />

<mvt:item name="ry_toolbelt" param="eval|varlist('l', 'prod_page', l.all_settings)" />
Back to Top

Category_Siblings

Category_Siblings loads all categories that are on the same level as category_code into the array l.all_settings:category_siblings.

Additional Fields Returned: href, image_title, image_tree.

Parameter: Category_Code: Required expression. Contains the code for the category you wish to locate.

<mvt:item name="ry_toolbelt" param="category_siblings|g.category_code" />
<mvt:item name="ry_toolbelt" param="category_siblings|l.all_settings:category:code" />

  
Example: Display subcategory images with links
<mvt:if expr="l.settings:category_children">
  <mvt:foreach iterator="cat" array="category_siblings">
    <div>
      <a href="&mvt:cat:href">

        <img src="&mvt:cat:image_tree;" border="0"><br>&mvte:cat:name;
      </a>
    </div>
  </mvt:foreach>
</mvt:if>

  
View Returned Values:
<mvt:item name="ry_toolbelt" param="eval|varlist('l', 'category_siblings', l.all_settings)" />
Back to Top

Cattree_Expanded

The Cattree_Expanded item outputs the entire category tree structure at once as a multi level unordered list, e.i. <ul><li> tags. Using CSS, JavaScript or JQuery makes it possible to create horizontal dropdown or vertical fly out menus. (aka suckerfish style menus) This item is extremely fast, displaying hundreds of categories nested to any depth in milliseconds on most servers. Optional parameters are provided to control its operation. Domain SEO Settings are used to determine the format for the category links, so that changing the settings automatically changes the links.

Parameters: Each of these can be variables or expressions. See example 2 below.
ul_id: Optional expression. This is the id attribute of the first ul tag. e.g. (where g.ul_id = 'cssmenu1', outputs <ul id="cssmenu1">.
href_format: Optional expression. This is an href template string that you can provide as the basis for the link. Use @C@ as a token for the category code.
topcat_limit: Optional expression. Limits the number of top level categories to the first n items. For example, you have 12 top level categories buy only want to display the first 9 in a horizontal menu.
topcat_shortnames: Optional expression. Contains a comma separated list of alternate top level category names. For example the top level category names in your horizontal menu are to long, so you provide a list of shorter names.

Return Value: The array g.topcat[ ] is populated with the top level category information. One use would be to display the top level category images on the SFNT page. See example 3 below.

<mvt:item name="ry_toolbelt" param="cattree_expanded" />

<mvt:item name="ry_toolbelt" param="cattree_expanded|ul_id|href_format|topcat_limit|topcat_shortnames" />
  
Example 1: Horizontal Category menu.
  
<div class="horizontalcssmenu">
    <mvt:item name="ry_toolbelt" param="cattree_Expanded|'cssmenu1'" />

    <a class="staticlink" href="http://forum.mywebsite.com/" target="_blank">Forum</a>
</div>
  
Example 2: With Parameters:
<mvt:item name="ry_toolbelt" param="assign|g.ul_id|'nav'" />

<mvt:item name="ry_toolbelt" param="assign|g.href_format|'http://' $ g.domain:name $ '/clothing/@[email protected]'" />
<mvt:item name="ry_toolbelt" param="assign|g.topcat_limit|6" />
<mvt:item name="ry_toolbelt" param="assign|g.topcat_shortnames|'Jackets,Shirts,Pants,Shorts,Footwear,Accessories'" />

<div class="nav_wrapper">
    <mvt:item name="ry_toolbelt" param="Cattree_Expanded|g.ul_id|g.href_format|g.topcat_limit|g.topcat_shortnames" />
</div>
  
Example 3: Using g.topcat[ ] to display Storefront images:
<div id="cat_wrapper">

    <mvt:comment> Convert the global to a local array</mvt:comment>
    <mvt:item name="ry_toolbelt" param="reference|l.all_settings:topcats|g.topcats" />
  
    <mvt:foreach iterator="cat" array="topcats">

    <mvt:comment> Lookup the images </mvt:comment>
    <mvt:item name="toolkit" param="cattreeimage|tree_image|l.all_settings:cat:code" />
  
    <mvt:comment> format the href link </mvt:comment>

    <mvt:item name="ry_toolbelt" param="seolink|category|l.all_settings:cat:code" />
  
    <div class="imgwraper">
        <a href="&mvt:href:category;">

        <mvt:if expr="g.tree_image">
            <img src="&mvte:global:tree_image;" style="width: 100px">
        <mvt:else>
            <img src="graphics/00000001/tree_placeholder.gif" style="width: 100px">

        </mvt:if>
        </a>
        <h1><a href="&mvt:href:category;">&mvte:cat:name;</a></h1>
    </div>

    </mvt:foreach>
</div>
Back to Top

Compress

Returns a copy of string after removing tabs, leading and trailing spaces and blank lines. See Compress() in Additional Functions.

<mvt:item name="ry_toolbelt" param="compress|g.varname" />

Back to Top

Counter

Sets increments or decrements a counter; used in a for each loop to count iterations. where valid operators are are = + -,, item is any variable name you choose, and n is any whole number.

<mvt:item name="ry_toolbelt" param="counter|item=n" />

<mvt:item name="ry_toolbelt" param="counter|item+n" />
<mvt:item name="ry_toolbelt" param="counter|item-n" />
  

&mvt:global:counter:item;
  <mvt:if expr="g.counter:item EQ 3">
    <hr>
</mvt:if>
Back to Top

Cookie

This item loads, saves, or clears cookies at the users browser. You now have a way to easily create persistent global variables without having to pass the information from screen to screen using forms or embedding variables and values within links.

Usage:
They can only be used in the <head> </head> section of your page template.
The cookies name is the same as the global variable name that holds the value.
Load: This command loads a previously saved cookie into the global variable you specify. If none is found the variable is null.
Save: This command saves a cookie with the same name as global variable you specify. If the variable is null, the cookie is cleared.
Expiration: When saving a cookie the duration of the cookie is set in days or portion of a day. (e.g. for 1 year, use 365, for 1 hour use 1/24)
Hint: multiple values separated by a space can be stored in a single cookie.

<mvt:item name="ry_toolbelt" param="cookie|load|g.variablename" />
<mvt:item name="ry_toolbelt" param="cookie|save|g.variablename|numeric_expression_days" />

  
Example 1: Persistent Global Variable:
  
<mvt:item name="ry_toolbelt" param="cookie|load|g.user_preference" />
<mvt:if expr="g.user_preference">
  <mvt:comment> Re-save the cookie to refresh the vale for another day. </mvt:comment>

  <mvt:item name="ry_toolbelt" param="cookie|save|g.user_preference|1" />
<mvt:else">
  <mvt:comment> Add you code here that transmits the user value in a form. </mvt:comment>

  Enter your color: <input type="text" Name="user_preference" value="" /><br>
</mvt:if>
  
Example 2, Persistent Session after login:
A sample page template is included with the module called Sessions.txt

Back to Top

CurrencyFormat

Returns a monitary number formatted in the currently configured currency.

<mvt:item name="ry_toolbelt" param="currencyformat|g.varname|expression" />
  

Example:
<mvt:item name="ry_toolbelt" param="currencyformat|g.newprice|g.cost * 1.5" />
Price: &mvt:global:newprice;<br><br>
Back to Top

Custom_Category

Note: The core-17 udate Given a variable containing the category id or category code, loads the custom category fields into a global variable of your choice. In order to determine if the id or code is entered, the following naming convention must be observed; a category id variable name must end with :id, _id or .id as shown below. a category code must end with :code, _code or .code.

<mvt:item name="ry_toolbelt" param="custom_category|g.extcat|variable_name" />
  
<mvt:item name="ry_toolbelt" param="custom_category|g.extcat|l.all_settings:category:id" />

<mvt:item name="ry_toolbelt" param="custom_category|g.extcat|g.Category_code" />
  
Example:
<mvt:if expr="g.extcat:value:fieldcode">
  &mvt:global:extcat:name:fieldcode;: &mvt:global:extcat:value:fieldcode;<br>

</mvt:if>
Back to Top

Custom_Customer

This item comes in two types; read and write. A typical application would be to add a second address line or tax id field to the add and edit customer pages. On the edit screen you can read the database, populate an input text box (e.g. name="TaxId" ) and allow the customer to edit it. On the next screen, usually the storefront, you test for the variable g.TaxId and the read the database, change the field using the assign token the write then record back out.

custom_customer_read

Given g.basket:cust_id, reads the custom customer fields into a global variable of your choice.

<mvt:item name="ry_toolbelt" param="custom_customer_read|g.varname|g.basket:cust_id" />
  
Example:
<mvt:item name="ry_toolbelt" param="custom_customer_read|g.extcust|g.basket:cust_id" />

<mvt:if expr="g.extcust:value:taxid">
    &mvt:global:extcust:name:taxid;: &mvt:global:extcust:value:taxid;
</mvt:if>
  
&mvt:global:extcust:name:taxid;: &mvt:global:extcust:value:taxid;

custom_customer_write

Given a g.basket:cust_id, writes the values to the custom customer fields. You must first read the custom customer fields, field values can be modified using the assign item, the writen back to the database.

<mvt:item name="ry_toolbelt" param="custom_customer_write|g.varname|g.basket:cust_id" />

  
Example:
<mvt:if expr="NOT ISNULL g.taxid">
  <mvt:item name="ry_toolbelt" param="custom_customer_read|g.extcust|g.basket:cust_id" />
  <mvt:item name="ry_toolbelt" param="assign|g.extcust:value:tax_id|encodeentities(trim(g.taxid))" />

  <mvt:item name="ry_toolbelt" param="custom_customer_write|g.extcust|g.basket:cust_id" />
</mvt:if>
Back to Top

Custom_Products

Given a variable containing product id or product code, loads the custom product fields into a global variable of your choice. In order to determine if the id or code is entered, the following naming convention must be observed. a product id variable name must end with :id, _id or .id as shown below. a category code must end with :code, _code or .code.

<mvt:item name="ry_toolbelt" param="custom_products|g.extprod|variable_name" />
  
<mvt:item name="ry_toolbelt" param="custom_products|g.extprod|l.all_settings:product:id" />

<mvt:item name="ry_toolbelt" param="custom_products|g.extprod|g.prod_code" />
  
Example:
<mvt:if expr="g.extprod:value:fieldcode">
  &mvt:global:extprod:name:fieldcode;: &mvt:global:extprod:value:fieldcode;<br>

</mvt:if>
Back to Top

Datetime_Format

This item converts time_t (i.e. time stamp) values to formatted date time strings. It provides an extensive set of formatting options. Note: time_t is defined in Miva Merchant as the number of seconds since Jan 1, 1970 Greenwich Mean Time (GMT)

The item takes a numeric date as a time_t value, (e.g. s.dyn_time_t) or the keyword NOW, and a date/time format string describing the return value. The format value can contain a keyword (show below) or a string expression containing the following:
(yy or yyyy), (m, or mm), (mmm, or mmmm), (d, or dd), (ddd, or dddd), (h or hh), (m or mm), (s or ss), /, -, :, ampm, zone, GMT.

In the format string; ampm refers to the 12 hour clock and display a.m. or p.m. and zone will display the time zone code (e.g. EST, PST, etc.).

GMT is a special keyword that forces the time conversion from time zone 0.

Keywords Results
SHORTDATE11/23/2008
MEDIUMDATENov 23, 2008
LONGDATENovember 23, 2008
FULLThursday, November 23, 2008 CE 0:05:11 p.m. EST
SHORTTIME12:05
MEDIUMTIME12:05:11
LONGTIME00:05:11 p.m.
* GMTSTRINGThu, 04-Dec-2009 16:30:03 GMT
Format string examples Results
yy, yyyy08, 2008
m, mm, mmm, mmmm1, 01, Jan, January
d, dd, ddd, dddd4, 04, Thu, Thursday
h, hh, m, mm, s, ss6, 06, 3. 03, 9, 09
hh:mm:sec zone17:30:15 EST
mm/dd/yyyy12/04/2008
ddd, mmm. d, yyyyThu, Dec. 4, 2008
dddd, mmmm d, yyyy h:mm ampm zoneThursday, December 4, 2008 7:30 p.m. EST

* All time conversions are based on the time zone set on the server UNLESS the characters 'GMT' are included in the format string or the keyword GMTSTRING is used. GMTSTRING outputs the date and time in the format required for client side cookies.

<mvt:item name="ry_toolbelt" param="datetime_format|g.return|datevalue_exprsn|date_format_string_exprsn" />
  
Example 1. current complete time:
<mvt:item name="ry_toolbelt" param="datetime_format|g.return|NOW|FULL" />

Returns: Thursday, December 4, 2008 CE 1:32:53 a.m. EDT
  
Example 2. cookie date + 60 days:
<mvt:item name="ry_toolbelt" param="datetime_format|g.return|s.dyn_time_t + (86400 * 60)|GMTSTRING" />
Returns: Thu, Dec 5, 2009 CE 6:32:53 a.m. GMT
  
Back to Top

Datetime_Value

This item converts formatted date / time string, returning time_t values (i.e. time stamp). Note: time_t is defined in Miva Merchant as the number of seconds since Jan 1, 1970 Greenwich Mean Time (GMT)

The item expects the date and time values formatted as show below and a numeric time zone value. When a date and time are specified together, they must be separated by a space.

Dates value must contain a '/'or '-'.
m-d-yy, m/d/yy
mm-dd-yy, mm/dd/yy
mm-dd-yyyy, mm/dd/yyyy

Time value must contain a ':'. The am/pm strings are optional.
hh:mm [am, a.m., pm, p.m.]
hh:mm:ss [am, a.m., pm, p.m.]

The keyword NOW can be used instead of a date to return the current time_t value on the server.

The time zone value can be specified using the built in timezone() function as shown in the examples below.

<mvt:item name="ry_toolbelt" param="datetime_value|g.return|date_string|timezone()" />
  
Example 1. <mvt:item name="ry_toolbelt" param="datetime_value|g.timestamp|'12/04/2008'|timezone()" />

&mvt:global:timestamp;
displays: 1228366800
  
Example 2. <mvt:item name="ry_toolbelt" param="datetime_value|g.timestamp|'12/04/2008 18:05:11'|timezone()" />
<mvt:item name="ry_toolbelt" param="assign|g.fmt_string|'dddd, d-mmm-yyyy hh:mm ampm zone'" />

<mvt:item name="ry_toolbelt" param="datetime_format|g.reformated_date|g.timestamp|g.fmt_string" />
&mvt:global:reformated_date;
displays: Thursday, 4-Dec-2008 06:05 p.m. EDT
Back to Top

Do

The short name of the Do item hides the fact that this is the most powerful command in Toolbelt. Use Do to call external compiled functions within any MivaScript file. Like MivaScripts MvDO tag or OpenUIs DOFUNC token. You can directly access your own compiled external functions or tap directly into Miva Merchants API. This command often makes it possible to avoid much of the work and overhead of writing modules.

Parameters:   
file_path:
Required expression. Contains the path from the root to the compiled .mvc file.
Function_Name: Required. This is the name of the function in the file

Function Parameters: These must be numbers, strings, global variables or local variable with the l.all_settings prefix. Parameters can not contain expressions or nested functions.

<mvt:item name="ry_toolbelt" param="do|g.file_path|g.result|Function_Name( parameter1, parameter2)" />
  
Examples:
<mvt:item name="ry_toolbelt" param="do|g.Module_Library_DB|g.btotal|Basket_SubTotal(g.Basket:BASKET_ID)" />

  
<mvt:item name="ry_toolbelt" param="do|g.Module_Library_DB|g.found|
      Runtime_Category_Load_Code(g.Category_Code, l.all_settings:category)" />
Back to Top

Eval

Outputs the expression result; where expression is most valid MivaScript expressions. Nearly 100 functions are included in the Script Builder below.

<mvt:item name="ry_toolbelt" param="eval|expression" />
Script Builder: function description:
 

item: (copy and paste this value)
Back to Top

Event_Timer

This item triggers events on your website at any timed interval; monthly, weekly, daily, hourly etc. Use it pack the store, create batches, post form data, send emails or automate any other task you can think of.

Events are triggered when a user loads a web page containing an event_timer. Since it relies on page hits to trigger the event, the timing is of course not precise, so a duration is specified to provide a time window. The first page hit during the time window triggers the event and sets a flag so it can not be triggered again. The first page hit after the time windows, clears the flag.

When triggered, the item calls any webpage you specify, where the task has been scripted. Normally the call uses the GET method but if the optional field list is provided, the POST method is used. Using the tell-a-friend template (included with the module) as an example, you can script a new page template to send data via email at regular intervals.

Parameters:
name: This is a unique name or number given to each event timer.
g.return: This is the variable where the page results are returned.
time_exprsn: can contain the following:
'now' Use the current time then repeat in time_window seconds.
'monthly dd hh:mm:ss' where dd is the day of the month
'weekly monday hh:mm:ss' where monday is the day name or day number of the week (sunday = 1, monday = 2 etc)
'daily hh:mm:ss' where hh is 0 to 24 hours, mm is 0 to 59 minutes and ss is 0 to 59 seconds.
'time_t value' when a time_t value is specified, the trigger will activate only once when the time is reached.
duration: This is the number of seconds the timer will remain active. (e.g. 'daily 06:00:00'| 3600) means the first page hit between 6  and 7 a.m. will trigger the event.
url: This is the URL string of the page to be called when the event_timer is triggered. Note the use of the tilde character instead of & in the examples.
fieldlist: This is optional and used when the POST method is desired

<mvt:item name="ry_toolbelt" param="event_timer|name|g.return|time_exprsn|duration|url|fieldlist" />

  
NOTE: in each of these examples &mvt:global:return; would be deleted after testing is complete.
Example #1: Pack the database every 12 hours
<mvt:item name="ry_toolbelt" param="assign|g.user|'joe'" />
<mvt:item name="ry_toolbelt" param="assign|g.password|'br549'" />

<mvt:item name="ry_toolbelt" param="assign|g.url|
'http://www.websitecom/mm5/admin.mvc?username='$g.user$'~password='$g.password$'~Screen=BLNK~Action=PACK'" />
<mvt:item name="ry_toolbelt" param="assign|g.url|glosub(g.url,'~',asciichar(38))" />
<mvt:item name="ry_toolbelt" param="event_timer|packdata|g.return|'now'|3600 * 12|g.url|" />

<mvt:item name="ry_toolbelt" param="assign|g.u|''" />
<mvt:item name="ry_toolbelt" param="assign|g.p|''" />
&mvt:global:return;

<mvt:item name="ry_toolbelt" param="assign|g.return|''" />
 
Example #2: Daily post data to a webpage every evening.
<mvt:item name="ry_toolbelt" param="assign|g.search|'test'" />

<mvt:item name="ry_toolbelt" param="assign|g.screen|'SRCH'" />
<mvt:item name="ry_toolbelt" param="event_timer|eveningpost|g.return|
'daily 22:00:00'|3600 * 2|'http://www.websitecom/mm5/merchant.mvc?'|g.search,g.screen" />
&mvt:global:return;

Back to Top

For

Allows you to take control of the foreach tokens to create your own loop structure. Expressions can be numbers, numeric variables, or numeric expressions but can not contain spaces. The step incriment_exprsn is optional and defaults to 1.

Note #1: Expression values can be zero or negative to execute a reverse loop (e.g for|j=20 to -20 step -1) however, nonsensical combinations (i.e. step 0) will return an error message.
Note #2: Due to limitations of Storemorph, there is currently no way to break out of a loop. You can place conditionals around your code to skip further processing while the loop finishes.

<mvt:item name="ry_toolbelt" param="for|counter=start_exprsn to start_exprsn step incriment_exprsn" />
  
Example:
<mvt:item name="ry_toolbelt" param="assign|g.max|32" />

<mvt:item name="ry_toolbelt" param="assign|g.bytwo|2" />
<mvt:item name="ry_toolbelt" param="for|j=0 to g.max step g.bytwo" />
<mvt:foreach iterator="j" array="for_j">

  &mvt:j; = <mvt:item name="ry_toolbelt" param="eval|l.all_settings:j" /><br>
</mvt:foreach>
Back to Top

hasAttributes

This item returns a number of attributes a product has. On a category page this can be used to change the Add to Basket button into a More Information link, for any product that has attributes.

<mvt:item name="ry_toolbelt" param="hasAttributes|g.attr_count|l.all_settings:product:code" />

  
Example:
<mvt:if expr="g.attr_count">
  <a href="&mvt:href:product">More Information...</a>
<mvt:else>
  <mvt:item name="buttons" param="Add1ToBasket" />

</mvt:if>
Back to Top

Lookup|Header Footer

Returns ANY category header or footer or ANY product header or footer as a variable by providing the category or product code. The final parameter is optional. If omitted, the current g.Category_Code or g.Product_code is used. This item can be used on any screen, and is not restricted to category or product pages.

This item comes in four varieties.

<mvt:item name="ry_toolbelt" param="Lookup|ctgy_header|g.cathead|g.catcode_exprsn" />

<mvt:item name="ry_toolbelt" param="Lookup|ctgy_footer|g.catfoot|g.catcode_exprsn" />
  
<mvt:item name="ry_toolbelt" param="Lookup|prod_header|g.prodhead|g.prodcode_exprsn" />

<mvt:item name="ry_toolbelt" param="Lookup|prod_footer|g.prodfoot|g.prodcode_exprsn" />
  
Example 1: Used on a product page where g.Category_Code is known...
<mvt:item name="ry_toolbelt" param="Lookup|ctgy_footer|g.catfoot|" />

  
Example 2: <mvt:item name="ry_toolbelt" param="Lookup|prod_header|g.prodhead|'tr500'" />
&mvt:global:prodhead;
Back to Top

Lookup|Login

Lookup|Login outputs a form that allows customers to enter their email address and receive their account login name by email.

Integrate this item on the customer Login page (LOGN) and Order Login Page (ORDL) as show in example 1 below.
Optionally you can use the file LOOKUP_LOGIN.txt included in the modules zip file to fully control the formatting or place the lookup in a popup window.

Three methods for integrating the item are show below.

Keywords: Three options are provide to determine the "from" email address used in the form.
ORDER_CONFIRMATION_EMAIL: This is the email address configured in Email Merchant Notification (default if left blank.)
STORE_OWNER_EMAIL: This is the email address configured in the store Registration.
NOREPLY: This will output [email protected]

<mvt:item name="ry_toolbelt" param="lookup|login|FROM_KEYWORD" />

Example 1: Integrate the item directly onto the pages LOGN and ORDL.
Locate the Login <form> it will contain <input type="hidden" name="Action" value="LOGN" />
After the closing tag >/form> insert the item and use CSS to style the form elements
  

</form>
<mvt:item name="ry_toolbelt" param="lookup|login|NOREPLY" />
  
Example 2: Create a new page template call with the code lookuplogin.
Copy and paste the supplied file called LOOKUP_LOGIN.txt. Edit the template as desired.
Locate the login forms closing tag </form> on LOGN and ORDL.
Use the screen command to insert the form.
  
</form>

<mvt:item name="ry_toolbelt" param="screen|lookuplogin" />
  
Example 3: Create a template as show in Example 2.
Use JavaScript to open the page in a new window by clicking a link or button.
  
<mvt:item name="ry_toolbelt" param="assign|g.url|g.sessionurl $ 'screen=lookuplogin'" />

<b>Forgot your login?</b><br />
<a onclick="window.open ('&mvt:global:url;', 'Email my login','menubar=0,resizable=1,
width=300,height=150,left=400,top=300''); return false;"
href="#" title="Get my login id">Email my login</a>

Back to Top

Lookup|SQL

Also See Query Lookup|SQL allows you to execute your own SQL Select * query on ANY Merchant database table within your store.

Knowledge of MySQL and the database tables is required. You can access a single record or return an array of records where: table_expression can be any MivaScript string expression, variable or string literal that results in a table name in the database. Likewise, the query_exprsn will consists of the string variable or literal representing the records you wish to return.

Important: Table names are case sensitive and for security, are limited to the store tables. In the examples below, notice the single quote surrounding the entire expression and right quotes 'code=`shirt_50214`' that surround the product code shirt_50214. Right quotes are required to represent the inner string within the string expression. On my keyboard the right quote (`) is found with the tilde (~) character.

This item also returns the complete query string, in g.SQL, the number of items found in g.SQL_length, and the structure of the table returned. in l.settings:structure. See the sample code below and the toolbelt Structure item.

<mvt:item name="ry_toolbelt" param="Lookup|SQL|g.table_expression|g.query_exprsn|returnarray" />
  
Example: 1. Load specific product:
<mvt:item name="ry_toolbelt" param="assign|g.where|'WHERE code=`shirt_50214`'" />

<mvt:item name="ry_toolbelt" param="Lookup|SQL|'Products'|g.where|SQLresults" />
&mvt:SQLresults[1]:code; = 'code=`shirt_50214`'
  
Example: 2. All products sorted:
<mvt:item name="ry_toolbelt" param="assign|g.where|'WHERE 1 ORDER BY disp_prder ASC'" />

<mvt:item name="ry_toolbelt" param="Lookup|SQL|'Products'|g.where|SQLresults" />
  
Example: 3. Products by desc price:
<mvt:item name="ry_toolbelt" param="assign|g.where|'WHERE price<`25.00` ORDER BY price DESC'" />

<mvt:item name="ry_toolbelt" param="Lookup|SQL|'Products'|g.where|SQLresults" />
  
Display the Results:  
<mvt:if expr="g.SQL_length">
  <mvt:foreach iterator="item" array="SQLresults">

    <mvt:item name="ry_toolbelt" param="assign|g.count|g.count + 1" />
    &mvt:global:count;. Code: &mvt:item:code; : Name: &mvt:item:name; $ &mvt:item:price;<br>
  </mvt:foreach>

</mvt:if>
  
Debugging Tools:
Query String = &mvt:global:SQL;<br>
SQL_length = &mvt:global:SQL_length;<br>
<mvt:foreach iterator="db" array="structure">

  name: &mvt:db:field_name;, type: &mvt:db:field_type;,
  length: &mvt:db:field_len;, decimals: &mvt:db:field_dec; <br>
</mvt:foreach>
Back to Top

NumberFormat

This item and the NumberFormat() function returns a number formally formatted. For example 1214365.346 formats as 1,214,365.35

<mvt:item name="ry_toolbelt" param="NumberFormat|g.result|Numeric_expression|decimal_places" />
 
Example 1:
<mvt:item name="ry_toolbelt" param="asign|g.population|307006550" />

<mvt:item name="ry_toolbelt" param="NumberFormat|g.populationF|g.population|0" />
US Population: &mvt:global:populationF;<br>
 
US Population: 307,006,550
 
Example 2:
<mvt:item name="ry_toolbelt" param="eval|NumberFormat( g.StickerPrice, 2 )" />

Back to Top

OrderSubtotal

Used only on the Invoice page, returns order subtotal, weight and number ot items. It assigns values to a user selected variable name. This is very handy when you need to transmit these values to a thrid party like Google for ROE tracking.

Usage: Add the item as the first line of the INVC page template.

<mvt:item name="ry_toolbelt" param="ordersubtotal|variablename" />

  
Example:
<mvt:item name="ry_toolbelt" param="ordersubtotal|g.order_items" />
  
&mvt:global:order_items:length;<br>
&mvt:global:order_items:weight;<br>

&mvt:global:order_items:subtotal;<br>
&mvt:global:order_items:subtotalF;<br>
  
<mvt:if expr="g.order_items:length GT 0">
  Items in Order: &mvt:global:order_items:length;<br>
  Order Subtotal: &mvt:global:order_items:subtotalF;

</mvt:if>
Back to Top

PercentFormat

This item and the PercentFormat() function returns a number formatted as a percentage. for example 0.15 would display as 15%

<mvt:item name="ry_toolbelt" param="PercentFormat|g.result|Numeric_expression|decimal_places" />

 
Example 1:
<mvt:item name="ry_toolbelt" param="asign|g.price|100.00" />
<mvt:item name="ry_toolbelt" param="asign|g.SalePrice|85.00" />

<mvt:item name="ry_toolbelt" param="PercentFormat|g.discount|(g.Price - g.SalePrice) / g.Price|2" />
You Saved: &mvt:global:discount;<br>
 
You Saved: 15.00%
 
Example 2:
<mvt:item name="ry_toolbelt" param="asign|g.markup|(g.price / g.cost) - 1" />

<mvt:item name="ry_toolbelt" param="eval|PercentFormat( g.markup, 2 )" />
Back to Top

Product_BestSellers

Product_BestSellers returns the stores best selling products in the array l.all_settings:bestsellers. It also provides sorting options.

Additional Fields Returned: formatted_price, formatted_cost, href, ordercount, price_original, and quantity (in basket).

Parameters:
length: Required variable. Contains the number of items returned.
Category_Code: Optional expression. If omitted it returns best selling products from all active products.
Maxitems:
Optional expression. Limits the number of items returned.
SortBy: Optional expression. Contains keywords in the form of sortfield-direction. If omitted, the order set in Merchant is used. (i.e. disp_order-asc)
See: Category_Products for the sort keywords.

<mvt:item name="ry_toolbelt" param="Product_BestSellers|g.length|g.Category_Code|g.Maxitems|g.Sortby" />
  
<mvt:if expr="g.length">

  <mvt:foreach iterator="item" array="bestsellers">
    <a href="&mvt:item:href;" title="&mvte:item:name;">
      <img src="&mvt:item:thumbnail;" alt="&mvte:item:name;" border="0"><br>

      Price: &mvt:item:formatted_price;<br>
      <b>&mvte:item:name;</b><br>
    </a>
  </mvt:foreach>

</mvt:if>
  
View Returned Values:
<mvt:item name="ry_toolbelt" param="eval|varlist('l', 'bestsellers', l.all_settings)" />
Back to Top

Product_Categories

Product_Categories returns each category record a product is assigned to into the array l.all_settings:product_categories.

Additional Fields Returned: href, image_title, image_tree.

Parameters:
length
: Required variable. Contains the number of items returned.
Product_Code: Required expression.

<mvt:item name="ry_toolbelt" param="Product_Categories|g.length|g.Product_Code" />

  
Example:
<mvt:if expr="g.length">
  <mvt:foreach iterator="cat" array="product_categories">
    Categories : &mvt:cat:code; &mvt:cat:name; <br>

  </mvt:foreach>
</mvt:if>
  
First Category: &mvt:product_categories[1].code; &mvt:product_categories[1].name;<br>
  
View Returned Values:
<mvt:item name="ry_toolbelt" param="eval|varlist('l', 'product_categories', l.all_settings)" />

Back to Top

Product_List

Product Items: Integration Guide.

Product_List provides paging links (e.g. Page: [1] 2 3 4 ), user selectable sorting, and user selectable number of items to display per page. It returns products plus the additional fields described below, allowing you to do more with less work. Use it on the PLST page template.

This item returns the products assigned to the category in the either the array l.all_settings:products for (MMUI stores) or l.all_settings:all_products:products for (CSSUI stores).

 Pagination and sorting settings are returned in l.all_settings:prod_page.

Additional Fields Returned: href, price_original, formatted_price, formatted_cost andquantity (in basket)

Integration and Optional Settings: are identical to the Category_Products item, only Category_Code is not needed. Go there for details.


Back to Top

Product_Load

Product_Load returns a product record, in the array l.all_settings:product letting you put any product information on any page.

Additional Fields Returned: href, price_original, formatted_price, formatted_cost and quantity (in basket)

Parameters:
found
: Required variable. if found returns 1.
Product_Code: Required expression.


<mvt:item name="ry_toolbelt" param="Product_Load|g.found|g.Product_Code" />
  
Example:
<mvt:if expr="g.found">
  <a href="&mvt:product:href;" title="&mvte:product:name;">

    <img src="&mvte:product:thumbnail;" alt="&mvte:product:name;">
  </a>
</mvt:if>
  
View Returned Values:
<mvt:item name="ry_toolbelt" param="eval|varlist('l', 'product', l.all_settings)" />

Back to Top

Products_New

Products_New returns the newest products added to the store in the array l.all-settings:products_new.

Additional Fields Returned: href, price_original, formatted_price, formatted_cost and quantity (in basket)

Parameters:
length
: Required variable. Contains the number of items returned.
Maxitems: Required expression. Limits the number of items returned (Default = 10)
Category_Code: Optional expression. Limit the results to new items in this category. If omitted it will select from all products.
SortBy: Optional expression. Contains keywords in the form of sortfield-direction. If omitted, the order set in Merchant is used. (i.e. disp_order-asc)
See: Category_Products for the sort keywords.


mvt:item name="ry_toolbelt" param="Products_New|g.length|g.Category_Code|g.MaxItems|g.SortBy" />
  
Example All new products: <mvt:item name="ry_toolbelt" param="products_new|g.length||10|'price-desc'" />

  
<mvt:if expr="g.length">
  <mvt:foreach iterator="item" array="products_new;">
    <a href="&mvt:item:href;" title="&mvte:item:name;">

      <img src="&mvt:item:thumbnail;" alt="&mvte:item:name;" border="0"><br>
      Price: &mvt:item:formatted_price;<br>
      &mvte:item:name;
    </a>

</mvt:if>
</mvt:foreach>
  
View Returned Values:
<mvt:item name="ry_toolbelt" param="eval|varlist('l', 'products_new', l.all_settings)" />
Back to Top

Product_NextPrev

Product_NextPrev is used on a product page to create buttons links or image links for Previous and Next products in the category. It returns the arrays l.all_settings:next and l.all_settings:prev.

Fields returned: code, href, image, thumbnail.

Parameters:
Product_Code: Required expression. Contains the code for the product.
Category_Code: Required expression. Contains the code for the category.

Add just above the closing </head> tag.
<mvt:item name="ry_toolbelt" param="Product_NextPrev|g.Product_Code|g.Category_Code" />
  
Example:
<mvt:if expr="l.settings:next:code">

  <button class="button" style="float: right" onclick="document.location.href='&mvte:Next:href;';" title="&mvte:next:code;">
    Next Product
  </button>

</mvt:if>
  
<mvt:if expr="l.settings:prev:code">
  <button class="button" style="float: left" onclick="document.location.href='&mvte:prev:href;';" title="&mvte:prev:code;">

    Previous Product
  </button>
</mvt:if>
<br style="clear:both">
  
View Returned Values:
<mvt:item name="ry_toolbelt" param="eval|varlist('l', 'prev', l.all_settings)" />

<mvt:item name="ry_toolbelt" param="eval|varlist('l', 'next', l.all_settings)" />
Back to Top

Products_Random

Products_Random returns randomly selected products from a category or from all products into the array l.all_settings:randprod.

Additional Fields Returned: href, price_original, formatted_price, formatted_cost and quantity (in basket)

Parameters:   
Category_Code:
Optional expression. Contains the code for the category you wish to locate. If omitted products are selected from all products. 
Maxitems: Required expression. Limits the number of items returned (Default = 10)

<mvt:item name="ry_toolbelt" param="Products_Random|g.category_code|g.maxitems" />

  
Examples:
<mvt:item name="ry_toolbelt" param="products_random|g.Category_Code|4" />
  
<mvt:if expr="l.settings:randprod">
  <b>Featured Products</b><br>

  <mvt:foreach iterator="prod" array="randprod">
    <a href="&mvt:prod:href;" title="&mvte:prod:name;">
      <img src="&mvte:prod:thumbnail;" alt="&mvte:prod:name;" border="0"><br>

      &mvte:prod:name;
    </a><br>
  </mvt:foreach>
</mvt:if>
  
View Returned Values:
<mvt:item name="ry_toolbelt" param="eval|varlist('l', 'randprod', l.all_settings)" />

Back to Top

Products_Related

Products_Related returns all products related to product_code into the array l.all_settings:related, letting you put any related product information on any page. You could use it on the basket page to display products related to the last item in the basket.

Additional Fields Returned: href, price_original, formatted_price, formatted_cost and quantity (in basket)

Parameters:
length
: Required variable. Contains the number of items returned.
Product_code: Required expression. Contains the code for the product you wish to locate.
Maxitems: Optional expression. Limits the number of items returned. If zero or omitted, all related products are returned.
SortBy: Optional expression. Contains keywords in the form of sortfield-direction. If omitted, the order set in Merchant is used. (i.e. disp_order-asc)
See: Category_Products for the sort keywords.


<mvt:item name="ry_toolbelt" param="Products_Related|g.length|g.Product_Code|g.Maxitems|g.SortBy" />
  
<mvt:if expr="g.length">
  <mvt:foreach iterator="item" array="related">

    <a href="&mvt:item:href;" title="&mvte:item:name;">
      <img src="&mvt:item:thumbnail;" alt="&mvte:item:name;" border="0"><br>

    </a><br>
    Price: &mvt:item:formatted_price;<br>
    &mvte:item:name;<br>
  </mvt:foreach>
</mvt:if>

  
View Returned Values:
<mvt:item name="ry_toolbelt" param="eval|varlist('l', 'related', l.all_settings)" />
Back to Top

Products_Purchased

Products_Purchased returns the stores most recently sold products in the array l.all_settings:products_purchased. Sorting options provided.

Additional Fields Returned: formatted_price, formatted_cost, href, ordercount, price_original, and quantity (in basket)

Parameters:
length: Required variable. Contains the number of items returned.
Category_Code: Optional expression. If omitted it returns best selling products from all active products.
Maxitems:
Optional expression. Limits the number of items returned (Default = 10)
SortBy: Optional expression. Contains keywords in the form of sortfield-direction. If omitted, the order set in Merchant is used. (i.e. disp_order-asc)
See: Category_Products for the sort keywords.

<mvt:item name="ry_toolbelt" param="Products_Purchased|g.length|g.Category_Code|g.MaxItems|g.SortBy" />
  
<mvt:if expr="g.length">

  <mvt:foreach iterator="item" array="products_purchased">
    <a href="&mvt:item:href;" title="&mvte:item:name;">
      <img src="&mvt:item:thumbnail;" alt="&mvte:item:name;" border="0"><br>

      Price: &mvt:item:formatted_price;<br>
      &mvte:item:name;<br>
    </a>
  </mvt:foreach>
</mvt:if>

  
View Returned Values:
<mvt:item name="ry_toolbelt" param="eval|varlist('l', 'products_purchased', l.all_settings)" />
Back to Top

Products_Viewed

Products_Viewed outputs a drop down select box of previously view products. It can be placed on any page but only tracks product page views. When a product is selected from the list, the browser returns to that product page. It returns the array l.all-settings:products_viewed

Fields Returned: catcode, href, prodcode, and prodname,  When the keyword RAW  is used nothing is output and images are also returned; image and thumbnail;

Parameters:
Maxitems: Optional expression. Limits the number of items returned. (Default = 10)
Maxage: Optional expression. Determine how many minutes to keep track. Default = 740 (12 hrs), Max value = 1440 (24 hrs)
RAW: Optional keyword. Suppresses drop down output and just returns the data and also returns image and thumbnail fields.

<mvt:item name="ry_toolbelt" param="Products_Viewed|g.maxitems|g.maxage|RAW" />
  
Example 1: Output the select box
<mvt:item name="ry_toolbelt" param="Products_Viewed|8|120|" />

Displays a select box of the last 8 items viewed in the last 2 hours.
  
Example 2: Manually output the select box using default values.
<mvt:item name="ry_toolbelt" param="Products_Viewed|||RAW" />
<mvt:if expr="l.settings:products_viewed">
  <select id="prevlist" name="prevlist"

      style="width: 160px; margin: 0 auto;"
      onchange="document.location.href=this.options[this.selectedIndex].value">
    <option selected="selected">-- Previously Viewed --</option>
    <mvt:foreach iterator="view" array="Products_Viewed">

      <option value="&mvt:view:href;">&mvte:view:prodname;</option>
    </mvt:foreach>
  </select>
</mvt:if>
  
Example 3: Display 3 thumbnail images of products viewed in the last 6 hours.
<mvt:item name="ry_toolbelt" param="Products_Viewed|3|360|RAW" />

<mvt:if expr="l.settings:products_viewed">
  <b>Previously Viewed</b><br>
    <mvt:foreach iterator="view" array="Products_Viewed">
        <a href="&mvt:view:href;" title="&mvte:view:prodname;">

            <img src="&mvte:view:thumbnail;" alt="&mvte:view:prodname;"><br>
            &mvte:view:prodname;
        </a><br>
    </mvt:foreach>
</mvt:if>

  
View Returned Values:
<mvt:item name="ry_toolbelt" param="eval|varlist('l', 'products_viewed', l.all_settings)" />
Back to Top

Pricegroup

Description and Examples

These ten items provide you with all the tools you need to manage customer and products in pricegroups. 
<mvt:item name="ry_toolbelt" param="pricegroup|Load_All|g.count" />
<mvt:item name="ry_toolbelt" param="pricegroup|Load_Name|g.pg_found|prgp_name_or_csv_list" />

 
<mvt:item name="ry_toolbelt" param="pricegroup|Customer_Groups|g.count" />
<mvt:item name="ry_toolbelt" param="pricegroup|Customer_Find|g.found|prgp_name_exprsn" />

<mvt:item name="ry_toolbelt" param="pricegroup|Customer_Insert|g.result|prgp_name_exprsn" />
<mvt:item name="ry_toolbelt" param="pricegroup|Customer_Delete|g.result|prgp_name_exprsn" />
 

<mvt:item name="ry_toolbelt" param="pricegroup|Product_Groups|g.count|product_code_exprsn" />
<mvt:item name="ry_toolbelt" param="pricegroup|Product_Find|g.found|prgp_name_exprsn|product_code_exprsn" />
<mvt:item name="ry_toolbelt" param="pricegroup|Product_Insert|g.result|prgp_name_exprsn|product_code_exprsn" />

<mvt:item name="ry_toolbelt" param="pricegroup|Product_Delete|g.result|g.product_code_exprsn" />
Back to Top

PreAction PostAction

Description and Examples PreAction & PostAction are not commands in the traditional sense. They are intercepts that allow you to insert script directly before or after any Miva Merchant action and affect the processing of the form data using regular Storemorph page templates as a subroutine. You can also construct your own custom action command scripts.

Examine any page template that contains a form and you will find an action command. When the form is submitted the action instructs Merchant what to do with the data. for example the ICST action tells merchant to inser a new customer record.  Merchant will validate the data before saving the record but if an error occurs, the user is returned to the page to correct the error. If you add additional fields to the form, Merchant will simply ignore them. By inserting one or both of these new actions you can provide your own validation or processing scripts for the extra data.

<input type="hidden" name="keyword" value="keyword_pagecode">
  
Example:
<input type="hidden" name="PreAction" value="PREACTION_ACAD">

<input type="hidden" name="Action" value="ICST">
<input type="hidden" name="PostAction" value="POSTACTION_ACAD">

The PREACTION_ and POSTACTION_ case prefixes are required parts of the page codes. For security, Toolbelt will not allow Merchant to display an page with those prefixes.

In this example PREACTION_ACAD and POSTACTION_ACAD are the specially named page codes for the custom page templates that contain the validation script. Click description and examples for more detailed information.

Back to Top

Query

This powerful item allows you to execute ANY well formed MySQL query on any Merchant table within your domain or store. IMPORTANT: Knowledge of MySQL and database tables is essential. It is possible to execute queries that can permanently alter or delete the data and tables within your store. Use with extreme caution and always back up your data before testing any query that modifies data.

In the examples below, query_string_expression must be contain a valid MySQL query. Records will be returned in a structured array of records in the form l.all_settings:array_name[n]:field_name. This allows you to use the foreach command to loop through the results.

Important: Table names are case sensitive. text strings like g.customer_lname must be embedded in single quotes however due to a limitation in page templates, you have to use the left quote as shown below. Toolbelt will change these to single quotes for you.

<mvt:item name="ry_toolbelt" param="query|query_string|array_name" />
  
Example:
<mvt:item name="ry_toolbelt" param="assign|g.sql|'
SELECT * FROM s01_Orders WHERE (ship_lname = `' $ g.customer_lname $ '`) ORDER BY id ASC'" />

<mvt:item name="ry_toolbelt" param="query|g.sql|MyOrders" />
  
View Returned Values: 
<mvt:item name="ry_toolbelt" param="eval|varlist('l', 'MyOrders', l.all_settings)" />

Back to Top

Random_Numbers

Generates a non repeating sequence of "size" randomly generated numbers between 1 and limit

<mvt:item name="ry_toolbelt" param="random_numbers|return_array|size_exprsn|limit_exprsn" />

  
Example: <mvt:item name="ry_toolbelt" param="random_numbers|l.all_settings:shuffle_cards|52|52" />
Back to Top

Reference

The item creates a reference from one variable to another, such that changes to one will be made to the other. One use would be to reference one of the the data structures in l.all_settings so that it can be passed in a global variable or a form. It is much more efficient to make a reference to a structure than making a copy with the assign item. For example;  the l.settings data is not normally available to a page template called using the Screen item. The reference item elegantly gets around that limitation.

<mvt:item name="ry_toolbelt" param="reference|new_variable_name|old_variable_name" />
  
Example:
Create a reference to the products data structure then call a page template called CUSTOM
<mvt:item name="ry_toolbelt" param="reference|g.clone_products|l.all_settings:products" />

<mvt:item name="ry_toolbelt" param="screen|CUSTOM" />
  
Then in the screen CUSTOM, reverse the reference to restore the data.
<mvt:item name="ry_toolbelt" param="reference|l.all_settings:products|g.clone_products" />

Back to Top

RememberMe

These items work together to allow customers to stay logged into your web site even after browsing to another site or closing the browser. When they return to your site, they will be automatically logged in. If they logout, the rememberme settings are cleared.

  • 1. Add the save item and prompt to the four page templates shown below. Insert the item inside the form tags directly below the submit button on theses pages;
    LOGN Customer Login, ORDL Order: Customer Login, ACAD Customer Create, and ACED Customer Edit.
  • 2. Add the load item to the bottom of the HEAD Tag Content.
  • 3. Note: These items won't work if the customer has cookies disabled. The login cookie expires after 1 year of inactivity.
<mvt:item name="ry_toolbelt" param="rememberme|load" />
<mvt:item name="ry_toolbelt" param="rememberme|save" /> Remember me on this computer?

Back to Top

Screen

Given a Screen code, displays the contents of any page template at any location inside another page. This allows you to create sub-screens that can be inserted (i.e. mini basket, featured products) inside another page. Optionally a variable name can be added and the screen returned in a global variable.

<mvt:item name="ry_toolbelt" param="screen|screen_code" />
<mvt:item name="ry_toolbelt" param="screen|screen_code_exprsn|g.variable" />

  
Example:
<mvt:item name="ry_toolbelt" param="screen|'MINI'" />
<mvt:item name="ry_toolbelt" param="screen|'INFO' $ g.pagenumber|g.results" />

Note: Make sure any needed global variables are set prior to calling (e.g. g.product_code, g.category_code, etc.)

Back to Top

Search_Products

Product Items: Integration Guide.

Search_Products provides advanced product search options, paging links (e.g. Page: [1] 2 3 4 ), user selectable sorting and user selectable number of items to display per page. You can specify fields to search including custom fields and search specific categories. It returns the products found plus additional fields described below, allowing you to do more with less work. Use it on the Search Page template in conjunction with the Search Results Layout, or used to create alternate search page layouts as described in the integration guide.

This item returns the products found in the either the array l.all_settings:products for (MMUI stores) or l.all_settings:search_results:products for (CSSUI stores).

 Pagination and sorting settings are returned in l.all_settings:prod_page.

Additional Fields Returned: href, price_original, formatted_price, formatted_cost and quantity (in basket)

Parameters:
length: Required variable. Contains the number of items returned.
Maxitems: Required expression. This number sets the items displayed per page. Default value is 12. Assign  Maxitems = 'ALL' to display all records. You can set Maxitems as a fixed value or use the radio controls provided to make it user selectable.
SortBy: Contains one of the following keywords in the form of sortfield-direction. If omitted, the order set in Merchant is used.
id-desc = Newest Items
price-asc = Price LOW to high
price-desc = Price HIGH to low
name-asc = Name a-z
name-desc = Name z-a
code-asc = Code a-z
code-desc = Code a-z
default-asc = Default display order

Global Variables Used:
Product_Search:
Required expression. Contains each search term separated by a space.
Search Category:
Optional expression. Allows you to limit the search to certain categories. Contains the code for the category products you wish to search. HINT: You could create a drop down load of categories to make it user selectable, create alternate search pages for certain categories, or integrate the search feature directly into a category page template.
g.PageNum: Is used in the pagination and sorting features.
g.SortBy:
Optional expression. A default sorting value can be set before calling the item as show below.
g.Sortby_Options: Optional expression. Lets you set a string before calling the item, to change the sort option values to use in the dropdown box.
This is a colon plus comma separated list formatted as keyword:prompt,keyword:prompt etc.
The default options are shown in the integration guide below. Edit as desired.

Integration:  Step 1. Paste this section directly above the closing tag  of the head section</head>

<!-- Style the pagination section. -->
<style type="text/css">
.paging { text-align: right; }
.paging .count { float: left; margin: 4px 24px 0 0; }
.paging .max { float:left; }
.paging .sort{ }
.paging .page{ float: left; margin-right: 48px;}
.paging .pages { float: left; }
.paging a.current { font-weight: bold; font-size; 13px; }
</style>
  
<!-- Optional: Limit the search to a specific category. -->
<mvt:if expr="ISNULL g.Search_Category">
  <mvt:item name="ry_toolbelt" param="assign|g.Search_Category|'enter a category code to search'" />

</mvt:if>
  
<!-- Optional: Set the maximum items to display -->
<mvt:if expr="ISNULL g.Maxitems">
  <mvt:item name="ry_toolbelt" param="assign|g.Maxitems|8" />

</mvt:if>
  
<!-- Optional: Set the Maximum items radio button options -->
<mvt:item name="ry_toolbelt" param="assign|g.maxradio:min|8" />
<mvt:item name="ry_toolbelt" param="assign|g.maxradio:max|24" />

  
<!-- Optional: Set a default sort value -->
<mvt:if expr="ISNULL g.SortBy">
  <mvt:item name="ry_toolbelt" param="assign|g.SortBy|'price-desc'" />
</mvt:if>

  
<!-- Optional: Set the options displayed in the sort list. Delete or Edit as desired. -->
<mvt:item name="ry_toolbelt" param="assign|g.Sortby_Options|
'id-desc:Newest Items,price-asc:Price LOW to high,price-desc:Price HIGH to low,' $
'name-asc:Name a-z,name-desc:Name z-a,code-asc:Code a-z,code-desc:Code a-z,'" />
  
<mvt:item name="ry_toolbelt" param="Search_Products|g.length|g.Maxitems|g.Sortby" />

Integration:  Step 2. Locate the search <form> and find the "search" text field. <input type="text" name="Search"... /> change name="Search" to name="Product_Search".
If you have other search forms on your screen (e.g the global header or category tree), change them as well.

Integration:  Step 3.  In the template search for the closing </h1> tag. Paste this section directly after the tag and any closing </mvt:if> that may be found with it.

<mvt:if expr="l.settings:prod_page:records GT 0">

    <div class="paging">
        <div class="count">PRODUCTS: <b>&mvt:prod_page:records;</b></div>
        <mvt:if expr="l.settings:prod_page:records GT 1">

            <div class="max">Show: &mvt:prod_page:maxradio;</div>
        </mvt:if>
        <mvt:if expr="l.settings:prod_page:records GT 1">
            <div class="sort">Sort By: &mvt:prod_page:sortselect; </div>

        </mvt:if>
        <mvt:if expr="l.settings:prod_page:count GT 1">
            <div class="page">Page: <b>&mvt:prod_page:current;</b> of &mvt:prod_page:count;</div>

            <div class="pages">Pages: &mvt:prod_page:links;</div>
        </mvt:if>
        <br style="clear: left">
    </div>

</mvt:if>

Integration:  Step 4. Click the Search Results Layout tab. You will have to update the product links on this template to &mvte:product:href; Example: <a href="&mvte:product:href;"> Also find the part of the script that displays the Previous and Next buttons. Delete it and paste this in its place.

<mvt:if expr="l.settings:prod_page:records GT 0">

    <div class="paging">
        <mvt:if expr="l.settings:prod_page:count GT 1">
            <div class="page">Page: <b>&mvt:prod_page:current;</b> of &mvt:prod_page:count;</div>

            <div class="pages">Pages: &mvt:prod_page:links;</div>
        </mvt:if>
        <br style="clear: left">
    </div>

</mvt:if>

View Returned Values: To temporarily view the pages data paste this directly above the closing </body> tag.

<mvt:item name="ry_toolbelt" param="eval|varlist('l', 'products', l.all_settings)" />

<mvt:item name="ry_toolbelt" param="eval|varlist('l', 'prod_page', l.all_settings)" />
Back to Top

SearchArray

Binary Search a sorted array; returns the index if found or 0. Results are so fast that timing is meaningless.

<mvt:item name="ry_toolbelt" param="searcharray|g.found_index|array_variable|search_exprsn" />
Back to Top

SearchText

When given a delimited text file data, this item searches for a string and returns the text record (the line of text) containing the search string.
Parameters:
return_record: The line of text returned if a match is found. If not found return_record contains a null string.
filedata: This is the delimited text data that will be searched.
search: The search text.
fieldnumber: The field number that will be searched where field is defined as each column of text. If fieldnumber is 0, all fields are searched.
sepchar: The character that seperates each record. Common values could be a comma or tab ( e.g. ',' or asciichar(9) ) but can be any character.

Note: Leading and trailing spaces in the search string and the searched field are ignored.

Usage:
<mvt:item name="ry_toolbelt" param="searchtext|return_record|filedata|search|fieldnumber|sepchar/" />
  
Example: Load a tab separated text file, and search it for shipping rates.
<mvt:item name="ry_toolbelt" param="assign|g.size|file_read('/mm5/ShippingRates.txt', 'script', g.filedata)" />

<mvt:if expr="g.size">
  <mvt:item name="ry_toolbelt" param="searchtext|g.return|g.filedata|'FL'|1|asciichar(9)" />
  <mvt:if expr="g.return">
    <mvt:item name="ry_toolbelt" param="assign|g.USPS:standard|trim(gettoken(g.return,asciichar(9),2))" />

    <mvt:item name="ry_toolbelt" param="assign|g.USPS:firstclass|trim(gettoken(g.return,asciichar(9),3))" />
    <mvt:item name="ry_toolbelt" param="assign|g.USPS:priority|trim(gettoken(g.return,asciichar(9),4))" />

  </mvt:if>
</mvt:if>
Back to Top

SendEmail

Sends a text or html email; where g.mail can be any variable name with values assigned as shown below and html or text designates the type of email to send.

<mvt:item name="ry_toolbelt" param="sendemail|g.mail|html" />
<mvt:item name="ry_toolbelt" param="sendemail|g.mail|text" />

  
Example:
<mvt:item name="ry_toolbelt" param="assign|g.mail:to|'[email protected]'" />
<mvt:item name="ry_toolbelt" param="assign|g.mail:from|'[email protected]'" />

<mvt:item name="ry_toolbelt" param="assign|g.mail:cc|'[email protected]'" />
<mvt:item name="ry_toolbelt" param="assign|g.mail:subject|'This is an email test'" />
<mvt:item name="ry_toolbelt" param="assign|g.mail:message|'This is the message'" />

<mvt:item name="ry_toolbelt" param="sendemail|g.mail|text" />
<mvt:item name="ry_toolbelt" param="assign|g.mail:message|'This is the <b>HTML</b> message'" />

<mvt:item name="ry_toolbelt" param="sendemail|g.mail|html" />
Back to Top

SeoLinks_SeoLink

These two items, SeoLinks & SeoLink, provide the simplest way possible to convert your site to short SEO links configured under Domain | SEO Settings. A page template SEOLINKS_Demo.txt is provided in the zip file to fully illustrate this item in action. A major benefit is that if you change your SEO settings later or even change your domain name, all your links are instantly updated and you won't have to revise your site.

Add SeoLinks item anywhere in the HEAD Tag Content/CSS section to globally load all of the store links into the data structure call l.all_settings:href.

Parameters:   
Category_code:
Required expression. Contains the code for the category.
Product_code: Required expression. Contains the code for the product.


Usage: Add to the head tag.
<mvt:item name="ry_toolbelt" param="seolinks" />
  
Example 1: Store links
<a href="&mvt:href:storefront; ">Storefront</a> |

<a href="&mvt:href:product_list; ">Product list</a> |
<a href="&mvt:href:search; ">Search</a> |
<a href="&mvt:href:sitemap; ">Sitemap</a> <br>

  
<a href="&mvt:href:customer_login; ">Customer login</a> |
<a href="&mvt:href:customer_account; ">Customer account</a> |
<a href="&mvt:href:order_history_login; ">Order History Login</a> |

<a href="&mvt:href:affiliate_account; ">Affiliate account</a> |
<a href="&mvt:href:affiliate_login; ">Affiliate login</a> <br>
<br>
<a href="&mvt:href:basket; ">Basket</a> |

<a href="&mvt:href:checkout; ">Checkout</a> |
<a href="&mvt:href:checkout_noaccount; ">Checkout without an Account</a><br>
  
Example 2: Canonical links can be added to the head tag so duplicate content is be ignored by Google.
<mvt:if expr="g.screen EQ 'PROD'">

  <mvt:if expr="g.Category_Code">
    <link rel="canonical" href="&mvt:href:category_product;" />
  <mvt:else>
    <link rel="canonical" href="&mvt:href:product;" />

    </mvt:if>
</mvt:if>
  
<mvt:elseif expr="g.screen EQ 'CTGY'">
    <link rel="canonical" href="&mvt:href:category;" />

</mvt:if>
  
Add to the SFNT template <head> section
<link rel="canonical" href="&mvt:href:storefront;" />

Use SeoLink for category and product links everywhere in your store. It comes in three formats. Each item is optimized for placement inside the foreach loops. Internally each item stores a formatted template for the link the first time its called. On subsequent links it simply replaces part of the template with the correct code. The templates can be displayed using &mvt:href::template_cat; , &mvt:href::template_prod; , and &mvt:href::template_catprod;

Usage:
<mvt:item name="ry_toolbelt" param="seolink|category|g.Category_code" />
<mvt:item name="ry_toolbelt" param="seolink|product|g.Product_Code" />

<mvt:item name="ry_toolbelt" param="seolink|category_product|g.Category_code|g.Product_Code" />
  
Example 3: Category Tree
<mvt:foreach iterator="cattree_category" array="categories">
    <mvt:item name="ry_toolbelt" param="seolink|category|l.all_settings:cattree_category:code" />

    Locate every <a> tag in the foreach loop and replace it with this.
    <a href="&mvt:href:category;">
  
Example 4: Category Product List Layout.
<mvt:foreach iterator="product" array="products">
    <mvt:item name="ry_toolbelt" param="seolink|category_product|g.category_code|g.product_code" />

    Locate every <a> tag in the foreach loop and replace it with this.
    <a href="&mvt:href:category_product;">
  
Example 5: Product List Layout
<mvt:foreach iterator="product" array="products">
    <mvt:item name="ry_toolbelt" param="seolink|product|l.all_settings:product:code" />

    Locate every <a> tag in the foreach loop and replace it with this.
    <a href="&mvt:href:product;">
  
Example 6: Basket Contents
<mvt:foreach iterator="item" array="basket:items">
    <mvt:item name="ry_toolbelt" param="seolink|product|l.all_settings:item:code" />

    Locate every <a> tag in the foreach loop and replace it with this.
    <a href="&mvt:href:product;">
  
View Returned Values:
<mvt:item name="ry_toolbelt" param="eval|varlist('l', 'href', l.all_settings)" />

Back to Top

Trace

The Trace debugging item outputs red text directly into you web page so you can visually see which toolbelt commands are being executed. Add trace to the top of your page template.

Two keywords control the output:
TOOL: Shows when an item is called. e.g. tool: assign.
PARAM: Shows the entire toolbelt command e.g. params: assign|g.sep|' ' $ asciichar(38) $ 'raquo; '.

If you want to trace a small section of code, you can turn trace off by omitting a keyword.

Usage: Add anywhere within a page to start Trace.
<mvt:item name="ry_toolbelt" param="Trace|TOOL" />
<mvt:item name="ry_toolbelt" param="Trace|PARAM" />

  
Stop Trace:
<mvt:item name="ry_toolbelt" param="Trace|" />
Back to Top

SortArray

Sorts an single dimension array blazingly fast.

<mvt:item name="ry_toolbelt" param="sortarray|array_variable" />
Back to Top

SortCSV

Given a list of comma separated values, returns a sorted copy.


<mvt:item name="ry_toolbelt" param="sortcsv|g.sorted_variable|g.unsorted_variable" />
  
Example:
<mvt:item name="ry_toolbelt" param="assign|g.top5|'Rihanna,Perry,Beyonce,Spears,Rudolf'" /> <br>

<mvt:item name="ry_toolbelt" param="sortcsv|g.sorted|g.top5" />
<br>&mvt:global:sorted;<br>
Back to Top

StripHTML

Returns a copy of a string with all HTML stripped out. See Striphtml() in Additional Functions.

<mvt:item name="ry_toolbelt" param="striphtml|g.stripped|g.string_exprsn" />
  
Example:
<mvt:item name="ry_toolbelt" param="striphtml|g.text_only|l.all_settings:product:descrip" />

Back to Top

Structure

Structure reveals the internal structure of any SQL database table for inspection. Table name are case sensitive and for security, are limited to the store tables.

<mvt:item name="ry_toolbelt" param="structure|g.table_exprsn|returnarray" />

  
Example: <mvt:item name="ry_toolbelt" param="structure|'Products'|ProdStruct" />
  
<b>Products Table Structure</b>
<table border="0">

<tr><th>Name</th><th>Type</th><th>Decimals</th><th>Length</th></tr>
<mvt:foreach iterator="struct" array="ProdStruct">

<tr>
<td>&mvt:struct:field_name; </td>
<td>&mvt:struct:field_type; </td>
<td>&mvt:struct:field_dec; </td>
<td>&mvt:struct:field_len; </td>

</tr>
</mvt:foreach>
</table>
Back to Top

Varlist

Like a popular free helper module, this item returns a sorted list of global, system or local variable names, entity expressions, and values.
Two version are provided, the Varlist() function and the depreciated Varlist item.

HINT #1: Comment out the item without removing it. Change eval to #eval.
HINT #2: Use your IP address so that only you see the output. Your IP address is 98.231.106.220
HINT #3: Add a filter to the function so you can limit it's output.

Parameters:   
variable_type:
Required string literal. Indicates what type of variables to return. Use 'g' for global, 'l' for l.all_settings, 's' for system
filter: Optional string literal. Contains name of the array or structure you wish to view. e.g. 'products_viewed'.
l.all_settings: Required constant. l.all_settings must be passed to the function.

<mvt:item name="ry_toolbelt" param="#eval|varlist(variable_type, filter, l.all_settings)" />
  
Example 1: Only allow you to see ALL variables
<mvt:if expr="s.Remote_Addr EQ '98.231.106.220'">

    <mvt:item name="ry_toolbelt" param="eval|varlist('l', 'products', l.all_settings)" />
    <mvt:item name="ry_toolbelt" param="eval|varlist('g', '', l.all_settings)" />

    <mvt:item name="ry_toolbelt" param="eval|varlist('s', '', l.all_settings)" />
</mvt:if>
  
Example 2: Capture the state of a variable or array and display it later.
<mvt:item name="ry_toolbelt" param="assign|g.storelist|varlist('l', 'store', l.all_settings)" />

  
&mvt:global:storelist;
  
Example 3: Depreciated Varlist item.
<mvt:item name="ry_toolbelt" param="varlist|local" />
<mvt:item name="ry_toolbelt" param="varlist|global" />

<mvt:item name="ry_toolbelt" param="varlist|system" />