Store Front   Account  Search  Product List  Basket Contents
 
Perpetual Basket Display Module Info Quantity in Basket: 0

Sign In

Affiliate Login




Software Software +


One Sheet One Sheet (197)
Three Sheet Three Sheet (1)
30X40 US 30X40 US (1)
40X60 US 40X60 US (1)
Six Sheet Six Sheet (1)
Color Still Set Color Still Set (3)
Color Still Color Still (3)
Day Bill Day Bill (1)
Flyer Flyer (1)
Glass Slide Glass Slide (1)
Herald Herald (5)
Half Sheet Half Sheet (18)
Insert Insert (9)
Lobby Card Set Lobby Card Set (48)
Lobby Card (1) Lobby Card (1) (127)
Large Lobby Card Large Lobby Card (1)
Magazine Ad Magazine Ad (1)
Other Other (1)
Press Book Press Book (19)
Program Program (1)
Press Kit Press Kit (7)
Sheet Music Sheet Music (2)
Still - Regular Still - Regular (20)
Subway Subway (1)
Title Card (1) Title Card (1) (4)
Window Card Window Card (13)
Autographs Autographs


Lithograph Lithograph +
Print Print +
Power Search Module Info

Gift or Wish List Module Info
Contact Manager Module Info
Shopping Pad Module Info
Tell a Friend Module Info

TOOL KIT v5
Emporium Plus > Software > New for Merchant 5
Emporium Plus > Software > User Interface Modules
 
Quantity in Basket: none
Code: 1AA00223
Current Price: $39.95
Reg. $39.95 as low as: $27.00
Volume Price
Quantity Price Each
1$39.95
2-5$35.00
6-9$30.00
10+$27.00
 
Miva Merchant Version::
5.x
Your Merchant URL::
 
Quantity:
 
Easily and quickly extend the Merchant 5.x store morph technology (SMT) coding system. This page demonstrates the use of the tool kit function library to fill in many of the gaps in the SMT coding system by using this module's item tags, similar to those you are familiar with in your page templates. It also contains many functions for extending the capabilities of your store without additional modules. Stores developers, who were used to the tokens used in 4.x, will find this addition to Merchant 5.x to be very useful. New Merchant users will find the use of item tag tokens to be quite easy and a great addition to the already extensive capabilities of Merchant.

Below is a list of functions currently in the tool kit. There is also example code using each function. You can see by copying and pasting the example code that you can quickly enhance your page templates with features you thought were not possible without extensive coding or over-priced modules.
  • String - substring, newsubstring, gettoken, vgettoken, vassign, sassign, vlength, vglosub, sglosub, concat, padl, padr, no_apostrophe
  • Math - math_add, math_subtract, math_multiple, math_divide, math_round, currencyformat
  • Time/date - set_time_zone, time_t_year, time_t_month, time_t_dayofmonth, time_t_hour, time_t_minute, time_t_dayofweek, mktime_t
  • Arrays - vacreate, sacreate
  • External file insertion - callurl, vcallurl, sexists
  • Mini-page insertion - render
  • Products in category list - cxp, cxpc
  • Product find - vproduct_find, sproduct_find
  • Featured products - quick, vquick
  • Best sellers - bestseller
  • New products - last, lastcat
  • Related products - related
  • Recommendation engine (suggested products) - alsobought
  • Category lists - parentcat, subcat, subcat1, subcat2, subcat3, subcat4, catimage, cattreeimage
  • Price/Availability Groups - agrpinsert, pgrpinsert, pgroup, agroup, pgroup-p, agroup-p, agroup-c, agroup-cats
  • Mini-basket - basket
  • Breadcrumb navigation - breadcrumb, childof
  • Custom fields - custom
  • Tool tips - newstring, nohtml, no_apostrophe
  • Next/Previous buttons - nextprevious
  • Attribute prompt vs code - prompt
  • Basket weight - weight
  • Basket subtotal - subtotal
  • Basket clear all - clearall
  • Basket one click update - basketoneclick
  • Continue shopping - lasturl, create, trim, remove
  • Order subtotal - subtotalorder
  • Open (expanded) category tree - parentcat, subcat, subcat1, subcat2, subcat3, subcat4
  • State alphabetical list - states
  • Force login - render
  • Keep customer logged in - logbackin
  • Order history - pastorders
  • Reorder - see pastorders
  • Printable Invoices - pastorders
  • Elapsed time for page render - vassign, math_subtract
  • Random product display - sassign, random, vrandom, math_add, vgettoken, vproduct_find, concat, math_subtract
  • Flat file access - import, export
  • Real time export order to XML file - exportxmlbegin, exportxml, exportxmlend

Detailed List of Tool Kit Functions with Examples:

For the purpose of the string function demo, the following text is used. "This page demonstrates the use of the tool kit function library to create new variables and make changes to existing variables inside the Merchant 5.x store morph templates. The %product_name% can easily replace a token within a description field. #Alternate Description: Can have other text here, e.g. greeting"

1. Use the substring to show the first x characters in a string. In this example,
<mvt:item name="toolkit" param="substring|l.all_settings:product:descrip,1,20" />,
we display the first 20 characters in the product description.
This page demonstrat

Alternatively, if you want to save the substring to a new variable, you can use the newsubstring function. For example,
<mvt:item name="toolkit" param="newsubstring|new_desc|l.all_settings:product:descrip,1,200" />
This is used in the balloon tooltip functionality as seen here.

2. Use the gettoken to separate a string using a delimiter character. In this example,
<mvt:item name="toolkit" param="gettoken|l.all_settings:product:descrip,#,2" />
we display the text after the # in the product description.
Alternate Description: Can have other text here, e.g. greeting
A variation of this is the vgettoken which allows use of a variable in the last parameter instead of a constant. So you could change the 2 above to a variable.

If you want to save the result to a variable rather than display immediately, you can add a third parameter to the function. For example:
<mvt:item name="toolkit" param="gettoken|l.all_settings:product:descrip,#,2|newtext" />
would save the portion of the full text to a variable called newtext. An example of this feature can be used with other tool kit functions to display random products from a list of product codes. Below is example code. Note that the random function uses a number one less than the total number of codes in the list of codes. Then one is added back to it after the random number is obtained.
<br />
<mvt:item name="toolkit" param="sassign|codes|SR_00013#1S_00001#LCS00002#LC_00001#LC_00002#1S_00002#TC_00008" />
<mvt:item name="toolkit" param="sassign|one|1" />
<mvt:item name="toolkit" param="random|nrandom|6" />
<mvt:item name="toolkit" param="math_add|thisone|nrandom|one" />
<mvt:item name="toolkit" param="vgettoken|codes,#,thisone|select_product_code" />
<mvt:item name="toolkit" param="vproduct_find|productfound|select_product_code" />
<img src="&mvt:key_product:image;" border="0">
<br />
&mvt:key_product:name;
<br />
&mvt:key_product:formatted_price;


