DesignExtend.com - expanding possibilities for Miva-enabled sites
Solutions that work...   Learn Miva Merchant   Find Solutions
Free Weekly Tips List (more info
Email:  
  |  Resources & Tools  |  How To...  |  Store Profiles  |  BLOG  |  Customer Support  |  About Us  |  Contact Us  |  

Here's what's On Sale
Find Products/Services by Developer
Your Account & Basket

  · Admin Utilities
  · Look & Feel / Design
  · Order Fulfillment
  · Payment Solutions
  · Shipping Configuration
  · Store Functionality
  · Order Processing
  · Marketing & Email
  · Upgrades & Updates
  · Miva Licenses
  · Developer Tools


  · Books & eBooks
  · NEW! Online Training
  · Tips Archive
  · List All Resources


  · Web Site Analysis
  · Miva Merchant Upgrade
  · OpenUI Install
  · HOT! Retainer Service
  · List All Services
  · Request a Quote

  · Make a Payment

  · Home      · Site Map


 Storefront > Modules & Apps > Browse by Developer > Emporium Plus > Tool Kit for Version 5

A must for anyone needing full control over MIVA Merchant 5's template SMT code, the Tool Kit for Version 5 unlocks the ability for functions like truncating text, mathematical equations and conditional commands.

The module uses a function library to create new variables and make changes to existing variables inside Store Morph Technology templates.

Current Tool Kit Functions:
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" />

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.

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.

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

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%

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


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). 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: &mvt: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 mvt 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: &mvt: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">
(&mvt: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. 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. 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.

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 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 anywhere in 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" />


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.


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.



Important: This module is for those skilled at using the store morph template editing capabilities.
Your Miva Merchant Version
Version 5
What Domain Will This Be Installed On?
Installation Option
I'll Install Myself
Install This For Me - add $25
Price: 39.95

Versions: ?
5

User Interfaces: ?
N/A

License is: per store

Developer:
Emporium Plus


Tools for You:

Save to Wish List

Refer to Someone You Know...

Get a Quote on Customizations

  Log In  -  Create Account
Your basket is empty. As you add items, they will appear here.


Featured Miva Merchant Stores
click to visit this featured site

One Page Checkout
Version 3 is here!
Now just $469.99

One Page Checkout
Convert your store's checkout into a single intuitive page.
Learn More>

Featured Tools...
  Market with Opt-in Email
  Manage Products Offline
  The Complete Order
   Processing Solution
  Chat Live w/ Customers

  Download Catalog (PDF)




Featured Tools...
PhosphorMedia

GiveAnything.com

Endicia Internet Postage

| Resources & Tools | How To... | Support | Message Boards | Store Profiles | | About Us | Contact Us |

DesignExtend.com © 1998 - 2009 Media Service Innovations, Inc.
terms of sale · privacy · legal · affiliates · partners

Runtime error in /store/4.23/modules/util/DEN_ELM2.mvc @ [0000003b:0000001c]: Line 730: MvUPDATE: Record is not in index