NOTES: Add to the Native Miva Notes Table

Miva Knowledge Base
Want to start an online store? We work with you from start to finish, from commerce platform to design to SEO.
Experience counts, and we have a lot.
Important Notice: This information is for internal reference only. Use at your own risk.

NOTES: Add to the Native Miva Notes Table

Scot Ranney • September 24, 2025


The miva merchant notes table can be manipulated through smt. Adding records is probably the only reasonable use in smt.

General Notes: Do not read at your own risk.

Admin User ID: Track admin users by using the user_id variable. user_id is g.user:id which is the current admin user id. This is only available from admin.mvc and will not work in merchant.mvc screens.

Filling in the variables: Depending on what you are doing order id and customer id and perhaps other variables will be specific to the report, batch, email, and other templates you are working in.

Required Variables Info: It appears that order_id is the only required variable.

Email templates: If you don't want the  note to be written from an email template during a normal merchant.mvc screen sale wrap it in: <mvt:if expr="g.user:id GT 0">...</mvt:if>

Code Example:

Fill out the variables and then write the note.

Tip: Try using mvt:capture for the notetext variable unless it's super simple text.

<mvt:comment>
#
# write to the native miva merchant notes system
#
</mvt:comment>

<mvt:assign name="l.note:cust_id" value="''" />
<mvt:assign name="l.note:account_id" value="''" />
<mvt:assign name="l.note:order_id" value="g.order:id" />
<mvt:assign name="l.note:user_id" value="g.user:id" />
<mvt:assign name="l.note:notetext" value="'This is some note text. Page code is: ' $ l.settings:page:code $ ', time t: ' $ s.dyn_time_t" />
<mvt:assign name="l.note:dtstamp" value="s.dyn_time_t" />
<mvt:assign name="l.note:cust_login" value="''" />
<mvt:assign name="l.note:business_title" value="''" />

<mvt:do file="g.Module_Library_DB" name="l.ok" value="Note_Insert_LowLevel( l.note )" />

https://www.scotsscripts.com/mvblog/notes-add-to-the-native-miva-notes-table.html

mvkb_notes mvkb_smt