3. Use the vassign to create and name a global variable from a variable. In this example,
<mvt:item name="toolkit" param="vassign|product_name|l.all_settings:product:name" />

creates a variable named product_name from the dynamic variable l.all_settings:product:name. Then you can use the mvt to evaluate the global:product_name variable.
TOOL KIT v5

nohtml function works just like the vassign except that it will strip html out of the variable before assigning it to the new variable. This is useful for creating a variable for use on the category page or meta tag on the product page that has no html. Then you can use the substring function to limit the number of characters displayed, e.g. a shorter description might have just the first 200 characters of the description with the html stripped out. Replace vassign with nohtml in the example above to use this function. For example, this is used in the balloon tooltip functionality as seen here.

4. Use the sassign to create and name a global variable from a string. In this example,
<mvt:item name="toolkit" param="sassign|greeting|Happy Mother\'s Day" />

creates a variable named greeting from the string "Happy Mother's Day". Note the use of the backslash to escape the apostrophe character. Then you can use the mvt to evaluate the global:greeting variable.
Happy Mother's Day

5. Use the vlength to create and name a global variable which is the length (number of characters) of another variable. In this example,
<mvt:item name="toolkit" param="vlength|name_length|l.all_settings:product:name" />

creates a variable named name_length from the length of the dynamic variable l.all_settings:product:name. Then you can use the mvt to evaluate the global:name_length variable or you can use it in other functions.
11

6. Use the vglosub to replace a string with a dynamic variable inside of another variable. For example, in the product description you can replace the %product_name% with a variable. <mvt:item name="toolkit" param="vglosub|l.all_settings:product:descrip,%product_name%,l.all_settings:product:name" />
In this example it replaces it with the l.all_settings variable.
This page demonstrates the use of the tool kit function library to create new variables and make changes to existing variables inside the Merchant 5.x store morph templates. The TOOL KIT v5 can easily replace a token within a description field. #Alternate Description: Can have other text here, e.g. greeting


7. You can use the same vglosub to replace a string with a variable that you create with the assign commands above in the page template. As example,
<mvt:item name="toolkit" param="vglosub|l.all_settings:product:descrip,greeting,g.greeting" />
use the g.greeting variable as the replacement.
This page demonstrates the use of the tool kit function library to create new variables and make changes to existing variables inside the Merchant 5.x store morph templates. The TOOL KIT v5 can easily replace a token within a description field. #Alternate Description: Can have other text here, e.g. Happy Mother's Day


8. Use the sglosub to replace a string with another string. For example,
<mvt:item name="toolkit" param="sglosub|l.all_settings:product:descrip,function,features" />
replace the word function with the word features in the product description.
This page demonstrates the use of the tool kit features library to create new variables and make changes to existing variables inside the Merchant 5.x store morph templates. The TOOL KIT v5 can easily replace a token within a description field. #Alternate Description: Can have other text here, e.g. Happy Mother's Day

For the purpose of the math demo, the product price is $2.00 and the product cost is $3.00.

9. Use the math_add to calculate the sum of two variables to a new number. For example,
<mvt:item name="toolkit" param="math_add|sum|l.all_settings:product:price|l.all_settings:product:cost" />
sum the price plus the cost to get a variable called sum.
5

10. Use the math_subtract to calculate the difference between two variables to a new number. For example,
<mvt:item name="toolkit" param="math_subtract|difference|l.all_settings:product:cost|l.all_settings:product:price" />
subtract the cost minus the price to get a variable called difference.
1
This function comes in handy if you are bench marking your page development to see how fast pages load and how new code on the page might effect load times. For example, put
<mvt:item name="toolkit" param="vassign|starttime|dyn_time_t" />
at the beginning of the page template. Then at the end of the page template, put
<mvt:item name="toolkit" param="vassign|endtime|dyn_time_t" />
<mvt:item name="toolkit" param="math_subtract|elapsed|endtime|starttime" />
Elapsed Time: &mvte:global:elapsed; seconds


11. Use the math_multiply to save the result of variable1 times variable2 to a new number. For example,
<mvt:item name="toolkit" param="math_multiply|times|l.all_settings:product:cost|l.all_settings:product:price" />
multiply the cost times the price to get a variable called times.
6

12. Use the math_divide to save the result of variable1 divided by variable2 to a new number. For example,
<mvt:item name="toolkit" param="math_divide|result|l.all_settings:product:cost|l.all_settings:product:price" />
multiply the cost times the price to get a variable called times.
1.5

13. Use the currencyformat to format a variable to a text string formatted to the store's currency. For example,
<mvt:item name="toolkit" param="currencyformat|formatted_savings|difference" />
Format the difference between the cost and price to show savings.
Savings: $1.00

14. Use the a combination of functions to show percent savings of one price off another. The mathematical operation needs to be broken down into multiple steps. For example,
<mvt:item name="toolkit" param="math_subtract|difference|l.all_settings:product:cost|l.all_settings:product:price" />
<mvt:item name="toolkit" param="math_divide|result|difference|l.all_settings:product:cost" />
<mvt:item name="toolkit" param="sassign|value2|100" />
<mvt:item name="toolkit" param="math_multiply|times|result|value2" />
<mvt:item name="toolkit" param="math_round|times|times|2" />
obtains the difference between the cost and price. Then divides the difference by the cost. Then multiplies that division result times 100. And finally math_round will round that result to 2 decimal places.
Savings: 33.33%

A common usage of combining functions is to obtain the order subtotal for use with affiliate programs. The how to page gets you going in just minutes.

