Skip to content

mvt:do#


Description#

Provides access to call native MivaScript functions in compiled .mvc files. This allows access to all built in Miva functions that makeup the core software. Available on any page, no item assignment required.

Requirements#

5.22 Engine or Higher

Parameters#

Parameters Description
file This is the path to the compiled MivaScript file (.mvc) relative to the mm5 directory. It can be a string (wrapped in single quotes) or more commonly a global variable to one of Miva’s built on libraries. See below for available libraries.
name This is a variable (l. or g. ) where any return value from the function called will be saved
value This is the specific function to be executed along with any parameters it accepts

Miva Library Variables#

Variable LSK Path
g.module_library_billing_db /mm5/5.00/lib/mbs.mvc
g.module_library_utilities /mm5/5.00/lib/util.mvc
g.module_library_crypto /mm5/5.00/lib/crypto.mvc
g.module_library_db /mm5/5.00/lib/db.mvc
g.module_library_dbapi /mm5/5.00/lib/dbapi.mvc
g.module_library_native_dbapi /mm5/5.00/lib/dbapi_mysql.mvc

Syntax#

<mvt:do file="g.module_library_utilities" name="g.email_sent" value="SendEmail()" />

Example#

Send An Email#

<mvt:do file="g.module_library_utilities" name="g.email_sent" value="SendEmail(g.to_email,g.from_email,'',g.subject,'',g.message)" />

To find all the parameters and return values of the SendEmail function take a look in the Limited Source Kit here: \lib\util_public.mv

Validate Email Address Format#

<mvt:do file="g.module_library_utilities" name="g.email_sent" value="SendEmail(g.to_email,g.from_email,'',g.subject,'',g.message)" />
<mvt:do file="g.module_library_utilities" name="g.null" value="SetCookie(g.Output_Cookies, 'token', g.cookie_value , g.cookiedomain , g.expires, g.cookiepath, 0 )" />
<mvt:do file="g.module_library_utilities" name="g.null" value="OutputCookies( g.Output_Cookies )" />

Render Page to Screen#

<mvt:do name="l.result" file="g.Module_Feature_TUI_MGR" value="TemplateManager_Render_Page( 'ABUS' )" />

Load Product (by Code or Id)#

<mvt:do name="l.return" file="g.Module_Library_DB" value="Runtime_Product_Load_ID( product_id, l.product )" />
<mvt:do name="l.return" file="g.Module_Library_DB" value="Runtime_Product_Load_Code( 'product_code', l.product )" />

&mvt:product:code;

Note

The Runtime prefix to these functions make it so inventory is taken into account as well as things like active and price or availability groups. These functions also exist without the runtime prefix (Product_Load_Code and Product_Load_ID)

Currency Format#

<mvt:do name="l.result" file="g.Module_Root $ g.Store:currncy_mod:module" value="CurrencyModule_AddFormatting( g.Store:currncy_mod, 1.25 )" />

Add Customer Into Price Group#

<mvt:if expr="g.Basket:cust_id GT 0">
    <mvt:do name="l.return" file="g.Module_Feature_PGR_DB" value="PriceGroup_Load_Name( 'Test', l.pricegroup )" />

    <mvt:if expr="l.return EQ 1">
        <mvt:do name="l.exists" file="g.Module_Feature_PGR_DB" value="PriceGroupXCustomer_Load( l.pricegroup:id, g.Basket:cust_id, l.null )" />
        <mvt:do name="l.eof" file="g.Module_Library_DB" value="Error_Is_EOF()" />

        <mvt:if expr="NOT l.exists AND ( l.eof )">
            <mvt:do name="l.insert" file="g.Module_Feature_PGR_DB" value="PriceGroupXCustomer_Insert( l.pricegroup:id, g.Basket:cust_id )" />

            Customer added to price group:
            <mvt:if expr="l.insert">
                Success
            <mvt:else>
                Failed
            </mvt:if>
        </mvt:if>
    </mvt:if>
</mvt:if>