|
|
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 |
|
Latest Version: 5.170
|
|
|
Easily and quickly extend the Miva Merchant 5.x store
morph technology (SMT) coding system. The tool kit
function library fills in many of the gaps in the SMT
coding system by using the module's item tags, similar
to those you are already familiar with in your page templates.
You can even use the mvassign and mveval functions to
run dozens of mivascript functions and expressions right
in your SMT pages if you are familiar with the mivascript
language or you look them up in the mivascript reference
manual. It also contains many functions for extending
the capabilities of your store without additional,
expensive modules. The module is 100% compatible with
MySQL, MivaSQL, store morph page templates, and skins.
Store developers, who were used to the OpenUI 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 straightforward and a great addition to
the already extensive capabilities of Merchant. Once you
get a couple functions under your belt, you will find
this module has many unique features that are fairly
easy to implement. Touted by developers and store owners
alike as a must have module.
The license is for one Miva Merchant domain/mall and cannot be sold,
transferred, or re-distributed. If you have multiple
stores in the same domain merchant.mvc, only one license
is needed. If you have a store in a different domain,
that would require another license.
Below is a summary of the dozens of features currently in
the tool kit. This module is frequently updated with new
features added from store owner wish lists. If you don't
see something you want, please ask.
Below that is the list of specific functions
used to implement these features. The "how to" examples
in the list below are even more extensive than the
examples in the module's admin screen.
Store Morph Language Extensions
- Mivascript expressions. Dramatically
extend store morph. The ultimate super function, run
almost any mivascript simple or complex
expression and save the result to a variable using the
mvassign function. You can also use the mveval function to do the
same thing except it displays the result without having to save it to a variable first.
- String. Several low level string functions can be used to manipulate string values. These are for those who
are not familiar with the mivascript language or when you have a simple expression to process.
- No html. Strips the html tags from strings.
- Math. Several low level math functions can be used to make computations involving numeric variables. Display
price savings. Consecutively number products on the product list pages. The uses are endless. These functions are
for those not familiar with the mivascript language.
- Elapsed time for page render. Calculate the time it takes to load a page. Great development tool to see how
each feature you add to a page effects the load time.
- Currency format. You can format a number to the currency format used by the store.
- Time/date. Several time/date conversion functions can be used for displaying the current date or some date in the future.
You can display the date in the format you want.
- Arrays. Create single dimension arrays from string data separated with a delimiter or from a variable, e.g. in a
custom product field. You can further sort that array alphabetically.
- Counter. Implement a counter for use within foreach loops. For example, display the incremented product number on the product list pages next to each product.
- Header Output. You can change the content-type
of a store morph page for use with other applications. You
can also change the page status, e.g. 404 or 301.
- Short links. You can create links like
http://www.yourdomain.com/ABC.html to improve your SEO.
- Form validation. You can validate specific
inputs in a form on a page and redisplay the page if they
don't pass validation.
- Enhanced Maintenance. Close the store to
visitors but keep it open for the store owner so he/she
can work on it and view the changes. This can be done
for the whole store or just one screen that you are
working on.
Product Extensions
- Products in category list. List one or more products from any category in the store on any page in the store.
- Product find. Lookup the details of any specific product in the store and display that data on any page in the
store.
- Custom product fields. Display the value
in any custom product field, e.g. upc, manufacturer,
condition, MSRP. Insert a value into the custom field,
e.g. number of page views for each product. Show these
extra fields on any screen in the store.
- Product count in categories. In admin >
utilities > emporium plus tool kit you can run the
product count in categories and save the values to a
custom product field which can be displayed anywhere in the
store, including in the category tree.
- Featured products. Create an easy to change list of product codes which can then be displayed on any page in the store.
- Best sellers. Retrieve and display the
best sellers in the store or in specific categories.
Combine functions to list the top selling products under each
subcategory on a parent category's page. The best seller
list changes automatically since it is based on actual
sales.
- New products. Retrieve and display the most recently added products in the store.
- Most recent purchased. Display the most recently purchased products.
- Related products. Display related products of a specific product at any location.
- Recommendation engine (suggested products).
Using prior purchase history, display products which were
also bought when a specific product was purchased, i.e.
customers who bought A also bought X, Y, and Z. This is
similar to related products but is dynamically updated by
the actual purchases made by your customers.
- Product in categories. List all the categories a product is in. Useful in breadcrumb navigation when the category code is not passed in the url.
- Next/Previous buttons. Display links for the customer to go to the next or previous product in the same category.
- Random product display. Display a specified number of non-repeating random products from the entire store or a specified category on any page in the store. You can also display a random image from the list of products on a specific page, e.g. the product list page. The automatic rotation of products and images keeps your pages fresh, keeping search engines interested. Improve your search engine optimization (SEO) with dynamically changing content. The random display respects availability group settings.
- Header/footer text. Read and display the contents of the header and footer.
- Meta tag text. Read and display the meta tag keyword and description without the meta tag formatting.
- Product list pagination and sorting. On the
product list pages include links to all of the pages in
the store's product list along with
the page and product totals for the whole store. You can
also let the customer sort products and set the number of
products per page.
- Wait List. Allow customers to put themselves
on a wait list for out of stock products. It can be used for the
inventory by product code and inventory at the attribute-option
level.
- Product Page Templates. You can have multiple
versions and layouts of your product pages.
Category Extensions
- Category lists. List parent categories and subcategories at any location. Great for subcategory navigation.
In addition to the category names, you can display their images.
- Category pagination and sorting. On the category pages include links to all of the pages in that category along with
the page and product totals for the category. You can
also let the customer sort products and set the number of
products per page.
- Open (expanded) category tree. You can build a category tree that remains expanded at all times.
- Custom category fields. Display the value in a custom category field on the CTGY page template.
- Breadcrumb navigation. Display breadcrumb trail to guide the customer to higher level categories from a subcategory.
- Header/footer text. Read and display the contents of the header and footer.
- Meta tag text. Read and display the meta tag keyword and description without the meta tag formatting.
- Tool tips. Include tool tips on your category pages.
- Category Page Templates. You can have multiple
versions and layouts of your category pages.
Basket Enhancements
- Basket thumbnails. Include the product thumbnails in the basket.
- Basket weight. Calculate the total weight of the items in the basket.
- Basket subtotal. Display a subtotal of
just the products in the basket, less shipping, tax,
coupons, discounts, fees, and other charges.
- Basket clear all. Empty the basket with a single button click. You can also use it to empty the basket when
a customer logs out.
- Basket one click update. Replace the remove and update buttons on each product with a checkbox and quantity
input for each and a single basket update button that updates all changes at once.
- Update basket with cookie. Using saved cookies, insert first name, last name, state, zip, country and other non-sensitive data, you can automatically update the basket database. This is great for stores that use the shipping calculator function which displays shipping rates before logging in and checking out.
- Basket Filler. Refill customer info when not logged in and returned to checkout.
- Continue shopping. Put a continue shopping button on the basket page that takes the customer back to the
Miva Merchant category, product list, or search page they were last on before putting a product in the basket.
- Mini-basket. Abbreviated basket count and total. Create a miniature basket listing products and totals and insert on any page.
- Attribute prompt vs code. Display the attribute and option prompt in the basket instead of the non-descriptive code.
It can also be used for the checkout, invoice and picklist screens.
- Attribute/Option Images. Display the attribute and option images if they exist.
- Country. Display the country name instead of or in addition to the country code.
Shipping Calculator
- Calculate shipping using the installed shipping modules. This preview shipping feature lets you display the shipping methods and charges on any page in the store. Customers like to check shipping before they go to checkout and fill in their full customer info. This feature is even compatible with the Sort Shipping Plus Free Shipping Option and CBS Shipping Supermod modules so their location and other restrictions are reflected in the shipping options list.
Checkout Enhancements
- Order subtotal. Calculate the subtotal of products in the order, less shipping, tax and other charges. This
is useful for analytic programs that can only use the subtotal.
- Agreement page. Do not allow the customer to continue checkout
unless they agree to your terms.
- Order minimums for groups. Set order minimums
(dollar value and/or quantity) for price or availability
groups. Configure custom message for standard minimum order page.
- Proceed code generation. Eliminate fraudulent
email addresses by sending a proceed code before the
customer can continue checkout.
Order History
- Order history. Display all of the logged in customer's orders with links to redisplay the invoice of each. Include a summary total of orders which have not been deleted.
- Reorder. Quick button click to insert all of the products into the basket that were in a past order. Great for recurring orders.
- Printable Invoices. Redisplay past invoices so they can be printed.
Customer Enhancements
- Custom customer fields read. Display the contents of any custom customer field.
- Custom customer fields write. Insert data into a custom customer field, e.g. tax ID, addr2, sales rep.
- Force login. Force the customer to login/create an account before they can view any page in the store.
- Block IP. Check IP address and redirect if desired.
- Keep customer logged in. Upon order completion the customer is usually logged out. This feature can keep them
logged in for a specified period of time up to the basket timeout limit.
- Customer Login Lookup. Customers can find their login by entering their email address.
- Favorites list. Customers can create, add, edit, delete favorite products lists.
Price/Availability Groups
- Price/Availability Group Insertion and Deletion.
- New Customer Sign Up.
Automatically insert customers, e.g. new customer, into
a price or availability group.
- Price Group Based on Purchase History.
Combine with the order
history feature to reward customer loyalty based on past
orders total by promoting to higher price groups as the
orders total increases, i.e. price groups based on
purchase history. You can also use custom customer fields
and the insert feature to track the cumulative orders total
for price group insertion. This method does not require
orders be kept on the server.
- Purchase Membership Product.
You can also automatically
assign customers to price or availability groups based on
purchase of a specific membership product(s). Using the
the custom customer fields you can even set a term limit
on the membership and delete them automatically from the
group when they login and their membership has expired.
- Automatic Email. Automatically email the
customer as price or availability group status changes.
- Membership. Determine if a customer or product or category is assigned to price/availability groups.
- Order minimums for groups. Set order minimums
(dollar value and/or quantity) for price or availability
groups. Configure custom message for standard minimum order page.
Affiliate Tracking
- Affiliate Lookup. If you are using the built-in affiliate module and the customer arrived via an affiliate link to your store, you can determine the affiliate id, code, and name on any page in the store. This allows you to change the look and feel of the store based on the affiliate referral. You can also combine this with the export function in the Tool Kit to create a flat file of affiliate orders which can be downloaded an analyzed with a program like MS Excel.
Page Includes
- External file insertion. Insert external file content (txt, html, etc.) directly into your page templates. You can also run external programs/scripts (php, asp, miva, cfm, etc.) to perform functions or return data to display in your page templates at any location. This content can be from your domain or even from another domain anywhere on the Internet. If on your domain, you can check for the existence of the external file or program before running the functions.
You can use the callurl functions to pass variables to the target file or use the faster, file read function if that is not needed.
You can hide content unless the customer fits a certain profile, e.g. is in an availability or price group.
- Mini-page insertion. Insert the contents of any page template directly inside another page template. Build small widgets or objects using the add page template feature in Merchant. The objects can contain store morph code which can display dynamic data to the customer. The ability to display these widgets is handy for displaying a specials category on your storefront, a minibasket or shipping calculator on any page in the store, custom navigation objects at any location, and dozens of other uses.
Email Features
- Send screen snapshot to a friend. This is the ultimate tell a friend email module. Send a snapshot of any page in your store to a friend. The snapshot can include
a message to the friend along with a link to the actual page. You can also include a math challenge question to cut down on automated form spammers. You can even specify the character encoding of the email if your store uses other character sets so the page will look correct.
- Unlimited contact us forms. Create as many contact, inquiry, support, formmail, etc. type pages in your store as you want.
Each page can have a distinct layout page to receive and validate the inputs. That receiving page is then emailed to your
store staff. You can include a math challenge question to cut down on automated form spammers.
- Send email from any page. Create email
templates which can be sent from any page in the store.
- Send welcome emails. Generate welcome emails
when new customers create an account.
File Export/Import
- Flat file export and import. You can export to a flat log file any variable on any merchant page. You can also read in and
display the contents of the flat file.
- Real time export order to XML file. Export order data to an xml file as each order is completed.
- Deal of the Day. Export and import the
daily deal product and coupon (requires coupon module) codes.
State List
- State alphabetical list. The built in state list is not entirely in alphabetical order. It is alphabetized on
state CODE so Virginia comes before Vermont. This function sorts the list by state NAME.
Below is a list of functions currently in the tool kit.
There is also example template 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. For those who want more than the
simple functions listed, you can build expressions and
create variables using the
built in mivascript functions listed in the reference
manual. Use mvassign and mveval to build complex
expressions. Study the examples and create your own
customizations of the page templates.
- Mivascript expressions - mvassign, mveval
- String - substring, newsubstring, gettoken, vgettoken,
vassign, sassign, vlength, vglosub, sglosub, concat, padl,
padr, no_apostrophe, hyphen, hyphen2
- Math - math_add, math_subtract, math_multiple,
math_divide, math_round, currencyformat, counter
- 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, asort, acount
- External file insertion - callurl, vcallurl, fileread, sexists
- Mini-page insertion - render, vrender
- Products in category list - cxp, cxpc
- Product find - vproduct_find, sproduct_find
- Featured products - quick, vquick
- Favorites list - custadd, custdelete, vquick, custfavcount
- Best sellers - bestseller
- New products - last, lastcat
- Recently purchased - current
- Related products - related
- Recommendation engine (suggested products) - alsobought
- Category lists - parentcat, subcat, subcat1, subcat2,
subcat3, subcat4, catimage, cattreeimage, sibling
- Category pagination and sorting - catpages, ctgyproduct_list
- Product list pagination and sorting - plstpages, plstproduct_list
- Price/Availability Groups - agrpinsert, vagrpinsert, pgrpinsert, pgroup, agroup, pgroup-p,
agroup-p, agroup-c, agroup-cats, agrpdelete, pgrpdelete
- Affiliate Tracking - affiliate
- Mini-basket - basket
- Breadcrumb navigation - breadcrumb, childof
- Product in categories - productincategory
- Custom product fields - custom, customc, prodinsert
- Custom customer fields - customer, custinsert
- Custom category fields - customcategory, customcategoryc
- Tool tips - newstring, nohtml, no_apostrophe
- Next/Previous buttons - nextprevious
- Attribute prompt vs code - prompt, pickprompt
- Attribute and option images - promptimage
- Meta tag text - productmeta, categorymeta
- Header/footer (CTGY & PROD) - header, footer
- Basket thumbnails - prodthumb
- Basket weight - weight
- Basket subtotal - subtotal
- Basket clear all - clearall
- Basket one click update - basketoneclick
- Update basket with cookie - updatebasket
- Refill basket's customer info - basketfiller
- Continue shopping - lasturl, create, trim, remove
- Shipping Calculator - shipcalc
- Agreement page - render
- Order minimums for groups - subtotal, pgroup, sassign,
vassign, sacreate, render
- Order subtotal - subtotalorder
- Open (expanded) category tree - parentcat, subcat,
subcat1, subcat2, subcat3, subcat4
- State alphabetical list - states
- Country name - country
- Force login - render
- Block IP - vassign, render
- Enhanced Maintenance - vassign, sassign, vacreate, render, exit
- Keep customer logged in - logbackin
- Customer login lookup - loginlookup
- Order history - pastorders
- Price groups prior purchase history - customer, custinsert,
math_add, pgrpinsert
- Reorder - see pastorders
- Printable Invoices - pastorders
- Retrieve page name - pageinfo
- Elapsed time for page render - vassign, math_subtract
- Random product display - randomall, randomcat, sassign, random, vrandom,
math_add, vgettoken, vproduct_find, concat, math_subtract
- Proceed code generation - randomstring, custinsert, customer, smtp
- Send screen snapshot to a friend - sendpage
- Unlimited contact us forms - sendpage
- Flat file access - import, export
- Real time export order to XML file - exportxmlbegin, exportxml, exportxmlend
- Header output - headeroutput, vheaderoutput
- Short links - tksl
- Form validation - systemaction
- Deal of the Day - export, import, sassign, vassign, mvassign,
randomall, vproduct_find
- Wait List - waitlist, waitlistshow
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
<mvt:item name="toolkit" param="vassign|ip|remote_addr" />
Your IP: &mvte:global:ip;
Displays the IP address of the customer.
<mvt:item name="toolkit" param="vassign|camefrom|http_referer" />
<mvt:if expr="NOT ISNULL g.camefrom">
You came from: &mvte:global:camefrom;
</mvt:if>
Displays the url the customer came from.
The 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%
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="time_t_second|nsecond|our_time" />
<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.
In admin, you can search a product custom field and display the matching products in a table. If you include your email
address you can have the list emailed to you as an attachement. Click the + to the left of the word Utilities and scroll
down to the Emporium Plus Tool Kit. Click the link.
Beginning with Tool Kit version 5.163, you can use the product code instead of the product ID by using the function
customc. Sometimes the code is available and the ID is not. That said, if the ID is available use the custom
function as it is faster.
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:sub_category: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>
Combine this function with other functions. In the
example below you can set order minimums for groups. This
example sets an order minimum of $50.00 for customers in
the Platinum price group. It has a custom message which is
displayed on the standard order minimum page. Put this
block of code at the very top of the OSEL page template.
<mvt:item name="toolkit" param="subtotal|basketsubtotal" />
<mvt:if expr="g.basketsubtotal LT 50">
<mvt:item name="toolkit" param="pgroup|pcount" />
<mvt:if expr="g.pcount GT 0">
<mvt:foreach iterator="customer_pgroup" array="customer_pgroups">
<mvt:if expr="l.settings:customer_pgroup:name EQ 'Platinum'">
<mvt:item name="toolkit" param="sassign|showmin|1" />
</mvt:if>
</mvt:foreach>
</mvt:if>
<mvt:if expr="g.showmin">
<mvt:item name="toolkit" param="sacreate|error_message|Your price group requires $50.00 minimum order!|," />
<mvt:item name="toolkit" param="sassign|Error_Message_Count|1" />
<mvt:item name="toolkit" param="vassign|Error_Messages|l.all_settings:error_message" />
<mvt:item name="toolkit" param="render|OMIN" />
<mvt:exit>
</mvt:if>
</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.yourdomain.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.yourdomain.com/c/&mvte:breadcrumb:code;/&mvta:breadcrumb:name;.html">
&mvt:breadcrumb:name;</a></b>
<mvt:else>
<a href="http://www.yourdomain.com/c/&mvte:breadcrumb:code;/&mvta:breadcrumb:name;.html">
&mvt:breadcrumb:name;</a>
</mvt:if>
</mvt:foreach>
</mvt:if>
In admin, you can search a product custom field and display the matching products in a table. If you include
your email address you can have the list emailed to you as an attachement. Click the + to the left
of the word Utilities and scroll down to the Emporium Plus Tool Kit. Click the link.
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>
Like the forced login, you can replace a page if the
customer does not agree to terms, i.e. an agreement page.
For example, on the OSEL page you could have
<mvt:if expr="g.TK NE 1">
<mvt:item name="toolkit" param="render|SFNT" />
<mvt:exit>
</mvt:if>
Create a new page called AGREE. On the OCST page template
instead of the hidden input for screen going to OUSL, you
could go to AGREE. Then in the form on the AGREE page,
make sure you have a hidden input called TK and the Screen
going to OSEL. You can see it working at
our test store. If you are using the upsell feature in
your store, you will need to adjust the screen inputs
accordingly.
You can use this function in conjunction with our Power
Search module to show similar search results from two or
more different stores on one screen.
Example
You can use vrender if the second parameter is a variable rather than a hard
coded string.
You can also have an optional 3rd parameter in the render function. Instead of
automatically displaying the page requested, it saves the page to a variable (the
3rd parameter). You can then use Tool Kit code to extract data or sections of text
from that variable. An example usage of this is the search of a page called ARCHIVE
to find obsolete product codes and replace them with alternate codes, then redirect
to the new page.
<mvt:item name="toolkit" param="render|ARCHIVE|archive_list" />
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>
Other variables available with this function are basketweight, baskettotal, basketsubtotal,
basketsubtotalF, basketother, basketotherF
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 and the category code is in the url. 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>
Another use might be to redeem a "group" coupon. For example,
put the following on the ACED (account edit page) to enter
customers into the coupon special price group if they enter
coupon code SURPRISE and click the redeem button.
Enter coupon for price group membership:
<form method="post" action="&mvt:global:secure_sessionurl;">
<input type="hidden" name="Store_Code" value="&mvte:global:Store_Code;">
<input type="hidden" name="Action" value="">
<input type="hidden" name="Screen" value="ACED">
<input type="text" name="tkcoupon" value="" size="15">
<input type="submit" name="trash" value="Redeem">
</form>
<mvt:if expr="g.tkcoupon">
<mvt:if expr="g.tkcoupon EQ 'SURPRISE'">
<mvt:item name="toolkit" param="pgrpinsert|maxgrp|Coupon Special" />
<mvt:if expr="g.maxgrp">
You are now entered into the &mvte:global:maxgrp; price group.
</mvt:if>
<mvt:else>
Invalid
</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|," />
You can also sort a single dimension array alphabetically with asort.
<mvt:item name="toolkit" param="sacreate|cast|Zanuck, Howard, Winkler, Williams|," />
<mvt:item name="toolkit" param="asort|cast2|l.all_settings:cast" />
<mvt:foreach iterator="actor" array="cast2">
<br> &mvte:actor;
</mvt:foreach>
44. Use agrpinsert to insert a customer into an availability group.
This could be used on the sfnt or aced (landing) 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 aced 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>
The function above accepts a constant for the 3rd parameter.
You can use a variable, e.g. as part of a url or form
post by using the function vagrpinsert.
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 #. This function is
used with our
Deal of the Day feature which requires our Coupon
Redemption and Tool Kit modules. The step by step
how to explains the page creation, coupon generation,
and upload to Twitter.
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. In addition to the variables
in the examples below, the pastorder:bill_zip and pastorder:bill_email
are populated.
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>
Important: If you have code on your INVC page for affiliate,
tracking, analytics, etc. you need to surround that code
with a conditional that makes sure it only runs if the
Action variable is AUTH. That way re-displaying the invoice
will not run the code.
<mvt:if expr="'AUTH' CIN g.Action">
do code that should only run when action is AUTH
</mvt:if>
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.
In version 5.080 and newer you can have a 4th parameter if you are also using our Power Search module. If you are not using our Power Search module, do not use the 4th parameter setting. The lasturl token will include name, code and description field searches. If you are using Power Search but not including custom fields to be searched in Power Search then use this token on the SRCH page instead of the default above.
<mvt:item name="toolkit" param="lasturl|url|http://www.yourdomain.com/mm5/merchant.mvc|1" />
If you are including custom fields to be searched, you need to include each of those that are selectable in the SRCH screen in the 4th parameter. If they are not selectable, do not include them. For example
<mvt:item name="toolkit" param="lasturl|url|http://www.yourdomain.com/mm5/merchant.mvc|srch_circa,srch_actors,srch_company,srch_director" />
would check to see if the customer had selected to search the fields circa, actors, company, and director. If
they did, the continue shopping would also select them.
In version 5.085 you can even put the continue shopping button on a static page like index.html, policies.html,
shipping.html, etc. You must setup the lasturl system as above and have that working before putting the link on static pages. The url is a bit different.
<a href="http://www.yourdomain.com/mm5/merchant.mvc?Action=NEW&SubScreen=TKLAST&Store_Code=yourstorecode">Continue Shopping</a>
65. Use updatebasket to insert a value in a field in the customer's basket. This is likely to be used
in conjunction with the cookie saving and reading functions in the tool kit. Here is an example of updating the basket with the "ship to" state value. This is useful if you have modules which display shipping before checkout, e.g. our mini-basket module. The customer doesn't have to fill in the data since it is already known from their saved cookie.
<mvt:item name="toolkit" param="updatebasket|ship_state|g.value" />
See this
example code for setting and reading cookies.
66. Use productincategory to retrieve the categories a product is in. This can be used in conjunction
with the breadcrumb function to display breadcrumbs to all of the categories a product is in. This example
combines the two functions.
<mvt:item name="toolkit" param="productincategory|incatcount|g.Product_Code" />
<mvt:if expr="incatcount GT 0">
<mvt:foreach iterator="incategory" array="incategories">
<mvt:item name="toolkit" param="breadcrumb|b_count|l.all_settings:incategory:code" />
<mvt:if expr="b_count GT 0">
<br><a href="http://www.yourdomain.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.yourdomain.com/c/&mvte:breadcrumb:code;/&mvta:breadcrumb:name;.html">
&mvt:breadcrumb:name;</a></b>
<mvt:else>
<a href="http://www.yourdomain.com/c/&mvte:breadcrumb:code;/&mvta:breadcrumb:name;.html">
&mvt:breadcrumb:name;</a>
</mvt:if>
</mvt:foreach>
</mvt:if>
</mvt:foreach>
</mvt:if>
67. Use header to save the category or product header to a variable. Then display the variable. It only
works on the screen = CTGY or PROD. The Category_Code or Product_Code variable needs to be present so the function knows which category or product header to lookup. The second parameter in the function is the variable
name you want to save it to.
<mvt:item name="toolkit" param="header|cathead" />
&mvt:global:cathead;
68. Use footer to save the category or product footer to a variable. Then display the variable. It only
works on the screen = CTGY or PROD. The Category_Code or Product_Code variable needs to be present so the function knows which category or product footer to lookup. The second parameter in the function is the variable
name you want to save it to.
<mvt:item name="toolkit" param="footer|catfoot" />
&mvt:global:catfoot;
69. Use mvassign if you want to use mivascript expressions on the store morph page templates. This function
works similar to the MvASSIGN in mivascript. It allows you to assign a value to a variable based on an expression. Most functions in the mivascript reference manual can be used. The second parameter in the token is the global variable you are assigning the value to. The third parameter is a mivascript function with applicable variables. After the token you can then display the value. For example:
<mvt:item name="toolkit" param="mvassign|word|substring(l.all_settings:product:descrip,1,200)" />
&mvte:global:word;
Displays the first 200 characters in the product description on a product page template.
<mvt:if expr="l.settings:product:cost GT l.settings:product:price">
<br>MSRP: <s>$&mvt:product:cost;</s>
<mvt:item name="toolkit" param="mvassign|savings|rnd(l.all_settings:product:cost - l.all_settings:product:price,2)" />
<mvt:item name="toolkit" param="mvassign|percent|rnd((g.savings/l.all_settings:product:cost) * 100,2)" />
<br>Your Price: <b>&mvt:product:formatted_price;</b>
<br>Savings:
<font color="red">
$&mvte:global:savings; (&mvte:global:percent;%)
</font>
<mvt:else>
<br>Price: <b>&mvt:product:formatted_price;</b>
</mvt:if>
If you setup the cost as MSRP and it is higher than the price,
you can show the difference and percentage savings.
<mvt:item name="toolkit" param="mvassign|imgurl|'/mm5/graphics/00000001/' $ tolower(l.all_settings:product:code) $ '.gif'" />
<mvt:item name="toolkit" param="mvassign|vpath|sexists(g.imgurl)" />
<mvt:if expr="g.vpath">
<img src="&mvte:global:imgurl;" border="0">
<mvt:else>
No Image Available
</mvt:if>
For stores whose images are named based on the product code, this function checks for the existance of
an image file and displays it.
70. Use mveval if you want to display the results
of an expression directly without creating a variable
first. It works like mvassign and can use the dozens of
mivascript functions. The difference is the global
variable is omitted. Some examples:
MSRP: <mvt:item name="toolkit" param="mveval|l.all_settings:product:price * 1.1" />
This example multiplies the product price by 110%
<mvt:item name="toolkit" param="mveval|glosub(l.all_settings:product:name,asciichar(34),' ')" />
Removes the " character from the product name.
<mvt:item name="toolkit" param="mveval|gettoken(l.all_settings:product:descrip,'#',2)" />
Shows text in the product description after the # character.
Great for use with multilanguage stores or for adding
custom field like data directly in the description.
71. Use catpages to display category pagination. Number the category pages with configurable
links to any page in the category. See
this page for an example.
<mvt:item name="toolkit" param="catpages|l.all_settings:category:id" />
<table>
<tr>
<td colspan="2" align="right" nowrap>
<mvt:item name="fonts" param="ctgy_font">
<mvt:if expr="l.settings:cxp_total_pages GT 0">
Page &mvt:cxp_current_page; of &mvt:cxp_total_pages;
<br>
</mvt:if>
<mvt:if expr="l.settings:cxp_total_pages GT 1"> |
<mvt:foreach iterator="pages" array="cxp_offset">
<mvt:if expr="l.settings:pages:buffer GE 5
AND l.settings:pages:number NE 1 AND
l.settings:pages:number NE l.settings:cxp_total_pages">
<mvt:if expr="l.settings:pages:buffer EQ 5">
<a href="&mvt:global:sessionurl;Screen=CTGY&Store_Code=&mvta:store:code;&Category_Code=&mvta:global:category_code;&offset=&mvt:pages:offset;">
<mvt:if expr="l.settings:pages:number GT l.settings:cxp_current_page">
<img src="graphics/right.gif" border="0"> </a>
<mvt:else>
<img src="graphics/left.gif" border="0"> </a>
</mvt:if>
</mvt:if>
<mvt:else>
<mvt:if expr="l.settings:cxp_current_page EQ pos1">
&mvt:pages:number; |
<mvt:else>
<a href="&mvt:global:sessionurl;Screen=CTGY&Store_Code=&mvta:store:code;&Category_Code=&mvta:global:category_code;&offset=&mvt:pages:offset;">
&mvt:pages:number;</a> |
</mvt:if>
</mvt:if>
</mvt:foreach>
<br>
</mvt:if>
Total products in &mvt:category:name;: &mvt:cxp_product_total;
</mvt:item>
</td>
</tr>
</table>
FTP the left.gif and right.gif to the mm5/graphics directory.
The example doc combines the page
numbering of catpages with the sorting and page length selection of the ctgyproduct_list function.
72. Use customer to display the contents of a
custom customer field when the customer is logged in.
Use it to display things like membership number, sales
rep, etc. The second parameter is the global variable you
want to save the custom field value to. The third
parameter is the custom field code.
<mvt:item name="toolkit" param="customer|member|membership" />
&mvte:global:member;
73. Use custinsert to insert a variable value
into a custom customer field when the customer is logged
in. Use it to capture values like tax ID, sales rep,
etc. The second parameter is the custom field code (case
sensitive) to save the variable value to. The third
parameter is the variable name.
<mvt:item name="toolkit" param="custinsert|taxid|g.mytax" />
You can use this function in conjunction with other functions to perform complex tasks.
For example, you can assign customers to price groups based on their prior purchase
history. Step one: Create a custom customer field under admin utilities called orders.
Step two: Insert the following code anywhere on the INVC page template. This code will
read the custom customer field called orders for the current customer and retrieve
the value in that field. It will then sum the existing value with the order total.
It will then insert that new value back into the orders field.
<mvt:if expr="'AUTH' CIN g.Action">
<mvt:item name="toolkit" param="customer|current_total|orders" />
<mvt:item name="toolkit" param="math_add|new_total|g.current_total|l.all_settings:order:total" />
<mvt:item name="toolkit" param="custinsert|orders|g.new_total" />
</mvt:if>
Step three: Anywhere on the ACED page template insert the following code. It will retrieve
the current total from that field. In the below example there are two conditions;
current total over 50 and current total over 25. If it is not over 50, it checks to
see if it is over 25. If the first or second test is true, it inserts the customer
into the price group listed in the function (PG50 or PG25). You can have as many
conditional checks as you want with corresponding tiers. You just have to write the
conditionals for it. After the customer logs in and lands on the account edit page,
this code will run and insert them into the appropriate price group. If you use the
pgroup function above you can even display the price groups a customer is in on the
account edit page.
<mvt:item name="toolkit" param="customer|current_total|orders" />
<mvt:if expr="g.current_total GT 50">
<mvt:item name="toolkit" param="pgrpinsert|maxgrp|PG50" />
<mvt:else>
<mvt:if expr="g.current_total GT 25">
<mvt:item name="toolkit" param="pgrpinsert|maxgrp|PG25" />
</mvt:if>
</mvt:if>
74. Use sendpage to send a snapshot of any page
in your store to an email address. See the bottom left
form on
this page as a tell a friend example. You can also
use it to send responses in a contact us form to an email
address. You can have unlimited contact forms for surveys,
support, general inquiries, etc.
<mvt:item name="toolkit" param="sendpage" />
is inserted inside the form you put on the page. See this
example page on how to use this feature.
75. Use randomcat to create a random, non-repeating array of products from a specified category. The 2nd parameter is the variable name to save the count to. The 3rd parameter is a variable representing the category code. The 4th parameter is the number of random products to load into the array. If the category does not have that many products in it, it will return the number of products in the category as the count. In this example we are loading
an array of 5 random products from a category whose code is SPECIALS.
<mvt:item name="toolkit" param="sassign|cat_code|SPECIALS" />
<mvt:item name="toolkit" param="randomcat|pcount|g.cat_code|5" />
<mvt:if expr="pcount GT 0">
<table border="0" width="100%" cellpadding="3" cellspacing="3">
<tr valign="top" align="center">
<mvt:foreach iterator="sub_product" array="sub_products">
<td>
<a href="&mvt:global:secure_sessionurl;Screen=PROD&Product_Code=&mvta:sub_product:code;">
&mvt:sub_product:name;</a> <br>
&mvt:sub_product:formatted_price;<br>
<mvt:if expr="NOT ISNULL l.settings:sub_product:thumbnail">
<img src="&mvt:sub_product:thumbnail;" border="0">
</mvt:if>
</td>
</mvt:foreach>
</tr>
</table>
</mvt:if>
76. Use randomall to create a random, non-repeating
array of products from the entire store. The 2nd parameter
is the variable name to save the count to. The 3rd
parameter is the number of random products to load into
the array. In this example we are loading an array of 5
random products from the store. You can see an
example display using the code below.
<mvt:item name="toolkit" param="randomall|pcount|5" />
<mvt:if expr="pcount GT 0">
<table border="0" width="100%" cellpadding="3" cellspacing="3">
<tr valign="top" align="center">
<mvt:foreach iterator="sub_product" array="sub_products">
<td>
<a href="&mvt:global:secure_sessionurl;Screen=PROD&Product_Code=&mvta:sub_product:code;">
&mvt:sub_product:name;</a> <br>
&mvt:sub_product:formatted_price;<br>
<mvt:if expr="NOT ISNULL l.settings:sub_product:thumbnail">
<img src="&mvt:sub_product:thumbnail;" border="0">
</mvt:if>
</td>
</mvt:foreach>
</tr>
</table>
</mvt:if>
77. Use counter to increment a number for the items in an array. One use is to number the products on the
product list page. Just before the foreach loop for products put the token to initialize the variable with an existing variable. Offset is a variable which holds the count of products from the beginning. On page 1 it is zero, but for each page that number goes up. So just before the loop, put
<mvt:item name="toolkit" param="counter|current_nbr|g.offset" />
Existing loop beginning <mvt:foreach iterator="product" array="products">
Then just before the display of the product info, put
<mvt:item name="toolkit" param="counter|current_nbr" />
&mvte:global:current_nbr;.
If there is no need to initialize the variable you can leave that line out. When the 3rd parameter is used, it sets
the starting number. When there is no 3rd parameter, then 1 is added to the counter variable (which is the 2nd parameter).
78. Use prodthumb to retrieve the url to the product thumbnail for display in locations like the basket. The
second parameter is the variable to save the url to. The third parameter is the product code.
<mvt:item name="toolkit" param="prodthumb|imgurl|l.all_settings:item:code" />
<mvt:if expr="g.imgurl">
<img src="&mvte:global:imgurl;" border="0">
<mvt:else>
</mvt:if>
79. Use shipcalc to create a shipping calculator, i.e. an array of shipping methods which can be displayed on any screen in the store. Let your customers calculate shipping on the basket (or other) screen prior to checkout. Create a new page called SHIPCALC. The initial token on the page is
<mvt:item name="toolkit" param="shipcalc|1|1|1|cost|sortship" />
The 2nd parameter is state, required (1) or not (0). The 3rd is zip, required (1) or not (0). The 4th is country,
required (1) or not (0). The 5th is the sort order. The choices are cost, name, code, and module. If left blank, the shipping options will not be sorted. The 6th parameter is used if you have either our
Sort Shipping Plus Free Shipping Option (sortship) or the CBS Shipping Supermod (cbs-supshipping5) installed. This will implement the special rules, e.g. location restrictions that those modules use. Leave it blank if you do not have either of these.
To create the SHIPCALC page, you will need the
example source code.
You may have to view source on that page if the browser tries to render the code on that page. Copy and paste the source on that
page to the new SHIPCALC page template. Assign the following items to that page: states, countries, colors, fonts, and toolkit. If you have the CBS Shipping Supermod and have included its module code in the 6th parameter, you
will also need to assign the minibaskship item to the page. If a customer has something in the basket, the shipping calculator will display its button. Note: we have included the link near the end to use a button
called shipping.gif in the root directory. You will need to upload a gif file to your domain root directory. You can put it in another directory; just adjust the code near the end of the template to its actual location. The template is ready to go after you upload the button and change the 6th parameter based on your store's installed modules. If you make changes to the template, it is up to you to troubleshoot your code. Now that you have created your template, a single line is used to insert it into any page in your store.
<mvt:item name="toolkit" param="render|SHIPCALC" />
To see how it works,
click here, then click the calculate shipping button.
80. Use fileread to insert the contents of a file
into any page template and at any location you want it.
This is similar to the vcallurl function above. But there
are three important differences. This function is faster
than vcallurl. This function does not pass any variables
(name value pairs) to the called file. This function can
only read files in the same domain, whereas
vcallurl can read from any domain.
The fileread function will check for the existance of the
file. The second parameter in this function is the
variable that the file contents are saved to. The third
parameter is always the word script. When displaying the
contents of the file, if it contains html, use &mvt. If
it does not, use &mvte.
<mvt:item name="toolkit" param="sassign|filepath|/mm5/5.00/extras/%code%.txt" />
<mvt:item name="toolkit" param="vglosub|filepath,%code%,l.all_settings:product:code" />
<mvt:item name="toolkit" param="fileread|content|script|filepath" />
&mvt:global:content;
81. Use affiliate to determine if the customer arrived at your store via an affiliate link and you are using
the built in affiliate module in your store. If the active session contains a valid affiliate code; the id, code and name of the affiliate is available for your use in template code. You might want to use it just to display the affilate company name as in the example below. Or you might want to use it in conditional code to export affiliate data to a flat file using our export function above.
<mvt:item name="toolkit" param="affiliate|myaffil" />
<mvt:if expr="g.myaffil">
Referred by: &mvte:myaffiliate:company;
</mvt:if>
82. Use loginlookup to lookup a customer's login by entering their email address into the input. This form
can be put on any page. In this example the code is put on a page template called LLU. Create a new page with the
code of LLU and insert the code below. You can then call that page with a link to the Screen=LLU or make a
javascript popup that shows that screen in a window. If you decide to put the form on a different page, simply change the value
of the hidden input called Screen to reflect the alternate page. In this example the login will be displayed on the page AND it will be emailed to the customer's email address if it is valid. You can eliminate the emailing by deleting
the hidden inputs for email_subject and email_message. You can eliminate the display by deleting the conditional code
that displays the Customer_Login_Lookup variable.
<html>
<body>
<h3> Customer Login Lookup</h3>
<mvt:if expr="g.Customer_Login_Lookup">
<mvt:if expr="',' IN g.Customer_Login_Lookup">
Your UserName Logins: &mvte:global:Customer_Login_Lookup;
<mvt:else>
Your UserName Login: &mvte:global:Customer_Login_Lookup;
</mvt:if>
</mvt:if>
<mvt:if expr="g.Error_Messages">
<font color="red">
&mvte:global:Error_Messages;
</font>
</mvt:if>
<mvt:if expr="g.email_sent">
<br> <br> Your login has been sent to &mvte:global:email_sent;
<br> <br>
</mvt:if>
<form method="post" action="&mvt:global:sessionurl;">
<input type="hidden" name="Store_Code" value="&mvte:store:code;">
<input type="hidden" name="Screen" value="LLU">
<mvt:item name="toolkit" param="loginlookup" />
<input type="hidden" name="Action" value="NEW">
<input type="hidden" name="email_subject" value="Your login ID">
<input type="hidden" name="email_message" value="Your username login: %customer_login%.">
Your Email Address: <input type="text" size="40" name="Customer_Email_Lookup" value="&mvte:global:Customer_Email_Lookup;">
<br>
<input type="submit" name="trash" value="Retrieve Login">
</form>
</body>
</html>
83. Use hyphen to replace spaces and non-alphanumeric characters in a variable, e.g. product name, with a hyphen so that you can use that variable in urls. The 2nd parameter is the variable to save the converted text to. The 3rd parameter is the variable holding the text to convert. This example converts the product name on the product list
page.
<mvt:item name="toolkit" param="hyphen|pname|l.all_settings:product:name" />
&mvte:global:pname;.html
84. Use hyphen2 to replace spaces in a variable,
e.g. product name, with a hyphen so that you can use that
variable in urls. It works like hyphen except it also
strips out non-alphanumeric characters like " / (). The
2nd parameter is the variable to save the converted text
to. The 3rd parameter is the variable holding the text to
convert. This example converts the product name on the
product list page.
<mvt:item name="toolkit" param="hyphen2|pname|l.all_settings:product:name" />
&mvte:global:pname;.html
85. Use customcategory to insert a custom category field value on the CTGY page template.
<mvt:item name="toolkit" param="customcategory|cattotal|l.all_settings:category:id|productcount" />
&mvte:global:cattotal;
This will check the custom category field "productcount" for the current category and save the value
to a variable called "cattotal". You can then mvte the cattotal variable to display it. Note: This function requires use of the Miva Corp built-in custom fields module and that you have created
custom category fields. This example is using the custom category field "productcount". That field is automatically created if you run the Products in Category Count under admin > utilities > Emporium Plus Tool Kit. Keep in mind, you cannot use the count feature if your store uses availability
groups or your products are hidden when they go out of stock. That is because the feature is run in admin whenever you change products in categories. It remains static until you run it again. In addition to being able to display the count as above, you can assign the custom field productcount to the category tree template and display counts in the tree with:
<mvt:if expr="NOT ISNULL l.settings:cattree_category:customfield_values:customfields:productcount">
(&mvt:cattree_category:customfield_values:customfields:productcount;)
</mvt:if>
<mvt:if expr="NOT ISNULL l.settings:cattree_category:customfield_values:customfields:cathaschild">
+
</mvt:if>
Beginning with Tool Kit version 5.163, you can use the category code instead of the category ID by using the function
customcategoryc. Sometimes the code is available and the ID is not. That said, if the ID is available use the
customcategory function as it is faster.
86. Use country to retrieve the name of the country when the country code is known. The country name is saved to the variable in the second parameter. The country code is a variable in the third parameter. In this example it is passing the basket variable for the ship to country code in the third
parameter. Note: There are many country codes which are shared between more than one country. In those cases it will retrieve the first matching record. For example TT is shared between Trinidad and Tobago.
<mvt:item name="toolkit" param="country|ccode|g.basket:ship_cntry" />
&mvte:global:ccode;
87. Use current to list the most recent products purchased. For example,
<mvt:item name="toolkit" param="current|pcount|10" />
<mvt:if expr="pcount GT 0">
<table border="0" width="200">
<th>Recent Purchases</th>
<tr><td align="center">
<font size="-1">
<mvt:foreach iterator="currentsale" array="currentsales">
<mvt:if expr="NOT ISNULL l.settings:currentsale:thumbnail">
<a href="&mvt:global:sessionurl;Screen=PROD&Product_Code=&mvta:currentsale:code;&Store_Code=&mvta:store:code;">
<img src="&mvt:currentsale:thumbnail;" border="0"></a><br>
</mvt:if>
<a href="&mvt:global:sessionurl;Screen=PROD&Product_Code=&mvta:currentsale:code;&Store_Code=&mvta:store:code;">
&mvt:currentsale:name;</a>
<br>
&mvt:currentsale:formatted_price;
<br><br>
</mvt:foreach>
</font>
</td></tr>
</table>
</mvt:if>
creates an array of the last 10 items purchased. The last parameter is the number of items
to display, eg 10.
88. Use pageinfo to capture and display the page
name of the page you are on.
<mvt:item name="toolkit" param="pageinfo" />
&mvt:pageinfo:name;
89. Use headeroutput to change the output of the header. In this example putting this on the first line
of a page template will change the Content-Type to application/json for use with ajax. The page will not be viewable
as html but will rather pass data to a javascript file for dynamic display, e.g. with an autocomplete input.
<mvt:item name="toolkit" param="headeroutput|Content-Type|application/json" />
A variation of this is the vheaderoutput which allows you to make the 3rd parameter a variable. An example
of this usage would be redirecting a visitor or search bot to another page when the old page has been moved. This
can be done in our short links page (TKSL). In the below example, a new url is constructed and saved to a variable
called "newurl".
<mvt:item name="toolkit" param="headeroutput|Status|301 Moved Permanently" />
<mvt:item name="toolkit" param="vheaderoutput|Location|g.newurl" />
90. Use plstpages to display product list pagination. Number the product list pages with configurable links to any page in the store's product list.
<mvt:item name="toolkit" param="plstpages" />
<table>
<tr>
<td colspan="2" align="right" nowrap>
<mvt:item name="fonts" param="ctgy_font">
<mvt:if expr="l.settings:plst_total_pages GT 0">
Page &mvt:plst_current_page; of &mvt:plst_total_pages;
<br>
</mvt:if>
<mvt:if expr="l.settings:plst_total_pages GT 1"> |
<mvt:foreach iterator="pages" array="plst_offset">
<mvt:if expr="l.settings:pages:buffer GE 10 AND l.settings:pages:number NE 1 AND l.settings:pages:number NE l.settings:plst_total_pages">
<mvt:if expr="l.settings:pages:buffer EQ 10">
<a href="&mvt:global:sessionurl;Screen=PLST&Store_Code=&mvta:store:code;&offset=&mvt:pages:offset;">
<mvt:if expr="l.settings:pages:number GT l.settings:plst_current_page">
<img src="graphics/right.gif" border="0"> </a> <mvt:else>
<img src="graphics/left.gif" border="0"> </a> </mvt:if>
</mvt:if>
<mvt:else>
<mvt:if expr="l.settings:plst_current_page EQ pos1">
&mvt:pages:number; |
<mvt:else>
<a href="&mvt:global:sessionurl;Screen=PLST&Store_Code=&mvta:store:code;&offset=&mvt:pages:offset;">
&mvt:pages:number;</a> |
</mvt:if>
</mvt:if>
</mvt:foreach>
<br>
</mvt:if>
Total products in &mvt:store:name;: &mvt:plst_product_total;
</mvt:item>
</td>
</tr>
</table>
FTP the left.gif and right.gif to the mm5/graphics directory.
91. Use tksl to create search engine optimized (SEO) links at the domain root level. Your link can
look like http://www.yourdomain.com/ABC.html. Add a new page template with the code TKSL (upper case). Assign the toolkit item to the items list of that page. In the body of the page you will have 3 lines.
<mvt:item name="toolkit" param="tksl" />
<mvt:item name="toolkit" param="vrender|g.Screen" />
<mvt:exit>
Then modify the .htaccess file slightly from the default code that is in it when you check "Enable short links" and
update under admin > global settings > domain settings > SEO settings. Retrieve the .htaccess file from the server. There should be 5 rules. Remove the rules for product and category (2nd and 3rd). Then change the product + category and the other screens (4th and 5th) to read
like this.
Test your store and make sure it is working. Then edit links in the category tree, CTGY, and PLST page templates. An
example in the CTGY would be:
http://www.YOURDOMAIN.com/&mvta:product:code;-p-&mvta:category:code;.html?Offset=&mvta:global:offset;
In the category tree:
http://www.YOURDOMAIN.com/&mvta:cattree_category:code;.html
In the PLST:
http://mm55.emporiumplus.com/&mvta:product:code;.html
You probably will not change the links in the SRCH page template because search engines don't perform fake searches
to see what products display. Besides, many of you are using our Power Search module which has a specially formatted
link so that customers can return to the exact spot they were at in the search results. You also
cannot have a category code the same as any product code, nor can a page code be
the same as any category or product code. These links and the .htaccess
example are used when you only have one store in your merchant.mvc. If you
have multiple stores you will need to devise extra parameters to handle the
store code. You can see these short links in use at this
test store.
You can modify the TKSL page even further to make it an error handler and give your store the ability to have
multiple category and product page templates without having to resort to expensive modules to do it. It handles this
page reassignment as fast, if not faster, than 3rd party modules written specifically to do this functionality. This
is discussed in parts 2 and 3 of the tksl.txt file.
92. Use systemaction to validate inputs from a page and redisplay the page if there is a problem. You use regular store morph code to validate the inputs. Put the following inside the form on the page sending the input values, e.g. on the OSEL page.
<mvt:item name="toolkit" param="systemaction|SHIP|OSEL|Please select a shipping method" />
The 2nd parameter is the "action" to check. In this example we are going to check for a shipping method being selected. If the customer does not select a method, we are going to reload the page identified with the 3rd parameter. The 4th parameter is the message. No html allowed in the message. Then we need to create a new page template to handle the validation code. The page code is the same as the original page plus "_SYSTEM". So the companion page for OSEL would be OSEL_SYSTEM. In this example we would then put the following on this new page.
<mvt:if expr="ShippingMethod EQ ''">
<mvt:item name="toolkit" param="mvassign|tkmessage|encodeentities(g.tkmessage)" />
<mvt:item name="toolkit" param="mvassign|tkscreen|encodeentities(g.tkscreen)" />
<mvt:item name="toolkit" param="vacreate|error_message|g.tkmessage|," />
<mvt:item name="toolkit" param="sassign|Error_Message_Count|1" />
<mvt:item name="toolkit" param="vassign|Error_Messages|l.all_settings:error_message" />
<mvt:item name="toolkit" param="vassign|Screen|g.tkscreen" />
</mvt:if>
<mvt:exit>
93. Use lastupdate to display the last updated time from a custom product, category or customer field that is tied to the record you are looking at. The module updates the time for products and categories when you add or edit a record in admin. It updates the customer record when they add or update their own record in merchant. If you are importing products from a flat file, you will need to put the current unix time in the column you are going to
use for lastupdate. You can easily get that unix time by updating any product record in admin. Then check its
custom product field for lastupdate. Copy and paste that number into your flat file.
To get you started, you can use our Template Data Feed module.
When exporting, if it finds an empty lastupdate, it inserts
the current unix time into the field. See its install doc
for the correct token. Finally, if you do not edit individually
in admin or you don't run the template data feed, you can
still insert an update into the empty lastupdate records. If
you include the below code on the page, when the page is next
visited, the token will update those that are empty with
the current unix time. It will not change that date on later
visits. Only updates as above will do that.
The time is unix time and it is stored in a custom field called lastupdate. Below are examples of each.
The -4 in the below examples is the time zone offset.
Put the following on the product page template at any location.
<mvt:item name="fonts" param="ctgy_font">
<mvt:item name="toolkit" param="lastupdate|lastupdate|-4|PRODUCT|l.all_settings:product:id" />
<mvt:if expr="g.lastupdate">
<mvt:item name="toolkit" param="mvassign|date2|g.lastupdate:DATE:MM$'/'$g.lastupdate:DATE:DD$'/'$g.lastupdate:DATE:YYYY" />
<mvt:item name="toolkit" param="sassign|days|Sunday#Monday#Tuesday#Wednesday#Thursday#Friday#Saturday" />
<mvt:item name="toolkit" param="vgettoken|g.days,#,g.lastupdate:DATE:DOW|cday" />
Updated: &mvte:global:cday; &mvte:global:date2; &mvte:global:lastupdate:TIME:HH;:&mvte:global:lastupdate:TIME:MM;:&mvte:global:lastupdate:TIME:SS;
<mvt:item name="toolkit" param="sassign|months|Jan#Feb#Mar#Apr#May#Jun#Jul#Aug#Sep#Oct#Nov#Dec" />
<mvt:item name="toolkit" param="vgettoken|months,#,g.lastupdate:DATE:M|cmonth" /> (&mvte:global:cmonth; &mvt:global:lastupdate:DATE:D;, &mvt:global:lastupdate:DATE:YYYY;)
</mvt:if>
</mvt:item>
Put the following on the category page template at any location.
<mvt:item name="fonts" param="ctgy_font">
<mvt:item name="toolkit" param="lastupdate|lastupdate|-4|CATEGORY|l.all_settings:category:id" />
<mvt:if expr="g.lastupdate">
<mvt:item name="toolkit" param="mvassign|date2|g.lastupdate:DATE:MM$'/'$g.lastupdate:DATE:DD$'/'$g.lastupdate:DATE:YYYY" />
<mvt:item name="toolkit" param="sassign|days|Sunday#Monday#Tuesday#Wednesday#Thursday#Friday#Saturday" />
<mvt:item name="toolkit" param="vgettoken|g.days,#,g.lastupdate:DATE:DOW|cday" />
Updated: &mvte:global:cday; &mvte:global:date2; &mvte:global:lastupdate:TIME:HH;:&mvte:global:lastupdate:TIME:MM;:&mvte:global:lastupdate:TIME:SS;
<mvt:item name="toolkit" param="sassign|months|Jan#Feb#Mar#Apr#May#Jun#Jul#Aug#Sep#Oct#Nov#Dec" />
<mvt:item name="toolkit" param="vgettoken|months,#,g.lastupdate:DATE:M|cmonth" /> (&mvte:global:cmonth; &mvt:global:lastupdate:DATE:D;, &mvt:global:lastupdate:DATE:YYYY;)
</mvt:if>
</mvt:item>
Put the following on the ACED (customer edit) screen at any location.
<mvt:item name="fonts" param="ctgy_font">
<mvt:item name="toolkit" param="lastupdate|lastupdate|-4|CUSTOMER|customer:id" />
<mvt:if expr="g.lastupdate">
<mvt:item name="toolkit" param="mvassign|date2|g.lastupdate:DATE:MM$'/'$g.lastupdate:DATE:DD$'/'$g.lastupdate:DATE:YYYY" />
<mvt:item name="toolkit" param="sassign|days|Sunday#Monday#Tuesday#Wednesday#Thursday#Friday#Saturday" />
<mvt:item name="toolkit" param="vgettoken|g.days,#,g.lastupdate:DATE:DOW|cday" />
Updated: &mvte:global:cday; &mvte:global:date2; &mvte:global:lastupdate:TIME:HH;:&mvte:global:lastupdate:TIME:MM;:&mvte:global:lastupdate:TIME:SS;
<mvt:item name="toolkit" param="sassign|months|Jan#Feb#Mar#Apr#May#Jun#Jul#Aug#Sep#Oct#Nov#Dec" />
<mvt:item name="toolkit" param="vgettoken|months,#,g.lastupdate:DATE:M|cmonth" /> (&mvte:global:cmonth; &mvt:global:lastupdate:DATE:D;, &mvt:global:lastupdate:DATE:YYYY;)
</mvt:if>
</mvt:item>
Put the following on the landing page after a new customer account is created at any location.
<mvt:if expr="g.Action AND g.Action IN 'ICST'">
<mvt:item name="toolkit" param="lastupdate|lastupdate|-4|CUSTOMER|customer:id" />
</mvt:if>
94. Use custadd to add a value to a comma delimited list in a custom customer field. This
is useful if you want to make a customer favorites list for logged in customers. First create a custom customer field. Name it anything you want. In this example we will call it myfav. Then on the product page put the following code. This code tests to make sure the customer is logged in. Then displays a link to add the product to the list. If the customer clicks the link, the page refreshes and the toolkit custadd item executes and adds the product to the custom field.
<mvt:if expr="g.basket:cust_id GT 0">
<a href="&mvte:global:sessionurl;Screen=PROD&Product_Code=&mvta:global:Product_Code;&Category_Code=&mvta:global:Category_Code;&Store_Code=&mvta:global:store:code;&favorite=&mvta:global:Product_Code;">
Favorites List</a>
<mvt:if expr="g.favorite">
<mvt:item name="toolkit" param="custadd|myfav|g.favorite" />
</mvt:if>
</mvt:if>
95. Use custdelete to remove a value from a comma delimited list in a custom customer field. It is usually used in tandem with the custadd function to create a favorites list. For example, you
can use the vquick function above to display products in the custom customer field. As you display those products you can use the custdelete link to let customers delete items from their favorites list.
<mvt:if expr="g.favdelete">
<mvt:item name="toolkit" param="custdelete|myfav|g.favdelete" />
</mvt:if>
<mvt:item name="toolkit" param="customer|fav|myfav" />
<mvt:if expr="g.fav">
<mvt:item name="toolkit" param="vquick|pcount|g.fav" />
<mvt:if expr="pcount GT 0">
<mvt:foreach iterator="quicklist" array="quicklists">
show product info in quicklist array
<a href="&mvt:global:secure_sessionurl;Screen=ACNT&Order=0&Store_Code=&mvta:global:store_code;&favdelete=&mvta:quicklist:code;">
Remove</a>
</mvt:foreach>
</mvt:if>
</mvt:if>
96. Use pgrpdelete to delete a customer from a price group. This could
be used in conjunction with automated price group membership management.
<mvt:item name="toolkit" param="pgrpdelete|maxgrp|Chairman" />
<mvt:if expr="maxgrp">
Your membership in the &mvte:global:maxgrp; price group has been terminated.
</mvt:if>
97. Use agrpdelete to delete a customer from an availability group. This could
be used in conjunction with automated availability group membership management.
<mvt:item name="toolkit" param="agrpinsert|avail|Wholesale" />
<mvt:if expr="avail">
Your membership in the &mvte:global:avail; availability group has been terminated.
</mvt:if>
98. Use smtp to send an email from any page in the store. You create an email
as a page template. Then using the token, e.g.
<mvt:item name="toolkit" param="smtp|VISITED" />
it will send the email. In this example I created a page template with the code VISITED and the name Page Visit. In the body of the page template I put the following
code:
<mvt:if expr="g.Screen CIN 'VISITED'">
<mvt:exit>
</mvt:if>
%subject|Product page visited%
%from|g.store:email%
%to|g.store:email%
<html>
<body>
The &mvt:product:name; product page was visited. <mvt:if expr="g.basket:cust_id GT 0">
The customer was &mvte:global:customer:bill_fname; &mvte:global:customer:bill_lname; at &mvte:global:customer:bill_email;
</mvt:if>
</body>
</html>
On the first line make sure the screen name is the exact same as the code for the page
template you created (case sensitive). The subject token is a string. It cannot be a variable at this time. The from and to tokens must be variables. In the example above the to token is g.store:email. It could have been g.customer:bill_email if you wanted to send something to logged in customers. Be careful on how you use this. You would not want a spammer to be able
to send emails through your store to hundreds of people. As long as you control the message and
the destination is your store or logged in customers, spamming would be unlikely.
You can create
as many email template pages as you want. For example, you might want to use the pgrpinsert function to assign customers to a price group. Then use the smtp function to send them an email
to highlight the benefits of the price group they were just assigned to. Then use a different
template to send them an email if their price group membership expires and you remove them with the pgrpdelete function. All of this can be automated with the Tool Kit functions.
If your version of the tool kit has the smtp function listed
in its admin screen here is the
how to.
Another useful email is the welcome email when new
customers create an account. Here's a quick
how to that should take less than 5 minutes (most
of that time to change the text in the welcome email) to
setup, saving you from buying a $40 module that does the same
thing and takes just as long to setup. You can see how
it works by creating a new account in our
test
store.
99. Use randomstring to generate a random string of characters. The second parameter is
the variable you want to save the string to. The third parameter is the length of the random string
you want to create. For example:
<mvt:item name="toolkit" param="randomstring|proceedcode|8" />
There are many things you might use this for. As example, use it in conjunction with custinsert to store a proceed code with a customer's record. If they know
the code, they can proceed in the checkout. Use the smtp function to send the customer the code. This would mean the customer would have to supply a valid email address to receive the code. If they used a
fake address, it is probably a fraudulent order. Hence, they would not receive the code and could not
proceed.
Instructions for this implementation are fairly easy to follow.
100. Use pickprompt to replace the attribute and option codes with their prompts in the picklist
screen which is run under manage shipments in admin. Locate the line
<mvt:foreach iterator="option" array="item:options">
On the line immediately following that, insert the following line.
<mvt:item name="toolkit" param="pickprompt|l.all_settings:option" />
Then in the next few lines replace attr_code with attr_prompt and opt_code with opt_prompt.
101. Use promptimage to replace or add to the attribute options. This will check for the existance of
an attribute/option image. If there is one it will create a variable that allows you to display the image in
the basket. Just before the item:options foreach loop put this line
<mvt:item name="toolkit" param="promptimage" />
Then a few lines down where the attribute and option codes are displayed you can use this code
<mvt:if expr="l.settings:option:opt_image">
<img src="&mvt:option:opt_image;" border="0" alt="&mvt:option:opt_code;">
</mvt:if>
to display the image if it exists.
102. Use exit to abruptly end the display. Here is an example usage to allow store owners
to keep the store open so they can work on it, but make it appear closed to all other visitors. The following code has a conditional in its first line. When 1 EQ 1 exists, this code is active.
If you change the code to 1 EQ 2, then none of this code executes. You put your IP address where you see the Xs in the first line. When you want the store in maintenance mode to all
visitors, but not yourself, you change it to 1 EQ 1. When done you change it back to 1 EQ 2. Don't forget to turn it back on. To you, your store will always appear open, so don't forget
and leave it closed to others. Assign the toolkit to all
pages in the store EXCEPT MNTN by going to admin:pages click items. Then find
toolkit. Click edit. Click pages. Assign to all pages EXCEPT MNTN.
This code below goes before any other text in the html_profile item which can be edited by clicking your store name in admin, then the HTML profile tab on the right.
<mvt:if expr="(1 EQ 1) AND (remote_addr NE 'XX.XXX.XXX.XX')">
<mvt:item name="toolkit" param="sassign|emessage|Closed for maintenance" />
<mvt:item name="toolkit" param="vacreate|error_message|g.emessage|," />
<mvt:item name="toolkit" param="sassign|Error_Message_Count|1" />
<mvt:item name="toolkit" param="vassign|Error_Messages|l.all_settings:error_message" />
<mvt:item name="toolkit" param="render|MNTN" />
<mvt:item name="toolkit" param="exit" />
</mvt:if>
Alternatively, you could use this technique on just one
screen that you are working on. You would put the code
on the effected screen just before the first line which
is the html_profile item. Visitors could see all of the
store except the one screen you activate the code on.
103. Use basketfiller to refill the basket's customer info if they have browsed your site
and then returned to checkout. When a customer goes to checkout and does NOT create an account, they enter their address info but it is not saved to the customer database. If they decide to go
back and shop some more, those values will not be retained with the typical Merchant flow. Instead
when they return to checkout the inputs are all blank. This function will refill those inputs with
the previously entered values if it is the same session. Insert this function at the beginning of the OCST page template.
<mvt:item name="toolkit" param="basketfiller" />
104. Use custfavcount to display on the product page the number of customer favorites lists
the product is in. See custadd and custdelete above for adding and deleting from the favorites list.
The 2nd parameter is the variable you are saving the count to. The 3rd parameter is the custom
customer field code for your favorites list. The 4th parameter is the product code variable.
<mvt:item name="toolkit" param="custfavcount|favcount|myfav|g.Product_Code" />
<mvt:if expr="g.favcount GT 0">
&mvte:global:favcount; customers have this product in their favorites list
</mvt:if>
105. Use prodinsert to insert a value into a custom product field. This is useful if you want to
keep track of the number of views a product has. In this case you would use it in conjunction with the
custom, math_add, and sassign functions above. Insert this example on the PROD page template.
<mvt:item name="toolkit" param="custom|lastip|l.all_settings:product:id|viewip" />
<mvt:if expr="g.lastip NE remote_addr">
<mvt:item name="toolkit" param="sassign|one|1" />
<mvt:item name="toolkit" param="custom|viewcount|l.all_settings:product:id|views" />
<mvt:item name="toolkit" param="math_add|newviews|g.viewcount|one" />
<mvt:item name="toolkit" param="prodinsert|l.all_settings:product:id|views|g.newviews" />
<mvt:item name="toolkit" param="prodinsert|l.all_settings:product:id|viewip|remote_addr" />
</mvt:if>
First create two custom fields, views and viewip. This example checks the IP address. If it is not the same as the last person to visit this page, it processes the lines that follow. The custom function
gets the current value in the views field. It then adds 1 to it. Then it inserts the new count into the views custom field and the IP address into the viewip custom field.
106. Use acount to count the number of elements in an array.
<mvt:item name="toolkit" param="acount|number_actors|l.all_settings:cast" />
Count: &mvte:global:number_actors;
107. Use sibling to load a parent's subcategories into an array when starting
from one of the subcategories. This gives you the sibling categories to the current category. It saves the sibling
category count to a variable of your choosing. You can then display the contents of the siblings array. This function
does not capture the image urls. You can use the functions catimage or cattreeimage (see above) to retrieve the image
urls. To display sibling names, you could use code like
<mvt:item name="toolkit" param="sibling|scount|g.Category_Code" />
<mvt:if expr="scount GT 0">
<mvt:foreach iterator="sibling" array="siblings">
&mvt:sibling:name;
</mvt:foreach>
</mvt:if>
108. Use waitlist to determine if a product or its variants are out of stock. This function requires Miva Merchant
version PR7 or newer. Typically, this function is used on the special WAITLIST page template which is called from the
product page. You would not use it on other pages. See the
how to document for
instructions for the other pages. The function also sends pending emails to wait listed customers
automatically if the product or its variants are detected as being back in stock whenever the PROD page loads, either
by a customer or search engine visiting the page. A typical scenario is a customer puts a product in their basket and
it goes out of stock, but they leave the store without buying. A little while later another customer visits the page
and puts their email address in the wait list queue. If you have an automatic restocking module, like our Restock
Shelves, or you do daily basket deletions, the item is placed back in stock that same day. In other wait list systems,
the email is only sent when store employees manually take action to send emails for back in stock products. They may do
this only when new inventory arrives and they update their store. Conversely, the Tool Kit waitlist is continually
checking inventory and purging the queue throughout the day. Each product page in your store is likely to be visited by
multiple search engine bots throughout the day. This allows you to recapture the sale before they look elsewhere. The
function also removes the wait listed customer emails from the wait list as the emails are sent. It also adds customers
to the wait list if they enter their email address and submit the form. They do not have to be logged in or have an
account. However, if they are logged in, they can check their entire wait list using the waitlistshow function.
They can also remove items from their wait list if they change their mind. The token used on the PROD page is
<mvt:item name="toolkit" param="render|WAITLIST" />
The token used on the ACED page is
<mvt:item name="toolkit" param="waitlistshow|wcount" />
In admin, the store employees can check an individual user's wait list and remove all of their entries if they want to.
They can also list all products which have someone waiting for them to come back in stock. That list can be sorted by
product name or code and can be used to identify potential products to order.
109. Use ctgyproduct_list to create as many different category page templates with sorting and pagination that
you want without having to
buy a module other than this Tool Kit, which you already have. With this function you can create new page templates,
e.g. CTGY1, CTGYLINE, CTGYCOL3, CTGYCOL4, and so on. You will probably use this function in conjunction with the
catpages (pagination) token above. First let's modify your default CTGY page template. Go to the CTGY page template.
Click the Category Product List Layout tab at the top. Copy that product list layout template code to the clipboard.
Click back to the main CTGY page template input and locate the line <mvt:item name="product_list" /> and remove it.
Paste the code you copied to the clipboard at the location where you removed the product_list item. Update the page.
Click on the word "Items" at the top of the page and unassign the product_list item. Then assign the toolkit item.
Then insert the following line just after the body item tag (<mvt:item name="body">) in the CTGY page template.
<mvt:item name="toolkit" param="ctgyproduct_list|10|cxp.asc|1" />
You can quickly create multiple category templates by copying and pasting the contents of the main CTGY page template
which you just modified into a new page. Then edit the product list layout part of the template to the
various layouts you want. If you don't know where to start on editing the product list layout part, you can go up to
the Items link at the top and reassign the product_list item. Then click the link at the top for the Product List Layout. If it does not say Category Product List Layout, switch to point and click mode and the first
input lets you choose the layout. Change it to Category Product List Layout and save. Design the layout you want, e.g.
expanded vs line, number of columns, fields to show, etc. Save the new layout. Copy the layout and paste it into the
main page, overwriting the old product list layout design. Save the changes. Click Items and unassign product_list.
Using this technique, you can quickly design several different pages with different layouts.
See the TKSL function above on how to redirect to these multiple page templates and
incorporate short SEO links in the format http://www.yourdomain.com/ABC123.html.
Note that the above has 4 required parameters. The 1st calls the function. The second is the number of products per page
to show when the page initially loads. The customer can select to see more per page if you give them the drop down to
choose alternate numbers. The third parameter is the sort order that the products
are in when the page first displays. cxp.asc is the default list order; the same that you see when in your admin. You
can have a drop down to let the customer sort differently, e.g. by best sellers in the category. The fourth
parameter is the option to load custom product field values for each product displayed. If the customer chooses to show
All products in the category and that category has 1000 products you might want to have a conditional
to turn off that flag. For example
<mvt:if expr="g.ProductsPerPage GT 200">
<mvt:item name="toolkit" param="ctgyproduct_list|10|cxp.asc|0" />
<mvt:else>
<mvt:item name="toolkit" param="ctgyproduct_list|10|cxp.asc|1" />
</mvt:if>
The example doc combines the page
numbering of catpages with the sorting and page length selection of the ctgyproduct_list function. If
you setup a new store after May 1, 2010 you are probably using the CSSUI. Here is the
CSSUI example doc if that
is the case.
There may be times when you don't want a product to be found in the category pages and only available by direct link.
Insert <!-- miva_nodisplay //--> anywhere in the description of the products and they will not show in the
category pages. The text will also not display in the description because it is surrounded with html comment tags.
You can do this with the category and product list pages, and if you are using our Power Search module, the search
page. Since I mentioned Power Search, take a look at this
example
category. Just below the category title is a search
button. Click it. This takes you to the Power Search
screen filtered to only show this category. This gives you
full keyword search along with the dynamic faceted
navigation. Customers are able to drill down to the
desired product much quicker than one way category navigation.
Allow your customers to refine their search by incorporating
the Power Search module into your site's internal search methodology.
While not part of the ctgyproduct_list function, I'll mention the ability to have multiple PROD page templates here. The
procedure for creating new product pages is similar to categories but you do not have to unassign items. You also do not
have to copy and paste the product layout to the main page. You can leave the items in place so the tabs for each
page component will be accessible for cleaner editing. You will need to fix the product list layout tab. The default
is category. On the PROD pages that needs to be related products. So click the product list layout tab at the top
after you create the new page. Then on that screen, change the layout to related product list layout.
110. Use plstproduct_list to add sorting and page length selection to the product list without having to
buy a module other than this Tool Kit, which you already have. You will probably use this function in conjunction with
the plstpages (pagination) token above. You will modify the original PLST page template.
<mvt:item name="toolkit" param="plstproduct_list|20|prod.asc|0" />
Note that the above has 4 parameters. The 1st calls the function. The second is the number of products per page to
show when the page initially loads. The customer can select to see more per page if you give them the drop down to
choose alternate numbers. The third parameter is the sort order that the products are in when the page first displays.
prod.asc is the default list order; the same that you see when in your admin. You can have a drop down to let the
customer sort differently, e.g. by best sellers in the store. The fourth parameter is the option to load custom product
field values for each product displayed. If the customer chooses to show All products in the store you might want to
have a conditional to turn off that flag or not allow the "All product" option. For example
<mvt:if expr="g.ProductsPerPage GT 200">
<mvt:item name="toolkit" param="plstproduct_list|10|prod.asc|0" />
<mvt:else>
<mvt:item name="toolkit" param="plstproduct_list|10|prod.asc|1" />
</mvt:if>
The example doc combines the page
numbering of plstpages with the sorting and page length selection of the plstproduct_list function. If
you setup a new store after May 1, 2010 you are probably using the CSSUI. Here is the
CSSUI example doc if that
is the case.
There may be times when you don't want a product to be found in the product list pages and only available by direct link.
Insert <!-- miva_nodisplay //--> anywhere in the description of the products and they will not show in the
product list pages. The text will also not display in the description because it is surrounded with html comment tags.
You can do this with the category and product list pages, and if you are using our Power Search module, the search
page.
An example of this module in use is at the
Tool Kit Demo page.
|
| |
Average Customer Rating
   
|
|
Number of Raters: 23
|
| |
Reviewer: Samuel in Lawrenceville, United States 05/29/2010
The "Swiss Army Knife" for Miva Merchant 5!
|
| |
Reviewer: mark in kentfield, United States 04/28/2010
A must-have module. This should be the VERY FIRST MODULE you buy. There are already so many things that this module does really well, and Bill keeps adding features to it.
Buying this one module has save me hundreds of dollars since it replaces so many other third-party modules. Miva should just buy the rights to this module and have it come standard with every installation of Miva Merchant.
|
| |
|
more reviews > >
|
|
Sign In to review this product
|
|
|