15. Time/date functions: These functions were used to display the current time and date of our server (offset -4).
<mvt:item name="toolkit" param="set_time_zone|our_time|-4" />
<mvt:item name="toolkit" param="time_t_year|nyear|our_time" />
<mvt:item name="toolkit" param="time_t_month|nmonth|our_time" />
<mvt:item name="toolkit" param="time_t_dayofmonth|ndayofmonth|our_time" />
<mvt:item name="toolkit" param="time_t_hour|nhour|our_time" />
<mvt:item name="toolkit" param="padl|chour|nhour|2|0" />
<mvt:item name="toolkit" param="time_t_minute|nminute|our_time" />
<mvt:item name="toolkit" param="padl|cminute|nminute|2|0" />
<mvt:item name="toolkit" param="padl|csecond|nsecond|2|0" />
<mvt:item name="toolkit" param="time_t_dayofweek|ndayofweek|our_time" />
<mvt:item name="toolkit" param="sassign|days|Sunday#Monday#Tuesday#Wednesday#Thursday#Friday#Saturday" />
<mvt:item name="toolkit" param="vgettoken|days,#,ndayofweek" />
Note: The below values are simulated as this is a 4.x store so the module is not actually installed. See the Tool Kit Demo link below to actually see the module in use.
Our time zone: -4
Current year (our time): 2006
Current month (our time): 5
Current day (our time): 26
Current date (our time): 5 / 26 / 2006
Current hour (our time): 11 (left padded: 11)
Current minute (our time): 7 (left padded: 07)
Current second (our time): 18 (left padded: 18)
Current time (our time): 11:07:18
Current day of week (our time): 6 Friday
mktime_t creates a variable which is the number of seconds since Jan 1, 1970. As example,
<mvt:item name="toolkit" param="mktime_t|utc|year|month|dayofmonth|hours|minutes|seconds|time_zone" />
creates the utc variable. Each of the parameters 3-9 must be a variable for that value; not a hardcoded number. You'll probably use sassign or newsubstring to create those variables.

16. padl creates a variable which is left padded a specific number of characters with a set character from an original variable. As example,
<mvt:item name="toolkit" param="padl|csecond|nsecond|2|0" />
creates the csecond variable from nsecond. It is padded with the 0 character to the left if the length of nsecond is less than 2.

17. padr creates a variable which is right padded a specific number of characters with a set character from an original variable. As example,
<mvt:item name="toolkit" param="padr|csecond|nsecond|2|0" />
creates the csecond variable from nsecond. It is padded with the 0 character to the right if the length of nsecond is less than 2.

18. Use the callurl to pass fields, (eg subscription list, name, email) to a remote program (mvc, php, etc) and return result. The return result can be displayed with the mvt or it can just be ignored, depending on your need for the function. For example it could display the contents of the file or web page at that location or it could do something like sign the customer up for a mailing list. For example,
<mvt:item name="toolkit" param="callurl|sample|http://www.mydomain.com/subscribe.php|POST|sublist,ship_lname,ship_email" />
You could use the mvt of the variable to display the return result, in this case "sample".

You can use vcallurl if you need to have a dynamic url to call. In this function, you would enter a variable for the full url in the 3rd parameter instead of a fixed url. This would be useful if you need to build a url at runtime.

19. Use custom to retrieve a product's custom field value (if it exists), e.g. in the basket screen. It saves the value to a variable of your choosing. For example,
<mvt:item name="toolkit" param="custom|studio|l.all_settings:item:product_id|company" />
<mvt:if expr="g.studio">
Studio: &mvte:global:studio;
</mvt:if>
will check the custom product field "company" for the current product and save the value to a variable called "studio". You can then mvte the studio variable to display it. Note: This function requires use of the Miva Corp built-in custom fields module and that you have created custom product fields.

20. Use attr to retrieve a product's attribute count. It saves the value to a variable of your choosing. For example,
<mvt:item name="toolkit" param="attr|acount|l.all_settings:product:id" />
Count: &mvte:global:acount;


21. Use cxp to load a category's products into an array. The category ID number is fed into the cxp function. It saves the product count to a variable of your choosing. You can then display the contents of the sub_products array. For example,
<mvt:item name="toolkit" param="cxp|pcount|l.all_settings:subcats:id" />
<mvt:if expr="pcount GT 0">
(&mvte:global:pcount;)
<font size="-2">
<mvt:foreach iterator="sub_product" array="sub_products">
<br>
<a href="&mvt:global:secure_sessionurl;Screen=PROD&Product_Code=&mvta:sub_product:code;">
&mvt:sub_product:name;</a>
</mvt:foreach>
</font>
</mvt:if>

Alternatively, if you do not know the category ID number, you can use the category code by changing the function to cxpc, e.g.
<mvt:item name="toolkit" param="cxpc|pcount|g.Category_Code" />

22. Use parentcat to load the parent categories into an array. It saves the category count to a variable of your choosing. You can then display the contents of the parent_categories array. This function does not capture the image urls, however, if your images are named according to their category code, eg category code "mycat" uses an image called "mycat.jpg" you could easily build the dynamic img src path. Alternatively you can use the functions catimage or cattreeimage (see below) to retrieve the image urls. To display parent category names, you could use code like
<mvt:item name="toolkit" param="parentcat|pccount" />
<mvt:foreach iterator="parent_category" array="parent_categories">
&mvt:parent_category:name;
</mvt:foreach>


23. Use subcat to load a parent's subcategories into an array. It saves the subcategory count to a variable of your choosing. You can then display the contents of the sub_categories array. This function does not capture the image urls, however, if your images are named according to their category code, eg category code "mycat" uses an image called "mycat.jpg" you could easily build the dynamic img src path. Alternatively you can use the functions catimage or cattreeimage (see below) to retrieve the image urls. To display subcategory names, you could use code like
<mvt:item name="toolkit" param="subcat|ccount|g.Category_Code" />
<mvt:if expr="ccount GT 0">
<mvt:foreach iterator="sub_category" array="sub_categories">
&mvt:sub_category:name;
</mvt:foreach>
</mvt:if>

Similar functions exist for subcat2, subcat3, and subcat4. When used together you can display the entire (up to 5 levels deep) category tree expanded. An example tree using these functions should get you started. You can see the effect at the bottom of this page. You can also make the typical left column expanded category tree. Simply put the example code in a new page called OPEN. Then use the render token <mvt:item name="toolkit" param="render|OPEN" /> to place that tree on any page in the store. A variation of this template is the unordered list tree that Barrett posted in the Miva Forum.

