24/7 Support: 800.608.6482

Get Started

Developer Docs

Custom Field Reference Documentation

ver.9.0 and later

Custom Field Reference Documentation

Custom Fields Use

Custom Fields is a module that comes installed by default in the core software. In PR8U9, the custom fields module received a huge overhaul which now included many new features, and a new layout.

One of the key new features was allowing store morph code to call functions directly inside the module through the use of < mvt:item/> tags. The two main components are reading a custom field and writing to a custom field.

Read Function Parameters

Read_***( id/code, custom_field_code, [destination] )

Parameters

  1. Code/ID of the category/customer/order/product The parameter can either be a number, a string, or a variable. E.g. 1, '1', 'code', l.settings:product:code, g.Category_Code
  2. The custom fields to load. Expected values are ''(empty string), 'single_custom_field_code', 'comma_separated, list_of, custom_field, codes'
    • A blank string loads all custom fields for that category/customer/order/product in an array. E.g. returns the custom fields 'size', 'height', 'weight', etc... (see examples below)
    • A single custom field returns the custom field as the main member of the destination field (see examples below)
    • A comma separated list of custom fields returns each custom field as a member of the destination field (see examples below)
  3. [Optional] The destination where the custom field values will be saved. Must be a variable
    • Defaults to the item name. E.g. item name is customfields, so the structure is returned to l.settings:customfields (see examples below)
    • Can pass in either a local or global variable of your choice. E.g. l.settings:my_custom_fields, g.My_Custom_Fields, etc...

Write Functions Parameters

Write_***( id/code, custom_field, value )

Parameters

  1. Code/ID of the category/customer/order/product
    • The parameter can either be a number, a string, or a variable. E.g. 1, '1', 'code', l.settings:product:code, g.Category_Code
  2. The custom field code to write to
    • The parameter can either be a string or a variable. E.g. 'custom_field_code', g.Custom_Field_Code
  3. The value you want to set the custom field to
    • The parameter can either be a string or a variable. E.g. 'custom field value', g.Custom_Field_Value

Read Functions

Write Functions

Miscellaneous Functions

Examples

Note - Although it is completely viable to use hyphens when creating global variable names, it is not recommended if you will be using that global variable in a customfields tags. Take this snippet of code as an example:

The g.customer-comments is a valid global variable, however in that context, the custom fields function is going to try to evaluate it as an expression so it will interpret the dash as a subtraction sign:

g.customer - g.comments

This website uses cookies to identify visitors, track visitors to our website, store login session information and to remember your user preferences. By continuing to use this site you agree to our use of cookies. Learn More.

This website uses cookies. By continuing to use this site you agree to our use of cookies. Learn More.

Accept

Miva believes that all online businesses should have access to a scalable ecommerce platform that can meet their unique business requirements. Miva offers PCI compliant ecommerce, hosting, and custom website design and development solutions. Miva customers have processed over $100 billion in online sales since 1997.

Copyright © 2016 Miva, Inc - All Rights Reserved   Privacy Policy | Store Policy

Links
Contact Us
Receive Tips & Updates

Copyright © 2017 Miva, Inc - All Rights Reserved

Back To The Top