Back

Miva Merchant: A Store Morph Technology Mini-Primer

Read on to learn more...

By Miva | November 10, 2008
Miva logo banner

Share

  

Want to read this blog offline?

No worries, download the PDF version now and enjoy your reading later...

Download PDF

Author: Tiny Queen Designs
Tiny Queen Designs – Ecommerce and Web Site Design

When Miva Merchant released MM5, they revolutionized the way the software worked “out of the box” and opened a whole new world of customization to ecommerce store owners. Using Store Morph Technology (SMT), store owners could completely and…well, I was going to say easily customize their stores to suit their needs, but the truth is that at first glance, SMT isn’t in fact all that easy.

One of the common complaints from new developers of MM sites, is the lack of documentation about SMT and how it works. The new owners of Miva Merchant are working hard to remedy the documentation void, but in the meantime, here’s a mini primer on SMT and some examples of the things you can do with it.

You’ll see SMT in MM’s page templates in a variety of different forms.

Variables

There are two types of variables in SMT: local variables, specific to the page you’re on, and global variables, which are available sitewide. The best way to find out what variables are available on a given page is to download the free Store Helper Module from Latu.net.

Variables are displayed on MM pages in a variety of ways. Note that variables always begin with an ampersand (&) and end with a semicolon (;).

[sourcecode language=‘html’]
&mvt:product:code;
&mvte:product:code;
&mvta:product:code;
[/sourcecode]

Variables that begin with &mvte are “entity encoded.” This means that any characters they contain will be displayed on the page in their exact form—they will not be interpreted by the browser.

Variables that begin with &mvta are “attribute encoded.” This means that any characters they contain will be converted to the correct format for use in a link.

Tags

SMT tags look similar to XHTML tags in that they are surrounded by

< >

, they include name / value pairs, with the values surrounded by double quotes, and all SMT tags must be closed, either by using a trailing slash, or with a separate closing tag.

Items

SMT tags may call in specific page items. These tags start with mvt:item, and use name=“xyz” to identify which page item is being called. They may also include parameters that more specifically identify the content to be called in. They are frequently self closing, but may have a separate closing tag depending on their form.

[sourcecode language=‘html’]

Some content here

[/sourcecode]

Loops and arrays

SMT tags may be used to loop through an array, and display specific data associated with that array. Common uses for these tags include such things as displaying the products in a category or search result, listing all of the products in the basket, or listing available shipping methods. All loops must be closed with a separate closing tag after you’ve worked with the content you’re pulling from the array.

[sourcecode language=‘html’]

Some stuff about each of the items in this array

[/sourcecode]

Conditionals

Finally, SMT tags may be used to create conditionals. This is far and away one of the most useful aspects of SMT, and is the building block of the store owner’s ability to customize his or her store (at least in my opinion!). Writing conditionals is probably worthy of a post all its own, but here are some basics.

All conditionals start with mvt:if and contain an expression to test for. A very basic conditional might look like this. This conditional checks to see if the product code is equal to the string 12345, and if it is, displays some text. Note that the string is enclosed in single quotes.

[sourcecode language=‘html’]

Display some text.

[/sourcecode]

Conditionals can also be set up to do one thing if the condition is true, and another thing if it is false.

[sourcecode language=‘html’]

Display some text.

Display some other text.

[/sourcecode]

Or even…

[sourcecode language=‘html’]

Display some text.

Display some other text.

Display yet some other text.

[/sourcecode]

Expressions can be combined to create extremely specific situations to test against. For instance, if you want to display some text only if the product code is 12345 and the customer is logged in, you would write your conditional something like this:

[sourcecode language=‘html’]

Display some text

[/sourcecode]

You can also easily test for a match in a single string or a series of strings, by using CIN or IN. CIN is case insensitive; IN is case sensitive. The strings to test against are enclosed in single quotes, and if there is more than one, they are separated by commas. The conditional below will return true if the product code is 12345 or 45678 or 67890.

[sourcecode language=‘html’]

Display some text.

[/sourcecode]

Note that the conditional above will also return true if the product code is 1234567, 012345, or 98712356789. It checks merely to see if the content of the first variable is included in the second. If you need to look for an exact match, you would be better to use a conditional like the following.

[sourcecode language=‘html’]

Display some text.

[/sourcecode]

Once you get the hang of them, you’ll wonder how you ever did without the power of conditionals to control your shopper’s experience on your site. Below are some of the most common conditional operators, along with what they do.

Operator Function
NOT Returns true if the condition does not match the variable
ISNULL Returns true if the variable is empty
AND Returns true if both conditions are true
OR Returns true if any of the conditions is true
EQ Returns true if the variable matches the string
NE Returns true if the variable does not match the string
GT Returns true if the variable is greater than the string
LT Returns true if the variable is less than the string
GE Returns true if the variable is greater than or equal to the string
LE Returns true if the variable is less than or equal to the string
IN Returns the first position of string_a in string_b. Case sensitive
CIN Returns the first position of string_a in string_b. Case insensitive

 

Comments

Finally, one of the most useful, and underused in my opinion, features of SMT is the comment feature. By carefully commenting your work, you make it so much easier on yourself or another developer when it comes time to try to make updates or changes to existing customizations. SMT comments take the following form. They are not parsed by the server, and won’t appear in your html source code.

[sourcecode language=‘html’]

Here is an explanation of what this section of code is going to do.

[/sourcecode]

Back to top

Author's Bio

Miva

Miva offers a flexible and adaptable ecommerce platform that evolves with businesses and allows them to drive sales, maximize average order value, cut overhead costs, and increase revenue. Miva has been helping businesses realize their ecommerce potential for over 20 years and empowering retail, wholesale, and direct-to-consumer sellers across all industries to transform their business through ecommerce.

More Posts Like This

Stay in the Loop

Sign up to receive the latest in ecommerce news, articles, whitepapers, and more.

OR CALL 800.608.MIVA

  • Facebook icon
  • Twitter icon
  • Instagram icon
  • LinkedIn icon