24. Use pgroup to identify all of the price groups a customer is in. It saves the price group count to a variable of your choosing. You can then display the names of the price groups the current customer is in.
<mvt:item name="toolkit" param="pgroup|pcount" />
<mvt:if expr="g.pcount GT 0">
<mvt:foreach iterator="customer_pgroup" array="customer_pgroups">
<br>&mvt:customer_pgroup:name;
</mvt:foreach>
</mvt:if>


25. Use agroup to identify all of the availability groups a customer is in. It saves the availability group count to a variable of your choosing. You can then display the names of the availability groups the current customer is in.
<mvt:item name="toolkit" param="agroup|acount" />
<mvt:if expr="g.acount GT 0">
<mvt:foreach iterator="customer_agroup" array="customer_agroups">
<br>&mvt:customer_agroup:name;
</mvt:foreach>
</mvt:if>


26. Use pgroup-p to identify all of the price groups a product is in. It saves the price group count to a variable of your choosing. You can then display the names of the price groups the product is in.
<mvt:item name="toolkit" param="pgroup-p|prdcount|g.Product_Code" />
<mvt:if expr="g.prdcount GT 0">
<mvt:foreach iterator="product_pgroup" array="product_pgroups">
<br>&mvt:product_pgroup:name;
</mvt:foreach>
</mvt:if>


27. Use agroup-p to identify all of the availability groups a product is in. It saves the availability group count to a variable of your choosing. You can then display the names of the availability groups the product is in.
<mvt:item name="toolkit" param="agroup-p|aprdcount|g.Product_Code" />
<mvt:if expr="g.aprdcount GT 0">
<mvt:foreach iterator="product_agroup" array="product_agroups">
<br>&mvt:product_agroup:name;
</mvt:foreach>
</mvt:if>


28. Use breadcrumb to create an array of category names and codes from the current g.Category_Code up to the top level parent. You can check the number of items in the array. If there is one or more, you can display the array as a breadcrumb display. A category code must be used to start the function. In most cases it will be g.Category_Code which is available on a product page when that page is reached via a link on the category page.
<mvt:item name="toolkit" param="breadcrumb|b_count|g.Category_Code" />
<mvt:if expr="b_count GT 0">
<a href="http://www.pinemporium.com/mm5/merchant.mvc">Home</a>
<mvt:foreach iterator="breadcrumb" array="breadcrumbs">
>
<mvt:if expr="g.Category_Code EQ l.settings:breadcrumb:code">
<b> <a href="http://www.pinemporium.com/c/&mvte:breadcrumb:code;/&mvta:breadcrumb:name;.html">
&mvt:breadcrumb:name;</a></b>
<mvt:else>
<a href="http://www.pinemporium.com/c/&mvte:breadcrumb:code;/&mvta:breadcrumb:name;.html">
&mvt:breadcrumb:name;</a>
</mvt:if>
</mvt:foreach>
</mvt:if>


29. Use sexists to check for the existance of a file. Assign text to the file name. Then using either sglosub (or vglosub for variables), you can replace part of that text string and assign to a variable. Then plug that variable into the sexists function to check for the existance of the file. The result will be 1 if the file is present. The file has to be on the same domain as the merchant program and the path must be virtual, ie no http://domainname in the path. In the example, vpath will be 1 if the file exists.
<mvt:item name="toolkit" param="sassign|filename|/mm5/%prog_name%" />
<mvt:item name="toolkit" param="sglosub|filename,%prog_name%,merchant.mvc" />
<mvt:item name="toolkit" param="sexists|vpath|filename" />



30. Use vproduct_find to display basic product info (name, code, thumbnail, image, price, and cost) on any page (storefront, basket, etc) in the store. The 2nd value is true if the product is found. The 3rd parameter is a variable. In the example, the thumbnail, name and formatted price are displayed.
<mvt:item name="toolkit" param="vproduct_find|productfound|Product_Code" />
<mvt:if expr="productfound GT 0">
<mvt:if expr="NOT ISNULL l.settings:key_product:thumbnail">
<img src="&mvte:key_product:thumbnail;" border="0" width="30" height="20">
</mvt:if>
&mvte:key_product:name;
&mvte:key_product:inv_short;
&mvte:key_product:formatted_price;
<mvt:if expr="l.settings:key_product:costlessadjprice GT 0">
<font color="red">
(savings: &mvte:key_product:formatted_costlessadjprice;)
</font>
</mvt:if>
</mvt:if>


Alternatively, you can use sproduct_find and insert the raw product code in the 3rd parameter instead of using a variable.


31. Use render to display the contents of any page template at any location in another page. For example, if you have a page template called MINI which has only the mini-basket as its content, you can insert that page content anywhere inside another page. Page templates are created in Merchant 5 by clicking admin > stores > pages and clicking the Add button. The page code is case sensitive. In the example, a page called MINI is pulled into another page.
<mvt:item name="toolkit" param="render|MINI" />
This same technique can be used for things like inserting a "Specials" category into your storefront screen. The technique for doing this is explained here.
You can even replace a whole page. For example, let's say you want to force customers to login before they view some or all pages in your store. Simply put the following code at the beginning of each page you want to restrict and it will display the login screen instead. No need to buy a separate module for that simple task.
<mvt:if expr="basket:cust_id EQ 0">
<mvt:item name="toolkit" param="render|LOGN" />
<mvt:exit />
</mvt:if>



32. Use no_apostrophe to strip apostrophe characters out of a string. For example,
<mvt:item name="toolkit" param="no_apostrophe|new_descrip2|new_descrip" />
takes the variable new_descrip and removes the apostrophe. It saves the new value to the variable new_descrip2. This is particularly useful when you need the string passed to a javascript function. This is used in the balloon tooltip functionality as seen here.


33. Use bestseller to list the best sellers in a specific category. For example,
<mvt:item name="toolkit" param="bestseller|pcount|g.Category_Code|5" />
<mvt:if expr="pcount GT 0">
Best Sellers
<mvt:foreach iterator="bestsell" array="bestseller">
<br>
<a href="&mvt:global:sessionurl;Screen=PROD&Product_Code=&mvta:bestsell:code;&Store_Code=&mvta:store:code;">
&mvte:bestsell:name;<a>
&mvte:bestsell:formatted_price;
</mvt:foreach>
</mvt:if>
shows the best sellers in the current category. The last parameter is the number of items to display, eg 5.

Alternatively you can display the best sellers storewide by changing the 3rd parameter to the word ALL, ie replace g.Category_Code with ALL in the above example. You can even include the actual number sold if you want your customers to know how popular the items are by using the variable &mvte:bestsell:counter;

