Skip to content

Functions Overview#


In Miva Merchant, the Empressa engine powers the core functionalities of the platform, including parsing the Template Language and compiling it into the underlying Miva Script Language. Miva Empressa offers a comprehensive set of functions essential for diverse programming tasks, ranging from file manipulation to string operations. These functions can be seamlessly integrated into Miva Merchant templates to enhance functionality. The MivaScript.com website provides comprehensive documentation on the Miva Script programming language and Empressa’s built-in functions.

Common Functions#

gettoken#

This function splits a delimited list into individual tokens based on a specified delimiter. For instance, gettoken(g.list, ',', 1) retrieves the first token from the comma-separated list stored in the g.list variable.

<mvt:assign name="g.list" value="'apples,oranges,bananas,grapes'">
<mvt:assign name="g.first" value="gettoken(g.list, ',', 1)">

glosub#

Short for global substitution, glosub facilitates find-and-replace operations within strings. By providing the string to search, the target string to find, and the replacement string, this function enables efficient text manipulation.

<mvt:assign name="g.string" value="'Miva Merchant vs. 9 is the current version of Miva Merchant'">
<mvt:assign name="g.new_string" value="glosub(g.string, 'Miva Merchant', 'Miva')">

substring#

Used for extracting substrings from a larger string, substring requires the string itself along with the starting position and length of the desired substring. For example, substring(g.string, 14, len(g.string)) extracts a substring starting from the 14th character to the end of the string.

<mvt:assign name="g.substring" value="substring(g.string, 14, len(g.string))">

Summary#

By harnessing the power of Miva Empressa’s built-in functions, merchants can enrich their storefronts with dynamic and versatile functionalities. With over 100 native functions available, experimentation and exploration are encouraged to unlock the full potential of the Miva Merchant Template Language. For comprehensive documentation and further insights, refer to MivaScript.com.