Miva Merchant: E-commerce Solutions to Grow Online
spacer gif

Chapter 4

Configuration Functions

Introduction

Functions described in this chapter are required by the module types listed in the following table, and are not required for Import, Export, Batch, or Wizard (Domain level) module types.

Module Type
Description
CURRENCY
Currency
FULFILLMENT
Fulfillment
LOG
Logging
PAYMENT
Payment Processing
SHIPPING
Shipping
STOREUTIL
Store Utility
SYSTEM
System Extension
TAX
Tax
UI
User Interface
STOREWIZARD
Wizard in Store

There are groups of Configuration functions: category, product, store, and domain. Each of these groups contain similar functions. This chapter describes the types of Configuration functions and the groups where they are found.

Required Configuration Functions

Refer to the following sections for all the functions every store module must contain:

In addition, the Store Configuration modules must contain the following function(s):

Tabs

This type of function returns a comma separated list of tab definitions. A tab definition contains the tab code, followed by a colon, followed by the text to be displayed for the tab. The tab code must be globally unique, so prefixing it with the module_code would be a good idea. The tab code must be a single alphabetic, uppercase text string (no spaces, dashes, etc.).

The tab code establishes the internal name that is used by Miva Merchant. This code must be used whenever this tab is referenced. The tab codes are used by those functions as the identifier for performing their functionality; i.e. content, validate, update and delete.

The tab text is the name of the tab as it is to appear on the screen. This text string can contain alpha, numeric, symbols, and spaces.

Content

When Miva Merchant passes a tab code to the module, the content function is responsible for returning the valid text for the tab. This includes: inputs for form fields, descriptive text, explanations of use, etc.

If the content is not to be displayed, the function must pass the name/value pairs in hidden input fields for any input fields used with content was displayed.

Validate

This type of function is used to validate all aspects of the data that was entered into the fields in the content function.

This can be as simple as checking to make sure the field is not null. It should include validation of the field content, data type, field length, etc.

This could be as complex as checking to determine whether the field contains a valid email address. This would require the parsing of the string to determine if it contains an @, and a valid dot definition (.com,.org,.gov, etc.).

Update

This type of function is responsible for updating all of the fields used in the content functions, even across multiple tasks, to the database.

As an example, if there are two tabs, each with two variables, here is a total of four variables that must be updated to the database. When the update is requested, the update module must perform the following:

Note: When naming the variables that are used within a module, use unique identifies that will not accidentally duplicate other global variables. A good rule is to use the module name as part of the global variables within the module.

Delete

This type of function must take the appropriate action when the category or product has been deleted by the user.

Category Functions

Category functions are used as a group to name the category tabs, define the text of those tabs, verify the tab data, update the tabs and delete a tab if necessary. If a module uses one category function, it must use all of them.

If a module does not use the category functions, these functions can be left blank. The Module_Category_Tabs function must return a null value and the other category functions must return a "1."

Module_Category_Tabs

PARAMETERS = "category_id"

Creates the list of category tabs for a store.

Module_Category_Content

PARAMETERS = "tab, load_fields, category_id"

Displays the screen content for the category tabs that were passed in the Module_Category_Tabs function.

Module_Category_Validate

Validates all fields in the Module_Category_Content function.

Module_Category_Update

PARAMETERS = "category_id"

Updates the values of the variables for the category and writes the new data to the database.

Module_Category_Delete

PARAMETERS = "category_id"

Deletes the named category from the database.

Module_Category_BatchEdit_Validate (4.1x)

Reads any or all of the standard category fields that are part of the batch list.

Module_Category_BatchEdit_Update (4.1x)

PARAMETERS = "id"

Updates the values of the variables for the category batch list.

Product Functions

Product functions name the product tabs, define the text of those tabs, verify the tab data for content, size, etc., update the tabs and delete a tab if necessary. If a module uses one product function, it must use all of them.

Note: If a module does not use the product functions, these functions can be left blank. The Module_Product_Tabs must return a null value and the other product functions must return a "1."