In admin, you can also see the top XX number of best sellers in the store. Go to admin > store and click the + to the left of utilities and then click on the link for Emporium Plus Tool Kit.


34. Use last to list the most recent products added to the store. Great for a "What's New" list. For example,
<mvt:item name="toolkit" param="last|pcount|10" />
<mvt:if expr="pcount GT 0">
<table border="0" width="200">
<th>What's New</th>
<tr><td align="center">
<font size="-1">
<mvt:foreach iterator="newproduct" array="new">
<a href="&mvt:global:sessionurl;Screen=PROD&Product_Code=&mvta:newproduct:code;&Store_Code=&mvta:store:code;">
&mvt:newproduct:name;</a>
<br>
&mvt:newproduct:formatted_price; <br><br>
</mvt:foreach>
</font>
</td></tr>
</table>
</mvt:if>
creates an array of the last 10 items added to the store. The last parameter is the number of items to display, eg 10.

A variation of this is the function lastcat. Everything is identical except use lastcat instead of last in the function. It can only be used on category pages. It displays the most recent products added to the current category.


35. Use basket to display the quantity and subtotal in the basket. For example,
<mvt:item name="toolkit" param="basket|itemcount" />
<mvt:if expr="g.itemcount GT 0">
Items in Basket: &mvte:toolkit:basketcount;
<br>Subtotal: &mvte:toolkit:baskettotalF;
<mvt:else>
Basket Empty
</mvt:if>

If you want a full minibasket with products listed, you can use the tool kit to do that too. Go to pages [add] and create a new page. Give it a code of TKMINI and call it a mini basket. Insert the code from this example page. Then you can use the tool kit render function to insert that page inside any other page in the store.
<mvt:item name="toolkit" param="render|TKMINI" />

36. Use random to generate a random number. For example,
<mvt:item name="toolkit" param="random|nrandom|100" />
<br>Random number: &mvte:global:nrandom;
generates a random number between 0 and 100. This could be used in conjunction with the sassign, vglosub, and vcallurl functions to insert a random file (text) into a web page. You would need a text file for each of the numbers that could be generated, e.g. 0.htm, 1.htm, 2.htm ..... 100.txt. More than likely, you will use a much smaller number for your random generation to match text files. A missing file would generate an error, so all have to be present.
<mvt:item name="toolkit" param="sassign|randomurl|http://www.pinemporium.com/%nrandom%.txt" />
<mvt:item name="toolkit" param="vglosub|randomurl,%nrandom%,g.nrandom" />
<mvt:item name="toolkit" param="vcallurl|text_insert|randomurl|GET|" />
&mvte:global:text_insert;
If the random file contains html tags which you want to render correctly, use &mvt instead of &mvte

A variation of the random function is vrandom. For the third parameter you use a variable instead of a constant. Below is an example of displaying a random thumbnail from an array of products, e.g. on the category or product list page using several tool kit functions.
<mvt:item name="toolkit" param="sassign|one|1" />
<mvt:item name="toolkit" param="sassign|delimiter|#" />
<mvt:foreach iterator="product" array="products">
<mvt:if expr="l.settings:product:thumbnail">
<mvt:item name="toolkit" param="math_add|numberinstring|numberinstring|one" />
<mvt:item name="toolkit" param="concat|newstring|newstring|l.all_settings:product:code" />
<mvt:item name="toolkit" param="concat|newstring|newstring|delimiter" />
</mvt:if>
</mvt:foreach>
<mvt:if expr="g.numberinstring GT 0">
<mvt:item name="toolkit" param="math_subtract|result|numberinstring|one" />
<mvt:item name="toolkit" param="vrandom|nrandom|result" />
<mvt:item name="toolkit" param="math_add|thisone|nrandom|one" />
<mvt:item name="toolkit" param="vgettoken|newstring,#,thisone|select_product_code" />
<mvt:item name="toolkit" param="vproduct_find|productfound|select_product_code" />
<img src="&mvt:key_product:thumbnail;" border="0">
</mvt:if>
An example can be seen at this category.


37. Use states to generate an array of states alphabetically by name, not state code. For example,
<mvt:item name="toolkit" param="states" />
Thus, on the customer account create page template (customer fields section) replace
<mvt:item name="states" param="Customer_ShipStateSelect" />
with
<mvt:item name="toolkit" param="states" />
<select name="Customer_ShipStateSelect">
<option value="">Outside US</option>
<mvt:foreach iterator="state" array="states">
<mvt:if expr="l.settings:state:code">
<mvt:if expr="Customer_ShipStateSelect EQ l.settings:state:code">
<option value="&mvte:state:code;" selected>&mvte:state:name;</option>
<mvt:else>
<option value="&mvte:state:code;">&mvte:state:name;</option>
</mvt:if>
</mvt:if>
</mvt:foreach>
</select>
It is slightly different for the ocst page and others which have a state selector. Likewise, this is for the "ship to" section. It is slightly different for the "bill to" section.


38. Use nextprevious on the product page to navigate to the previous or next product in the category. This only works when going from the category page to the individual product page. The below code goes on the product page in whatever location you want it.
<mvt:item name="toolkit" param="nextprevious|l.all_settings:product:code" />
<mvt:if expr="l.settings:tkskip:previous">
<a href="&mvte:global:sessionurl;Screen=PROD&Product_Code=&mvte:tkskip:previous;&Category_Code=&mvte:global:Category_Code;">
Previous</a>
</mvt:if>
<mvt:if expr="l.settings:tkskip:next">
<a href="&mvte:global:sessionurl;Screen=PROD&Product_Code=&mvte:tkskip:next;&Category_Code=&mvte:global:Category_Code;">
Next</a>
</mvt:if>


39. Use concat to combine one variable with another. For example:
<mvt:item name="toolkit" param="concat|newstring|var1|var2" />


40. Use prompt to display the attribute and option prompts instead of the codes in the basket and invoice screens. To initialize the variables, go to the basket page template. Click the link at the top called basket contents. Insert
<mvt:item name="toolkit" param="prompt" />
on the line immediately before
<mvt:foreach iterator="option" array="item:options">
Then about 10 lines down you will see the lines of code that display the attribute and option codes. Replace &mvt:option:attr_code; with &mvt:option:attr_prompt; and &mvt:option:opt_code; with &mvt:option:opt_prompt; Do NOT replace &mvt:option:data_long; or &mvt:option:data;


