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
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(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 Home
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('Home')" />
&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.
Description and Examples
These fourteen items provide you with all the tools you need to manage customers, categories and products in availability groups.
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.
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>
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>
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. <!-- -->
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.
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.
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.
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.
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.
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.
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>
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.
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
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.
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.
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.
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.
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
SHORTDATE
11/23/2008
MEDIUMDATE
Nov 23, 2008
LONGDATE
November 23, 2008
FULL
Thursday, November 23, 2008 CE 0:05:11 p.m. EST
SHORTTIME
12:05
MEDIUMTIME
12:05:11
LONGTIME
00:05:11 p.m.
* GMTSTRING
Thu, 04-Dec-2009 16:30:03 GMT
Format string examples
Results
yy, yyyy
08, 2008
m, mm, mmm, mmmm
1, 01, Jan, January
d, dd, ddd, dddd
4, 04, Thu, Thursday
h, hh, m, mm, s, ss
6, 06, 3. 03, 9, 09
hh:mm:sec zone
17:30:15 EST
mm/dd/yyyy
12/04/2008
ddd, mmm. d, yyyy
Thu, Dec. 4, 2008
dddd, mmmm d, yyyy h:mm ampm zone
Thursday, 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
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.
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.
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;
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.
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.
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;
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]
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>
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.
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.
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.
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.
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)" />
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.
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)
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.
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.
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)" />
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.
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.
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)" />
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" />
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?
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.
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.
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.
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>
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" />
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)" />
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|" />
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.
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" />