Module_Product_Tabs

PARAMETERS = "product_id"

This function defines the product tabs for a store.

Module_Product_Content

PARAMETERS = "tab, load_fields, product_id"

This function defines the screen content for the product tabs that were defined in the Module_Product_Tabs function.

Module_Product_Validate

Verifies the fields that must be checked for content, data type, field length, etc.

Module_Product_Update

PARAMETERS = "product_id"

Updates the product's information in the database.

Module_Product_Delete

PARAMETERS = "product_id"

Deletes a product from the database.

Module_Product_BatchEdit_Validate (4.1x)

Reads any or all of the standard product fields that are part of the batch list.

Module_Product_BatchEdit_Update (4.1x)

PARAMETERS = "id"

Updates the values of the variables for the product batch list.

Store Functions

Store functions name the store tabs, define the text of those tabs, verify the tab data for content, size, etc., update the tabs and delete a tab if necessary.

Module_Store_Tabs

Defines the tabs for the store.

Module_Store_Content

PARAMETERS = "tab, load_fields"

Defines and displays the text for the store's tabs.

Module_Store_Validate

Validates the store field values.

Module_Store_Update

Updates the store field values.

Affiliates Functions

Note: The Affiliates functions are not required for Import, Export, Batch, or Wizard (Domain level) module types.

Module_Affiliates_Tabs

Defines the tabs for Affiliates.

Module_Affiliates_Content

PARAMETERS = "tab, load_fields". Defines the screen content for tabs that were defined in the _Tabs function.

Module_Affiliates_Validate

Validates the field values in the Module_Affiliates_Content function.

Module_Affiliates_Update

Updates the field values to the database.

Module_Affiliate_Delete (4.00 only)

Deletes the named affiliate from the database.

Affiliate Functions (4.1x)

Note: The Affiliate functions are not required for Import, Export, Batch, or Wizard (Domain level) module types.

Module_Affiliate_Tabs (4.1x)

PARAMETERS = "affiliate_id"

Defines the tabs for Affiliate.

Module_Affiliate_Content (4.1x)

PARAMETERS = "tab, load_fields affiliate_id"

Defines and displays the text for the Affiliate tabs.

Module_Affiliate_Validate (4.1x)

Validates the field values in the Module_Affiliate_Content function.

Module_Affiliate_Update (4.1x)

PARAMETERS = "affiliate_id"

Updates the field values to the database.

Module_Affiliate_Delete (4.1x)

PARAMETERS = "affiliate_id"

Deletes the named affiliate from the database.

Module_Affiliate_BatchEdit_Validate (4.1x)

Reads any or all of the standard affiliate fields that are part of the batch list.

Module_Affiliate_BatchEdit_Update (4.1x)

PARAMETERS = "id"

Updates the values of the variables for the affiliate batch list.

Customer Functions (new in 4.14)

Module_Customer_Tabs (4.14)

PARAMETERS = "cust_id"

Defines the tabs for Customer

Module_Customer_Content (4.14)

PARAMETERS = "tab, load_fields, cust_id"

Defines and displays the text for the Customer tabs.

Module_Customer_Validate (4.14)

Validates the field values in the Module_Customer_Content function.

Module_Customer_Update (4.14)

PARAMETERS = "cust_id"

Updates the field values to the database.

Module_Customer_Delete (4.14)

PARAMETERS = "cust_id"

Deletes the named customer from the database.

Module_Customer_BatchEdit_Validate (new in 4.14)

Reads any or all of the standard customer fields that are part of the batch list.

Module_Customer_BatchEdit_Update (new in 4.14)

PARAMETERS = "cust_id"

Updates the values of the variables for the customer batch list.

Module_Customer_Validate_Runtime (4.14)

Validates the customer fields values in the store (runtime). (Called before customer data is updated.)

Module_Customer_Update_Runtime (4.14)

PARAMETERS = "cust_id"

Updates the fields values to the database, when modified in the store (runtime).