41. Use quick to fill an array with product info for listed product codes. The third variable for the quicklist is a list of product codes separated by commas. The function tests for product existance and availability group status and works great for things like featured products. Example display:
<mvt:item name="toolkit" param="quick|pcount|1AA00100,1S_00002,PB_00001,1S_00004,LCS00002" />
<table border="0">
<mvt:foreach iterator="quicklist" array="quicklists">
<tr>
<td align="center" valign="top">
<mvt:if expr="NOT ISNULL l.settings:quicklist:thumbnail">
<img src="&mvt:quicklist:thumbnail;" border="0" width="50" height="50">
<mvt:else>
No Photo
</mvt:if>
<br>
<a href="&mvt:global:sessionurl;Screen=PROD&Product_Code=&mvta:quicklist:code;">
&mvt:quicklist:name;</a>
<br>
&mvt:quicklist:formatted_price;
<br><br>
</td>
</tr>
</mvt:foreach>
</table>
A variation of the quick is the vquick. The third parameter is a variable instead of a hard coded string of product codes. This is useful for the alsobought function using a custom product field called alsobought. See below.

42. Use pgrpinsert to insert a customer into a price group. This could be used on the sfnt page to insert a customer when creating a new account. Give customers a discount incentive to create an account. It could also be used on the invc page to insert a customer based on the product purchased. This would be excellent if you sell memberships and want to automatically add them to a price group based on the membership product they purchase. An example for the sfnt page is:
<mvt:if expr="g.Action AND g.Action EQ 'ICST'">
<mvt:item name="toolkit" param="pgrpinsert|maxgrp|Chairman" />
<mvt:if expr="maxgrp">
Price Group: &mvte:global:maxgrp;
</mvt:if>
</mvt:if>


43. Use vacreate to create an array from a string in which the data is in a variable separated by a delimiter. An example might be a custom product field with actors' names, each separated by a comma. The 2nd parameter is the array name. The third parameter is the variable or custom field. The 4th parameter is the delimiter, usually a comma. The variable can then be displayed using the store morph operator "foreach". Here's an example to display the names on separate lines:
<mvt:item name="toolkit" param="vacreate|cast|l.all_settings:product:customfield_values:customfields:actors|," />
<mvt:if expr="NOT ISNULL l.settings:cast">
<mvt:foreach iterator="actor" array="cast">
<br> &mvte:actor;
</mvt:foreach>
</mvt:if>
Alternatively you can use sacreate to manually write a string to an array.
<mvt:item name="toolkit" param="sacreate|cast|Howard, Winkler, Williams|," />


44. Use agrpinsert to insert a customer into an availability group. This could be used on the sfnt page to insert a customer when they create a new account. You can use this to force login and restrict access, ensuring a customer has to create an account and/or login before they can view products and shop in your store. It could also be used on the invc page to insert a customer based on the product purchased. An example for the sfnt page is:
<mvt:if expr="g.Action AND g.Action EQ 'ICST'">
<mvt:item name="toolkit" param="agrpinsert|avail|Wholesale" />
<mvt:if expr="avail">
Availability Group: &mvte:global:avail;
</mvt:if>
</mvt:if>


45. Use related to list related products for a specific product code. An example to display the products in a vertical list is:
<mvt:item name="toolkit" param="related|pcount|g.Product_Code" />
<mvt:if expr="pcount GT 0">
<table border="0" width="200">
<th>
Related
</th>
<tr>
<td align="center">
<font size="-1">
<mvt:foreach iterator="relproduct" array="related">
<mvt:if expr="NOT ISNULL l.settings:relproduct:thumbnail">
<img src="&mvte:relproduct:thumbnail;" border="0"><br>
</mvt:if>
<a href="&mvt:global:sessionurl;Screen=PROD&Product_Code=&mvta:relproduct:code;&Store_Code=&mvta:store:code;">
&mvt:relproduct:name;</a>
<br>
&mvt:relproduct:formatted_price;
<br><br>
</mvt:foreach>
</font>
</td>
</tr>
</table>
</mvt:if>


46. Use catimage to retrieve the path, if any, for the category main image. An example for displaying that image is below. The path (2nd parameter) is saved to a variable of your chosing, e.g. bigimage. The 3rd parameter is the variable that contains the category code. This example variable is for a specific scenario; it could be something else, e.g. g.Category_Code or other variable.
<mvt:item name="toolkit" param="catimage|bigimage|l.all_settings:parent_category:code" />
<mvt:if expr="bigimage">
<img src="&mvte:global:bigimage;" border="0">
</mvt:if>


47. Use cattreeimage to retrieve the path, if any, for the category tree image. An example for displaying that image is below. The path (2nd parameter) is saved to a variable of your chosing, e.g. smallimage. The 3rd parameter is the variable that contains the category code. This example variable is for a specific scenario; it could be something else, e.g. g.Category_Code or other variable.
<mvt:item name="toolkit" param="cattreeimage|smallimage|l.all_settings:parent_category:code" />
<mvt:if expr="smallimage">
<img src="&mvte:global:smallimage;" border="0">
</mvt:if>


48. Use export to write variables to a flat file in the "export" directory under your store's data directory. It will not write to other directories. Delimiters can be tab or | or , or #


49. Use import to read the contents of a flat file in the "export" directory under your store's data directory. It will not read from other directories. The content is entity encoded for security reasons, so html will be garbled. For example:
<mvt:if expr="g.customer:login EQ 'ABCD123'">
<mvt:item name="toolkit" param="import|megalist|cust.dat|crlf" />
<pre>
&mvt:global:megalist;
</pre>
</mvt:if>
This example in a page template would display the contents of cust.dat. It is wrapped inside the check for a specific customer login so that only that person would see the display. You would change the ABCD123 to your customer login for your merchant.mvc. The crlf in the function defines the end of line as a carriage return and line feed. By using the <pre> tags it displays that as a list on the page which you could copy and paste to the clipboard then insert into a file or application on your PC. You could change the crlf to <br> and leave off the <pre> tags. That option would look the same on the screen but would not have the carriage return and line feeds needed by many applications.


50. Use productmeta to display the text in the product meta tag keywords and/or description fields. The second parameter is either CODE or ID (upper case), depending on the variable you are using in the third parameter. For example:
<mvt:item name="toolkit" param="productmeta|CODE|l.all_settings:product:code" />
<br>&mvte:meta:keywords;
<br>&mvte:meta:description;


51. Use categorymeta to display the text in the category meta tag keywords and/or description fields. The second parameter is either CODE or ID (upper case), depending on the variable you are using in the third parameter. For example:
<mvt:item name="toolkit" param="categorymeta|CODE|l.all_settings:category:code" />
<br>&mvte:meta:keywords;
<br>&mvte:meta:description;


52. Use exportxml to export variables to an XML file. This export requires the use of three commands. exportxmlbegin is used to initialize the file and must be used before the first of the exportxml commands. Then after all of the exportxml commands have been run, you close the process and write the data to the file with the exportxmlend command. As example, the following lines placed in the INVC page template will write the order number and customer last name to a XML file called basket.dat.
<mvt:item name="toolkit" param="exportxmlbegin" />
<mvt:item name="toolkit" param="exportxml|ORDER_NUMBER|l.all_settings:order:id|ORDER_NUMBER" />
<mvt:item name="toolkit" param="exportxml|SHIP_LAST|l.all_settings:order:ship_lname|SHIP_LAST" />
<mvt:item name="toolkit" param="exportxmlend|basket.dat|ORDER_NUMBER|l.all_settings:order:id|ORDER_NUMBER" />
See this page for details and explanation of the three functions.


53. Use logbackin on the INVC (invoice) screen to log customers back in automatically (transparent to the customer). Normally when a customer completes an order they are automatically logged out. This function can be used on the invoice screen to log them back in without exposing their password on the invoice page. The second parameter is optional. If left blank, it will log them back in with the full time until basket timeout setting. If you put a number between 1 and the basket timeout setting, it will extend their login for only that number of minutes. For example, the line below will log them back in for 10 minutes. If they click on any link in the store during the next 10 minutes, their time will update as if they never logged out.
<mvt:item name="toolkit" param="logbackin|10" />
If you are using other 3rd party modules that keep the customer logged in, do not use this function as it is not needed and would be redundant.


54. Use childof when you want to retrieve the parent category name and code for the current category. Typically this would be used on the category page if you did not want to use the full breadcrumb function above. For example:
<mvt:item name="toolkit" param="childof|parentfound|g.Category_Code" />
<mvt:if expr="g.parentfound">
<a href="http://www.yourdomain.com/mm5/merchant.mvc?Screen=CTGY&Category_Code=&mvta:childof:code;"> &mvt:childof:name;</a>
</mvt:if>


55. Use pastorders to display a list of a customer's past orders when they are logged in. It will display all of those orders which are still in the store's admin, either batched or unbatched. You can limit the number of orders that are displayed by using the pos1 variable as you see in the first example below. Or you can limit those orders newer than a set date as you see in the second example. If you don't limit the display, you can use the variable formatted_ordersum to display the total. If you have code on your INVC page template to hide items (like the nav bar) when the variable "print" exists, you can even use this for displaying printable invoices. If you use this function on the invoice screen, you'll need to use the logbackin function above to keep the customer logged in for at least a few minutes.
Simple list with link to each invoice
<mvt:item name="toolkit" param="pastorders|ordersum" />
<mvt:if expr="g.ordersum GT 0">
<br>
Recent Orders
<mvt:item name="toolkit" param="currencyformat|formatted_ordersum|g.ordersum" />
&mvte:global:formatted_ordersum;
<mvt:foreach iterator="pastorder" array="pastorders">
<mvt:if expr="pos1 LT 11">
<br>
<a href="&mvte:global:secure_sessionurl;Action=NEW&SubScreen=TKINVC&order_id=&mvta:pastorder:id;&print=1">
&mvt:pastorder:id;</a>
&mvt:pastorder:orderdate;
&mvt:pastorder:formatted_total;
</mvt:if>
</mvt:foreach>
<br>
</mvt:if>
Drop down select
<mvt:item name="toolkit" param="pastorders|ordersum" />
<mvt:if expr="g.ordersum GT 0">
<br>
Recent Orders
<mvt:item name="toolkit" param="currencyformat|formatted_ordersum|g.ordersum" />
&mvte:global:formatted_ordersum;
<br>
<select size="1" name="pastorder" onchange="document.location.href=this.value">
<option selected value="&mvt:global:sessionurl;">------------ View ------------</option>
<mvt:foreach iterator="pastorder" array="pastorders">
<mvt:if expr="l.settings:pastorder:systemdate GT '20080101'">
<option value="&mvte:global:secure_sessionurl;Action=NEW&SubScreen=TKINVC&order_id=&mvta:pastorder:id;&print=1">
&mvt:pastorder:id;
&mvt:pastorder:orderdate;
&mvt:pastorder:formatted_total;</option>
</mvt:if>
</mvt:foreach>
</select>
<br>
</mvt:if>
On the INVC page you can include a link to reorder the same items.
<a href="&mvte:global:secure_sessionurl;Action=NEW&SubScreen=TKORDR&order_id=&mvta:order:id;&Store_Code=&mvta:global:Store_Code;">Reorder</a>


56. Use weight to display the basket total weight. For example
<mvt:item name="toolkit" param="weight|totalweight" />
&mvte:global:totalweight;


57. Use subtotal to display the subtotal of the products in the basket. This yields a raw number. If you wanted it formatted as currency, use in conjunction with the currencyformat function above. For example
<mvt:item name="toolkit" param="subtotal|basketsubtotal" />
<mvt:item name="toolkit" param="currencyformat|formatted_subtotal|basketsubtotal" />
&mvte:global:formatted_subtotal;


58: Use subtotalorder to display the subtotal of the products in the order. This yields a raw number. If you wanted it formatted as currency, use in conjunction with the currencyformat function above. For example
<mvt:item name="toolkit" param="subtotalorder|ordersubtotal" />
<mvt:item name="toolkit" param="currencyformat|formatted_subtotal|ordersubtotal" />
&mvte:global:formatted_subtotal;


59. Use alsobought on the INVC page template to keep track of items bought when another product is bought. This gives you a suggested products based on prior purchase history feature. First create a custom product field in utilities with the CODE "alsobought". Then add the token
<mvt:item name="toolkit" param="alsobought|250" />
on the INVC page template at any location, e.g. near the end. The second parameter is any value between 1 and 250. This determines the number of product codes that will be saved. You need to look at the average length of your product codes. For example, if it is 10, then 250 would save about 25 product codes before it started erasing the oldest ones. Keep in mind that customers would probably only want to see 5 or 6 of these also bought product links. So if you wanted 6, then make the number 66 (10 for each product code and 1 for the delimiter between them). Then on the product page, e.g. just below the related products item, you could add the following code. Make sure the custom field alsobought is assigned to the product page in the point and click mode. The system automatically updates the codes as each order is placed. You can also manually edit the custom product field to "tweak" the results.
<mvt:if expr="NOT ISNULL l.settings:product:customfield_values:customfields:alsobought">
<mvt:item name="toolkit" param="vquick|pcount|l.all_settings:product:customfield_values:customfields:alsobought" />
<mvt:if expr="pcount GT 0">
<br>
<table border="0">
<tr>
<td align="center" colspan="3">
<mvt:item name="fonts" param="hdr_font">
Customers who bought &mvt:product:name; also bought these products
</mvt:item>
</td>
</tr>
<mvt:foreach iterator="quicklist" array="quicklists">
<tr>
<td align="left" valign="top">
<mvt:if expr="NOT ISNULL l.settings:quicklist:thumbnail">
<img src="&mvt:quicklist:thumbnail;" border="0" width="50" height="50" alt="&mvta:quicklist:name;">
<mvt:else>
<img src="/mm5/graphics/en-US/admin/blank.gif" border="0" width="50" height="50" alt="&mvta:quicklist:name;">
</mvt:if>
</td>
<td align="left" valign="top">
<mvt:item name="fonts" param="body_font">
<a href="&mvt:global:sessionurl;Screen=PROD&Product_Code=&mvta:quicklist:code;">
&mvt:quicklist:name;</a>
</mvt:item>
</td>
<td align="left" valign="top">
<mvt:item name="fonts" param="body_font">
&mvt:quicklist:formatted_price;
</mvt:item>
</td>
</tr>
</mvt:foreach>
</table>
</mvt:if>
</mvt:if>


60. Use clearall on the BASK screen to provide a link to clear the basket of all items. For example
<mvt:item name="toolkit" param="clearall" />
Alternatively, you can insert the url directly without the token, for example
<a href="&mvt:global:sessionurl;Screen=BASK&SubScreen=TKCLEAR&Action=NEW&Store_Code=&mvta:store:code;">Clear Basket</a>


61. Use basketoneclick on the BASK screen and you can replace the individual remove and update buttons with a single update button for the whole basket. An example basket contents template with the necessary changes documented is online.


62. Use agroup-c to identify all of the availability groups a category is in. It saves the availability group count to a variable of your choosing. You can then display the names of the availability groups the category is in.
<mvt:item name="toolkit" param="agroup-c|acatcount|g.Category_Code" />
<mvt:if expr="g.acatcount GT 0">
<mvt:foreach iterator="category_agroup" array="category_agroups">
<br>&mvt:category_agroup:name;
</mvt:foreach>
</mvt:if>


63. Use agroup-cats to list all categories assigned to an availability group. It saves the category count to a variable of your choosing. You can then display the category info of those that are in the availability group.
<mvt:item name="toolkit" param="agroup-cats|acatcount|l.settings:agroup:name" />
<mvt:if expr="g.acatcount GT 0">
<mvt:foreach iterator="agroup_cat" array="agroup_cats">
<br>&mvt:agroup_cat:name;
</mvt:foreach>
</mvt:if>


64. Use lasturl to log the last screen (CTGY, PLST, or SRCH) a customer was on and display a continue shopping link on the basket (BASK) screen. You will be putting tokens on four screens. Don't forget to assign the tool kit to the items list of all four of those screens. In admin, on either the CTGY, PLST, or SRCH page put the following token which will create the logging database. The location is not important.
<mvt:item name="toolkit" param="create" />
Then in merchant.mvc go to the screen you put the create token on so that it will run the token and create the database. Next, go back into admin and change that token to
<mvt:item name="toolkit" param="trim" />
This token will trim expired entries about 1 out of 100 times that this screen displays in your store. Next, on the CTGY, PLST, and SRCH screens put the following token which will capture the visit to the page.
<mvt:item name="toolkit" param="lasturl|url|http://www.yourdomain.com/mm5/merchant.mvc" />
The last url visited will be saved to the variable name in the second parameter, e.g. url in this example. The third parameter is the fallback url if there is no CTGY, PLST, or SRCH page visited. This would usually be your storefront. Next, on the BASK page template you can use the following to display a continue shopping link.
<mvt:item name="toolkit" param="lasturl|url|http://www.yourdomain.com/mm5/merchant.mvc" />
<a href="&mvte:global:url;">Continue Shopping</a>
As you can see the first line is the same as on the other three pages. Then you have a http link for the continue shopping url. You can replace the text with an image button to match your store's look and feel. Finally, there is a token if you decide to discontinue this feature. It removes the logging datebase. To discontinue, remove the lasturl tokens from the four pages. Then change the trim token to
<mvt:item name="toolkit" param="remove" />
Visit that page in merchant.mvc to remove the database. Then in admin, remove the token completely. If for some reason your "trim" page is not visited frequently enough, your logging database could get large and you may have to use the remove technigue to clear out the database. This should never be an issue in a MySQL store and probably won't be in a MivaSQL store, but keep it in mind. Moving the trim token to a more frequently visited page may also help.


An example of this module in use is at the Tool Kit Demo page.



Average Customer Rating


Number of Raters: 10

07/26/2008
Simply Indespensible. I recommend this to all my clients and use this module in EVERY store I develope. It is normally the very first module I install. Ray Yates PCINET-LLC.com Yatesoft.com

Reviewer: Bernard in Lawrenceville, United States 07/21/2008
This is an invaluable module that has allowed us to easily make numerous enhancements to our store. The range of functionality is very extensive and the support is outstanding.
more reviews > >
Sign In to review this product
Basket Contents
Quantity in Basket: none


Best Sellers
COUPON REDEMPTION MODULE
COUPON REDEMPTION MODULE
PayPal PAYMENT MODULE FOR MIVA MERCHANT
PayPal PAYMENT MODULE FOR MIVA MERCHANT
ADDENDUM
ADDENDUM
MINI-BASKET DISPLAY
MINI-BASKET DISPLAY
TOOL KIT v5
TOOL KIT v5

Categories
Software > New for Merchant 5
Software > User Interface Modules




Shipping Calculator


This page hosted on Hostasaurus
© 1996-2008, William Weiland. All Rights Reserved.