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

Database Functions


Introduction

The database functions, found in /lib/db.mv and in /features/xxx/yyy_db.mv (where xxx is the product version and yyy is the three letter alpha code of the feature), allow you to perform common tasks such as finding records, reading and writing data. For more information about the structure of the database files, see Miva Merchant Database Reference Guide on the Miva Corporation Developer Resources web page, at http://www.miva.com/support/docs/api.

The standard practice for each function group, is to first open the database and all its indexes, and filter deleted records. These functions begin with _DB_Store_Open_X or _X_DB_Store_Open, where X is the name or partial name of the associated database.

Administration Functions

The administration functions work with AdminSessions. These functions are in /lib/db.mv.

AdminSessions

AdminSession_Delete

PARAMETERS = "session_id"

Deletes the administration session defined by session_id.

AdminSession_Find_Session

PARAMETERS = "session_id"

Finds the administration session defined by session_id.

AdminSession_Insert

PARAMETERS = "session_id, user_id, lastupdate"

Creates an administration session and saves it to the database.

AdminSession_Update

PARAMETERS = "session_id, user_id, lastupdate"

Updates an administration session.

Affiliate

The Affiliate functions work with Affiliates, AffiliateEarnings, AffiliatePayouts, AffiliateEmail, AffiliateManage, AffiliateOptions, and AffiliateSession as listed below. Functions are in: \features\aff\aff_db.mv

AFF_Create_Data_Files

Creates the Affiliate databases and index files.

Store_Create_A

Inserts StoreKey in Affiliates, AffiliateEarnings, and AffiliatePayouts, AffiliateEarningsVoid.

Store_Create_B

PARAMETERS = "email"

Creates the affiliates databases, associated index and memo files.

AFF_Store_Delete

PARAMETERS = "directory

Deletes the OrderOptions index file, Affiliates, AffiliateEarnings, AffiliatePayouts, AffiliateSession

AFF_Store_Pack

Packs each of the Affiliate databases.

AFF_Store_Close

Closes each of the Affiliate databases.

Affiliates

Affiliate_FindNext_AffiliateOrder

PARAMETERS = "login"

Finds the next record for id for corresponding login (code). INDEX: affil_i.mvx

Affiliate_FindPrev_AffiliateOrder

PARAMETERS = "login"

Finds the previous record for id for corresponding login (code). INDEX: affil_i.mvx

AffiliateLast_Payout_Update

PARAMETERS = "id, payout, payout_id, time"

Locates the record matching id, subtracts payout from balance, updates payout_id (lstpay_id), payout (lstpay_amt), time (lstpay_dt), and lstpay_by.

Affiliate_Update_Balance

PARAMETERS = "code, type, amt, by"

Checks if AffiliateOptions is active, locates record in Affiliates matching code, updates balance according to type and amt and updates by.

AffiliateVoid_Balance_Update

PARAMETERS = "id, void, old_void

Indexes on Affiliates id, if void is present, subtracts the AffiliateEarnings amount from Affiliates balance. If old_void is present, adds the AffiliateEarnings amount to Affiliates balance.

Affiliates_Delete

PARAMETERS = "code"

Removes the record containing the defined code.

Affiliates_Find_Code

PARAMETERS = "code"

Locates the record containing code.

Affiliates_Find_ID

PARAMETERS = "id"

Locates the record containing id.

Affiliates_Find_Session

PARAMETERS = "session_id"

Locates the record containing session_id.

Affiliates_FindFirst

PARAMETERS = (none)

Indexed on id, locates the first record (top row).

Affiliates_FindLast

PARAMETERS = (none)

Indexed on id, locates the last record (bottom row).

Affiliates_FindNext

PARAMETERS = (none)

Locates the next record.

Affiliates_FindNext_All

PARAMETERS = "offset, search"

Locates the next record after offset.

Affiliates_FindOffset_All

PARAMETERS = "offset, search"

Index on id, locates the records after offset, matching search.

Affiliates_Insert

PARAMETERS = "code, password, lpass, site_name, site_url, con_name, email, company, phone, fax, addr, city, state, zip, cntry, hits, percent, flat, status, session_id"

Writes a new record to Affiliates. Returns Affiliates id, if successful.

Affiliates_Update

PARAMETERS = "id, code, password, lpass, site_name, site_url, con_name, email, company, phone, fax, addr, city, state, zip, cntry, hits, percent, flat, status, status_by"

Locates the record matching id, and updates the record.

Affiliates_Update_ContactInfo

PARAMETERS = "id, code, lostemail, password, site_name, site_url, con_name, email, company, phone, fax, addr, city, state, zip, cntry"

Locates the record matching id, and updates the record.

Affiliates_Update_Session

PARAMETERS = "code, session_id"

Locates the record matching code, and updates the session_id.

AffiliateEarnings

Affiliate_Clean_Earnings

PARAMETERS = "id"

Indexes on aff_id, deletes the record matching id (aff_id).

AffiliateEarning_Find_AffiliateID

PARAMETERS = "id"

Indexes on aff_id, locates the record matching id (aff_id).

AffiliateEarning_FindNext_AffiliateID

PARAMETERS = "id"

Locates the next record matching id (aff_id).

AffiliateEarning_Find_PayoutID (4.0 only)

Note: 4.1x and above see AffiliateEarnings_Find_PayoutID

PARAMETERS = "id

Indexes by payout_id, locates the record containing id (payout_id).

AffiliateEarning_FindNext_PayoutID (4.0 only)

Note: 4.1x and above see AffiliateEarnings_FindNext_PayoutID

PARAMETERS = "id"

Locates the next record matching id (payout_id).

AffiliateEarnings_Delete

PARAMETERS = "id"

Deletes the record matching id.

AffiliateEarnings_Find_ID

PARAMETERS = "id"

Locates the record matching id.

AffiliateEarnings_FindFirst

PARAMETERS = (none)

Locates the first (top) record.

AffiliateEarnings_FindFirst_Payout

PARAMETERS = "payout_id"

Locates the first record matching payout_id.

AffiliateEarnings_FindNext

PARAMETERS = (none)

Locate the next record.

AffiliateEarnings_FindNext_Payout

PARAMETERS = "payout_id"

Locates the next record matching payout_id.

AffiliateEarnings_FindNextOffset_Affiliate

PARAMETERS = "offset, affiliate_id"

Locates the next offset record for affiliate_id.

AffiliateEarnings_FindNextOffset_Payout

PARAMETERS = "offset, payout_id, search"

Locates the next offset record for payout_id.

AffiliateEarnings_FindOffset_Affiliate

PARAMETERS = "offset, affiliate_id

Locates the offset record for affiliate_id.

AffiliateEarnings_Find_PayoutID (4.1x and above)

PARAMETERS = "id

Indexes by payout_id, locates the record containing id (payout_id).

AffiliateEarnings_FindNext_PayoutID (4.1x and above)

PARAMETERS = "id"

Locates the next record matching id (payout_id).

AffiliateEarnings_FindOffset_Payout

PARAMETERS = "offset, payout_id, search

Locates the offset record for payout_id.

AffiliateEarnings_Insert

PARAMETERS = "aff_id, type, order_id, order_amt, percent, amount, payout_id, ip_addr"

Writes a new record to AffiliateEarnings. Returns AffiliateEarnings id, if successful.

AffiliateEarningsVoid_Insert

PARAMETERS = "id, type, void, reas, order_id, order_amt, earned, by, date, ajst_rsn, ajst_by">

Writes a new record to AffiliateEarnings, voiding earnings (reas = void_reasn, earned = amount, by = void_by).

AffiliateEarningsVoid_Update

PARAMETERS = "id, void, reas, by"

Locates record matching id, and updates data for void, reas (void_reasn), and by (void_by).

AffiliatePayout_VoidEarnings_Update

PARAMETERS = "void, voidres, by"

Updates void, reas (void_reasn), and by (void_by).

AffiliateEmail

AffiliateEmail_Load

Opens AffiliateEmail.

AffiliateEmail_Update

PARAMETERS = "from, cc, subject, header"

Updates AffiliateEmail data.

AffiliateManage

AffiliateManage_EmailLoad

Opens AffiliateManage.

AffiliateManage_Update

PARAMETERS = "activated, use_from, from, useto, to, use_cc, cc, subject, header"

AffiliateOptions

AffiliateOptions_Find

Opens AffiliateOptions.

AffiliateOptions_Update

PARAMETERS = "activated, signup, hits, percent, flat, terms, pay_thresh, link_image, link_text"

Updates AffiliateOptions data.

AffiliatePayouts

AffiliatePayout_Delete

PARAMETERS = "id"

Indexes on id, deletes the record identified by id.

AffiliatePayouts_Find_ID

PARAMETERS = "id

Locates the record matching id.

AffiliatePayouts_FindFirst

PARAMETERS = (none)

Finds the first (top) record.

AffiliatePayouts_FindOffset_All

PARAMETERS = "offset, search"

Indexes by date, locates the next offset payout records matching search.

AffiliatePayouts_FindOffset_Processed

PARAMETERS = "offset, search"

Locates the next offset payout records matching search that are processed.

AffiliatePayouts_FindOffset_Unprocessed

PARAMETERS = "offset, search"

Locates the offset payout records matching search that are not processed.

AffiliatePayouts_FindNext

PARAMETERS = (none)

Locates the next record.

AffiliatePayouts_FindNext_All

PARAMETERS = "offset, search"

Locates the next offset records.

AffiliatePayouts_FindNext_Processed

PARAMETERS = "offset, search"

Locate the next offset payout records matching search that are processed.

AffiliatePayouts_FindNext_Unprocessed

PARAMETERS = "offset, search"

Locates the next offset payout records matching search that are not processed.

AffiliatePayouts_Insert

PARAMETERS = "user"

Writes a new record to AffiliatePayouts. (user = pay_by).

AffiliatePayouts_Process

PARAMETERS = "id"

Locates record matching id, and updates processed field to 1, to indicate it has been processed.

AffiliatePayouts_Update

PARAMETERS = "id, count, amount"

Locates record matching id, and updates count and amount.

AffiliatePayoutsVoid_Update

PARAMETERS = "id, processed, proc_by, proc_time, void, voidres, date, by"

Locates record matching id, and updates proc_time (processed date/time), void, voidres (void reason), by (void by).

AffiliateSession

Affiliate_Create_Order

PARAMETERS = "session_id, total"

Finds the affiliate session_id, checks that status is approved. Returns the value of the function "Affiliate_Update_Balance."

Affiliate_Delete_Session

PARAMETERS = "affil_code"

Deletes Affiliates session for affil_code.

Affiliate_Find_SessionCode

PARAMETERS = "old_code, new_code

Updates the Affiliates code (password) from the old_code, to the new_code.

Affiliate_Insert_SessionID

PARAMETERS = "session_id

Adds a record to AffiliateSession.

Bask_Delete

PARAMETERS = "session_id"

Deletes the record matching session_id from AffiliateSession.

BasketList_Update_Affiliate

PARAMETERS = "session_id, affil_code"

Finds session_id and updates affil_code.

Attribute Functions

The attributes functions work with the data in the Attributes database. Functions are in: \lib\db.mv

Attributes

Attribute_Delete

PARAMETERS = "id"

Deletes the product attribute record defined by id.

Attribute_Find_Code

PARAMETERS = "product_id, code"

Finds the product attribute defined by product_id and code.

Attribute_Find_ID

PARAMETERS = "id"

Moves the record pointer to the record in the Attribute database as defined by id.

Attribute_FindFirst_Product

PARAMETERS = "product_id"

Finds the first record in the Attribute database that matches product_id.

Attribute_FindNext_Product

PARAMETERS = "product_id"

Finds the next record in the Attributes database.

Attribute_Insert

PARAMETERS = "product_id, code, type, template, prompt, price, cost, required, image"

Creates an attribute record in the Attributes database for the product defined in product_id and returns the attribute identification (attribute_id).

Attribute_Update

PARAMETERS = "id, default_id, code, type, template, prompt, price, cost, required, image"

Updates the data in the Attributes database for the attribute defined by id.

Attribute_Update_Order

PARAMETERS = "id, order"

Repositions the attribute in a display list based on the order parameter.

Product_Delete_Attributes (4.1x and above)

PARAMETERS = "id"

Deletes the record(s) matching the product id in the Attributes and Options databases. Includes function "AttributeTemplate_Decrement_ReferenceCount" when attribute `type' is template.

Attribute Template Functions

Theses functions work with AttributeTemplate, AttributeTemplateAttributes, and AttributeTemplateOptions. Functions are in: \features\att\att_db.mv

AttributeTemplate

Attribute_Find_TemplateID

PARAMETERS = "attemp_id"

In Attributes (attr.dbf), locates the record matching attemp_id.

Attribute_FindFirst_ProductTemplate

PARAMETERS = "product_id, template_id"

In Attributes (attr.dbf), locates the first record matching the product_id and template_id.

AttributeTemplate_Copy

PARAMETERS = "template_id, product_id, nodups"

Copies the record containing the defined template_id and product_id.

AttributeTemplate_Decrement_ReferenceCount

Reduces the count for refcount, identifying the new number of products to which this template is assigned.

AttributeTemplate_Delete

PARAMETERS = "code"

Deletes the record defined by code.

AttributeTemplate_Find_Code

PARAMETERS = "code"

Locates the record defined by code.

AttributeTemplate_FindFirst

Locates the first (top) record in the database.

AttributeTemplate_Find_ID

PARAMETERS = "id"

Locates the record defined by id.

AttributeTemplate_FindNext

Locates the next record in the database.

AttributeTemplate_Increment_ReferenceCount

Increases the count for refcount, identifying the new number of products to which this template is assigned.

AttributeTemplate_Update

PARAMETERS = "old_code, code, prompt"

Updates the data for code and prompt in the AttributeTemplates record matching the defined old_code.

AttributeTemplates_Insert

PARAMETERS = "code, prompt"

Adds a new record to AttributeTemplates, inserting code and prompt fields.

AttributeTemplateAttributes

AttributeTemplateAttribute_Delete

PARAMETERS = "id"

Removes the record, defined by id.

AttributeTemplateAttribute_Find_Code

PARAMETERS = "template_id, code"

Locates the record defined by code.

AttributeTemplateAttribute_FindFirst_AttributeTemplate

PARAMETERS = "template_id"

Finds the first attribute template matching template_id (attemp_id).

AttributeTemplateAttribute_FindNext_AttributeTemplate

PARAMETERS = "template_id

Finds the next attribute template matching template_id (attemp_id).

AttributeTemplateAttribute_Insert

PARAMETERS = "template_id, code, type, prompt, price, cost, required, image"

Adds a new record to AttributeTemplateAttributes and updates StoreKeys.

AttributeTemplateAttribute_Update

PARAMETERS = "id, default_id, code, type, prompt, price, cost, required, image

Updates the data in the record matching id.

AttributeTemplateAttribute_Update_Order

PARAMETERS = "id, order"

Updates order in the record matching id.

AttributeTemplates_FindFirst

Goes to the first (top) row of AttributeTemplates.

AttributeTemplates_FindFirst_Offset

PARAMETERS = "offset"

Locates the first offset record.

AttributeTemplates_FindNext

Finds the next row, offset by 1.

AttributeTemplates_FindNext_All

PARAMETERS = "offset, search

Finds the next record, offset.

AttributeTemplates_FindOffset_All

PARAMETERS = "offset, search"

Finds all records, offset.

AttributeTemplateOptions

AttributeTemplateOption_Delete

PARAMETERS = "id"

Removes the record matching the defined id.

AttributeTemplateOption_Find_Code

PARAMETERS = "attr_id, code"

Locates the record matching the attribute template attribute ID, attr_id, and the defined code.

AttributeTemplateOption_Find_ID

PARAMETERS = "id"

Locates the record defined by id.

AttributeTemplateOption_FindFirst_Attribute

PARAMETERS = "attr_id"

Locates the first record matching attr_id, Attribute Template Attribute ID (attmpat_id).

AttributeTemplateOption_FindNext_Attribute"

PARAMETERS = "attr_id

Locates the next record matching attr_id, Attribute Template Attribute ID (attmpat_id).

AttributeTemplateOption_Insert

PARAMETERS = "attmpat_id, code, prompt, price, cost, image"

Writes a new record to the database.

AttributeTemplateOption_Update

PARAMETERS = "id, code, prompt, price, cost, image

Updates the data for the record matching the defined id.

AttributeTemplateOption_Update_Order

PARAMETERS = "id, order"

Updates the order in the record matching id.

Availability Group Functions

The availability groups functions work with the data in AvailabilityGroups, AvailabilityGroupXCategory, AvailabilityGroupXCustomer, and AvailabilityGroupXProduct. Functions are in: \features\agr\agr_db.mv

AvailabilityGroup

AvailabilityGroup_Category_FindNext_Assigned

PARAMETERS = "agrp_id, offset, search"

Finds the next category record that is assigned to the availability group agrp_id.

AvailabilityGroup_Category_FindNext_Unassigned

PARAMETERS = "agrp_id, offset, search"

Finds the next category record that is not assigned to the availability group agrp_id.

AvailabilityGroup_Category_FindOffset_Assigned

PARAMETERS = "agrp_id, offset, search"

Finds the offset of the next category record that is assigned to the availability group agrp_id.

AvailabilityGroup_Category_FindOffset_Unassigned

PARAMETERS = "agrp_id, offset, search"

Finds the offset of the next category record that is not assigned to the availability group agrp_id.

AvailabilityGroup_Customer_FindNext_Assigned

PARAMETERS = "agrp_id, offset, search"

Finds the next customer record that is assigned to the availability group agrp_id.

AvailabilityGroup_Customer_FindNext_Unassigned

Finds the next customer record that is not assigned to the availability group agrp_id.

PARAMETERS = "agrp_id, offset, search"

AvailabilityGroup_Customer_FindOffset_Assigned

PARAMETERS = "agrp_id, offset, search"

Finds the offset of the next customer record that is assigned to the availability group agrp_id.

AvailabilityGroup_Customer_FindOffset_Unassigned

PARAMETERS = "agrp_id, offset, search"

Finds the offset of the next customer record that is not assigned to the availability group agrp_id.

AvailabilityGroup_Delete

PARAMETERS = "id"

Deletes the availability group, as define by the parameter id, from the availability group database.

AvailabilityGroup_Find_ID

PARAMETERS = "id"

Sets the database pointer to the availability group record defined by the parameter id.

AvailabilityGroup_Find_Name

PARAMETERS = "name"

Finds the availability group record defined by the parameter name.

AvailabilityGroup_FindFirst

PARAMETERS = (none)

Finds the first availability group in the database.

AvailabilityGroup_FindFirst_Offset

PARAMETERS = "offset"

Finds the offset defined by the parameter offset.

AvailabilityGroup_FindNext

PARAMETERS = (none)

Finds the next record in the availability group database.

AvailabilityGroup_Insert

PARAMETERS = "name"

Creates a new database record for an availability group as defined by name.

AvailabilityGroup_Product_FindNext_Assigned

PARAMETERS = "agrp_id, offset, search"

Finds the next product record that is assigned to the availability group agrp_id.

AvailabilityGroup_Product_FindNext_Unassigned

PARAMETERS = "agrp_id, offset, search"

Finds the next product record that is not assigned to the availability group agrp_id.

AvailabilityGroup_Product_FindOffset_Assigned

PARAMETERS = "agrp_id, offset, search"

Finds the offset of the next product record that is assigned to the availability group agrp_id.

AvailabilityGroup_Product_FindOffset_Unassigned

PARAMETERS = "agrp_id, offset, search"

Finds the offset of the next product record that is not assigned to the availability group agrp_id.

AvailabilityGroup_Update

PARAMETERS = "id, name"

Updates the name of the availability group in the database.

AvailabilityGroupXCategory

AvailabilityGroup_Category_Delete_AvailabilityGroupXCategory

PARAMETERS = "id"

Deletes the record from the AvailabilityGroupXCategory database matching the defined id for the category.

AvailabilityGroupXCategory_Delete

PARAMETERS = "agrp_id, cat_id"

Deletes the cat_id category from the agrp_id availability group database.

AvailabilityGroupXCategory_Find

PARAMETERS = "agrp_id, cat_id"

Finds the cat_id category in the agrp_id availability group.

AvailabilityGroupXCategory_FindFirst_Category

PARAMETERS = "agrp_id"

Finds the first category in the agrp_id availability group.

AvailabilityGroupXCategory_FindNext_Category

PARAMETERS = "agrp_id"

Finds the next category for the agrp_id availability group.

AvailabilityGroupXCategory_Insert

PARAMETERS = "cat_id, agrp_id"

Creates a record in the AvailabilityGroupXCategory database for cat_id and agrp_id.

AvailabilityGroupXCustomer

AvailabilityGroup_Customer_Find_ID_AvailabilityGroupXCategory_AND_AvailabilityGroupXCategory

PARAMETERS = "cust_id, id"

Locates the record matching the defined cust_id and id.

AvailabilityGroupXCustomer_Delete

PARAMETERS = "agrp_id, cust_id"

Deletes the record in the AvailabilityGroupXCategory database for cat_id and agrp_id.

AvailabilityGroupXCustomer_Find

PARAMETERS = "agrp_id, cust_id"

Finds cust_id and agrp_id in the availabilityGroupXCustomer database.

AvailabilityGroupXCustomer_FindFirst_AvailabilityGroup

PARAMETERS = "agrp_id"

Finds the first record of the agrp_id availability group in the availabilityGroupXCustomer database.

AvailabilityGroupXCustomer_FindNext_AvailabilityGroup

PARAMETERS = "agrp_id"

Finds the next agrp_id availability group in AvailabilityGroupXCustomer database.

AvailabilityGroupXCustomer_Insert

PARAMETERS = "agrp_id, cust_id"

Creates a record in the AvailabilityGroupXCustomer database for cust_id and agrp_id.

AvailabilityGroupXProduct

AvailabilityGroup_Customer_Find_ID_AvailabilityGroupXCategory_AND_AvailabilityGroupXProduct

PARAMETERS = "cust_id, id"

Locates the corresponding records in AvailabilityGroupXProduct and AvailabilityGroupXCustomer.

AvailabilityGroupXProduct_Delete

PARAMETERS = "agrp_id, product_id"

Deletes the agrp_id/product_id record from the AvailabilityGroupXProduct database.

AvailabilityGroupXProduct_Delete_Product

PARAMETERS = "id"

Deletes the record matching id.

AvailabilityGroupXProduct_Find

PARAMETERS = "agrp_id, product_id"

Sets the record pointer to agrp_id/product_id record of the AvailabilityGroupXProduct database.

AvailabilityGroupXProduct_Insert

PARAMETERS = "agrp_id, product_id"

Creates the agrp_id/product_id record in the availabilityGroupXProduct database.

Product_FindFirst_AvailabilityGroup

PARAMETERS = "agrp_id"

Locates the first product assigned to agrp_id in AvailabilityGroupXProduct.

Basket Functions

The basket functions work with the data in the Baskets, BasketCharges, BasketList, BasketLastUpdate, and BasketOptions databases and related files. These functions are in lib\db.mv.

Baskets

Basket_Delete

PARAMETERS = "session_id"

Deletes the basket for the session_id passed to it.

Basket_Delete_AllLines

PARAMETERS = "basket_id"

Deletes all basket items for the basket_id passed to it.

Basket_Delete_Line

PARAMETERS = "line_id"

Deletes a basket item based for the line_id passed to it.

Basket_Find_Line

PARAMETERS = "line_id"

Finds the line_id in a basket.

Basket_FindFirst_ID

PARAMETERS = "id"

Finds the first item in the basket (id) in the Baskets database.

Basket_FindNext_ID

PARAMETERS = "id"

Finds the first item in the basket (id) in the Baskets database.

Basket_Insert

PARAMETERS = "basket_id, product_id, code, name, price, weight, taxable, upsold, quantity"

Creates a record in the Baskets database for a basket and returns the basket line_id.

Basket_Quantity

PARAMETERS = "session_id, product_id"

Returns the quantity of product_id in session_id.

Basket_SubTotal (4.1x and above)

PARAMETERS = "session_id"

Returns the total of the products' prices, including options. (Does not includes tax or shipping.)

Basket_Total

PARAMETERS = "session_id"

Returns the total dollar value of the items in the basket attached to session_id.

Basket_TotalQuantity

PARAMETERS = "session_id"

Returns the total number of all items in the basket attached to session_id.

Basket_Update_Quantity

PARAMETERS = "line_id, quantity"

Updates the quantity of the basket item line_id with the amount quantity.

Basket_Weight

PARAMETERS = "session_id"

Returns the total weight of all items in the basket associated with session_id.

Store_DeleteBaskets

Deletes BasketOptions, Baskets, and BasketList.

BasketCharges

BasketCharge_DeleteAll_Module

PARAMETERS = "basket_id, module_id"

Deletes all charges in the basket defined by basket_id in module_id.

BasketCharge_FindFirst_Charge

PARAMETERS = "basket_id"

Finds the first charge in the basket defined by basket_id.

BasketCharge_FindFirst_Module

PARAMETERS = "basket_id, module_id"

Finds the first charge in the basket defined by basket_id in module_id.

BasketCharge_FindFirst_Type

PARAMETERS = "basket_id, type"

Finds the first item type in basket_id.

BasketCharge_FindNext_Charge

PARAMETERS = "basket_id"

Finds the next charge in the basket defined by basket_id.

BasketCharge_FindNext_Module

PARAMETERS = "basket_id, module_id"

Finds the next charge in the basket defined by basket_id in module_id.

BasketCharge_FindNext_Type

PARAMETERS = "basket_id, type"

Finds the next item type in basket_id.

BasketCharge_Insert

PARAMETERS = "basket_id, module_id, type, desc, amount, disp_amt, tax_exempt"

Creates a record for a charge to the basket.

BasketCharges_Delete_Type

PARAMETERS = "basket_id, type"

Deletes the item type in basket_id.

BasketLastUpdate

BasketLastUpdate_Update_LastUpdate

PARAMETERS = "session_id, lastupdate"

Updates lastupdate, time indicator for session_id.

BasketList

BasketList_FindFirst

PARAMETERS = (none)

Finds the first record in the Basketlist database.

BasketList_FindNext

PARAMETERS = (none)

Finds the next record in the Basketlist database.

BasketList_FindSession

PARAMETERS = "session_id"

Finds the session_id in the Basketlist database.

BasketList_Free_Order

PARAMETERS = "session_id"

Resets the values in session_id to zero and null.

BasketList_MakeDirty

PARAMETERS = "session_id"

Checks that basket contents remains the same throughout the checkout process for session_id.

BasketList_Insert

PARAMETERS = "session_id, lastupdate"

Creates a basket record for the session defined by session_id.

BasketList_Save_Order_Info

PARAMETERS = "session_id, ship_fname, ship_lname, ship_email, ship_comp, ship_phone, ship_fax, ship_addr, ship_city, ship_state, ship_zip, ship_cntry, bill_fname, bill_lname, bill_email, bill_comp, bill_phone, bill_fax, bill_addr, bill_city, bill_state, bill_zip, bill_cntry"

Saves shipping and billing data for the basket identified by session_id.

BasketList_Update_Customer

PARAMETERS = "session_id, cust_id"

Updates the customer identification (cust_id) for the session (session_id).

BasketList_Update_LastUpdate

PARAMETERS = "session_id, lastupdate"

Updates the lastupdate field of the basket (session_id).

BasketList_Update_Payment

PARAMETERS = "session_id, pay_id, pay_data"

Updates the pay information for the basket assigned to session_id.

BasketList_Update_Payment (4.14)

PARAMETERS = "session_id, pay_id, pay_data"

Updates the pay information for the basket assigned to session_id. Assigns BasketList.d.pay_data value of miva_array_serialize( l.pay_data).

BasketList_Update_PaymentSecure (new in 4.14)

PARAMETERS = "session_id, pay_secdat"

Updates the pay information for the basket assigned to session_id.

Checks if encryption is activated and secure data field has data, and updates BasketList accordingly.

BasketList_Update_Shipping

PARAMETERS = "session_id, shipping, ship_id, ship_data"

Updates the shipping information for the basket assigned to the session_id.

BasketList_Update_Tax

PARAMETERS = "session_id, tax"

Updates the sales tax amount for the basket assigned to the session_id.

BasketOptions

Opens BasketOptions table, database and associated index files.

BasketOption_FindFirst_Line

PARAMETERS = "line_id"

Finds line_id in the Baskets database.

BasketOption_FindNext_Line

PARAMETERS = "line_id"

Finds the next line in the Baskets database.

BasketOption_Insert

PARAMETERS = "line_id, attr_id, attr_code, option_id, opt_code, data, price"

Finds the first line (line_id) for a product in the BasketOptions database and writes a record containing the following parameters.

Batch Functions

Batches

The batch functions work with the data in the Batches database.

Batch_Create

PARAMETERS = "name"

Creates the name record in the Batches database.

Batch_Delete

PARAMETERS = "id"

Deletes the id batch from the Batches database.

Batch_Find_ID

PARAMETERS = "id"

Finds the id batch.

Batch_FindFirst

PARAMETERS = (none)

Finds the first line in the Batches database.

Batch_FindNext

PARAMETERS = "closed"

Finds the next line in the Batches database.

Category Functions

The category functions work with the data in the Categories and CategoryXProduct databases. These functions are located in lib/db.mv.

Categories

The following functions work the Categories table, database and associated index files.

Category_Delete

PARAMETERS = "id"

Deletes the id category from the Categories database.

Category_Find_Code

PARAMETERS = "code"

Finds the code category in the Categories database.

Category_Find_ID

PARAMETERS = "id"

Finds the id category record.

Category_FindFirst

PARAMETERS = (none)

Finds the first category in the Categories database.

Category_FindFirst_Offset

PARAMETERS = "offset"

Finds the offset record in the Categories database.

Category_FindOffset_Search

PARAMETERS = "offset, words"

Sets record pointer at the first record to match words beyond the record offset.

Category_FindFirst_Parent

PARAMETERS = "parent_id"

Finds the category defined as parent_id in the Categories database.

Category_FindID_Parent

PARAMETERS = "id"

Finds the category defined as id in the Categories database.

Category_FindLast

PARAMETERS = (none)

Indexed by Categories.d.order, finds the last (bottom) row.

Category_FindNext

PARAMETERS = (none)

Finds the next record in the Categories database.

Category_FindNext_All

PARAMETERS = "offset, search"

Finds the next record, increments the offset value by one and returns the new offset value, matching search.

Category_FindNext_CategoryOrder

PARAMETERS = "code"

Locates the next record matching code, and if found, assigns Primary Index as cat_ord.mvx.

Category_FindNext_Parent

PARAMETERS = "parent_id"

Finds the next record of parent_id.

Category_FindOffset_All

PARAMETERS = "offset, search"

Finds the offset record the Categories database. Search is the criteria entered by user.

Category_FindPrev_CategoryOrder

PARAMETERS = "code"

Locates the previous record matching code, and if found, assigns Primary Index as cat_ord.mvx.

Category_Insert

PARAMETERS = "parent_id, code, name, active"

Writes a new record to the Categories database.

Category_Product_FindNext_Assigned

PARAMETERS = "cat_id, offset, search"

Finds the next product assigned to cat_id.

Category_Product_FindNext_Unassigned

PARAMETERS = "cat_id, offset, search"

Finds the next product not assigned to cat_id.

Category_Product_FindOffset_Assigned

PARAMETERS = "cat_id, offset, search"

Finds the offset of the next product record that is assigned to cat_id.

Category_Product_FindOffset_Unassigned

PARAMETERS = "cat_id, offset, search"

Finds the offset of the next product record that is not assigned to cat_id.

Category_Sort

PARAMETERS = "sort_field, ascending"

Sorts the Categories database by sort_field and by order. "1" if ascending.

Category_Update

PARAMETERS = "id, parent_id, code, name, active"

Updates data fields in category record id.

Category_Update_Order

PARAMETERS = "id, order"

Updates the order of appearance of category id.

CategoryXProduct

The following functions work the CategoryXProduct database and associated files.

CategoryXProduct_Delete

PARAMETERS = "cat_id, product_id"

Deletes record matching cat_id and product_id from CategoryXProduct. (And, decreases the catcount in Products.)

CategoryXProduct_Find

PARAMETERS = "cat_id, product_id"

Locates record matching cat_id and product_id in CategoryXProduct. (Index = cxp_cprd.mvx.)

CategoryXProduct_Insert

PARAMETERS = "cat_id, product_id"

Write a new record to the CategoryXProduct to assign the product, product_id, to category, cat_id. And, increases the catcount in Products.

CategoryXProduct_Sort

PARAMETERS = "category_id, sort_field, ascending"

Sorts the category_id in the CategoryXProduct database. sort_field is the field to sort on. "1" if ascending. (Creates a temporary database, CxPSort and index, which is removed after sort.)

CategoryXProduct_Update_Order

PARAMETERS = "cat_id, product_id, order"

Updates the order (placement) of product, product_id within category, cat_id. Primary Index = cxp_cprd.mvx.

Product_FindFirst_Category

PARAMETERS = "cat_id"

Finds the first product within cat_id in CategoryXProduct.

Country Functions

The country functions work with the data in the Countries database. These functions are located in lib/db.mv

Countries

Country_Find_Alpha

PARAMETERS = "alpha"

Finds the country record (alpha) in the country database.

Country_FindFirst

PARAMETERS = (none)

Finds first record in Countries database.

Country_FindNext

PARAMETERS = (none)

Finds next record in Countries database.

Country_FindNext_All

PARAMETERS = "offset, search"

Finds the next Countries database record, increments the offset value by one and returns the new offset value

Country_FindOffset_All

PARAMETERS = "offset, search"

Finds the offset records in the Countries database.

Country_Insert

PARAMETERS = "name, alpha, numeric"

Creates record in the Countries database for name. Name is Country name; alpha is Alpha country code; numeric is Numeric country code.

Customer Functions

The customer functions work with the data in the Customers and CustomerEmail database and associated files.

Customers and Categories

These work with Customers and Categories databases and associated files, and conditionally with AvailabilityGroup functions. These functions are located in lib\db.mv.

Customer_Category_Find_Code

PARAMETERS = "cust_id, code"

Locates the record containing the active category's code, and returns the category id. If category belongs to an Availability Group, verifies it is enabled, locates the cust_id and code, and returns the category id.

Customer_Category_Find_ID

PARAMETERS = "cust_id, id"

Locates the record containing the active category's id in Categories. If category belongs to an Availability Group, verifies it is enabled, locates the cust_id and id in AvailabilityGroupXCustomer and in AvailabilityGroupXCategory. Returns 1 if successful.

Customer_Category_Find_Name

PARAMETERS = "cust_id, id"

Locates the records containing the active category id, and returns the category name. If category belongs to an Availability Group, verifies it is enabled, locates the cust_id and id, and returns the category name. Returns category relating AvailabilityGroupXCategory and AvailabilityGroupXCustomer.

Customer_Category_FindFirst_Parent

PARAMETERS = "cust_id, parent_id"

Locates the first record containing the active parent category, parent_id, in Categories. If category belongs to an Availability Group, verifies it is enabled, locates cust_id in AvailabilityGroupXCustomer and AvailabilityGroupXCategory. Returns 1 if successful.

Customer_Category_FindID_Parent

PARAMETERS = "cust_id, id"

Locates the record containing the active category id, in Categories. If category belongs to an Availability Group, verifies it is enabled, locates cust_id and id in AvailabilityGroupXCustomer and AvailabilityGroupXCategory. Returns 1 if successful.

Customer_Category_FindNext_Parent

PARAMETERS = "cust_id, parent_id"

Locates the record containing the active parent category, parent_id, in Categories. If category belongs to an Availability Group, verifies it is enabled, locates cust_id in AvailabilityGroupXCustomer and AvailabilityGroupXCategory. Returns 1 if successful.

Customer_Category_FindFirst_Product

PARAMETERS = "cust_id, product_id"

Locates the first product_id and associated category in CategoryXProduct, and locates cust_id in AvailabilityGroupXCustomer and the associated `cat_id' and `agrp_id' in AvailabilityGroupXCategory.

Customer_Category_FindNext_Product

PARAMETERS = "cust_id, product_id"

Locates the next product_id and associated category in CategoryXProduct.

Finds the next category for customer (cust_id) that has the specific product (product_id) associated with it in Availability Group.

Customers

These work with Customers database and associated files, and are located in /features/cus/cus_db.mv.

Customer_Delete

PARAMETERS = "id"

Deletes record matching id from the Customers database.

Customer_Find_ID

PARAMETERS = "id"

Locates the record matching id in the Customers database.

Customer_Find_Login

PARAMETERS = "login"

Locates the record in the Customers database that contains customer login name.

Customer_FindFirst

PARAMETERS = (none)

Locates the first customer in the Customers database.

Customer_FindFirst_Offset

PARAMETERS = "offset"

Opens the Customer database and skips to the offset record.

Customer_FindLast

PARAMETERS = (none)

Indexed on id, goes to bottom row.

Customer_FindNext

PARAMETERS = (none)

Locates the next record after offset in the Customers database.

Customer_FindNext_All

PARAMETERS = "offset, search"

Locates the next record after offset in the Customer database.

Customer_FindNext_CustomerID

PARAMETERS = "login"

Skips to next row after Customer_Find_ID.

Customer_FindNext_Words

PARAMETERS = "words"

Locates the next record in the Customers database.

Customer_FindPrev_CustomerID

PARAMETERS = "login"

Skips to previous row after Customer_Find_ID.

Customer_FindOffset_Words

PARAMETERS = "words, offset"

Finds the offset records defined by the search criteria (words).

Customer_FindOffset_All

PARAMETERS = "offset, search"

Locates the record defined by search after the offset in the Customers database.

Customer_Insert

PARAMETERS = "login, pw_email, password, ship_fname, ship_lname, ship_email, ship_comp, ship_phone, ship_fax, ship_addr, ship_city, ship_state, ship_zip, ship_cntry, bill_fname, bill_lname, bill_email, bill_comp, bill_phone, bill_fax, bill_addr, bill_city, bill_state, bill_zip, bill_cntry"

Writes a new customer record in the Customers database.

Customer_Update

PARAMETERS = "id, login, pw_email, password, ship_fname, ship_lname, ship_email, ship_comp, ship_phone, ship_fax, ship_addr, ship_city, ship_state, ship_zip, ship_cntry, bill_fname, bill_lname, bill_email, bill_comp, bill_phone, bill_fax, bill_addr, bill_city, bill_state, bill_zip, bill_cntry"

Updates the data in a customer record.

Customers and Products

Customer_Product_Find_Code

PARAMETERS = "cust_id, code"

Determines if the product (code) and customer (cust_id) are part of the same availability group.

Customer_Product_Find_ID

PARAMETERS = "cust_id, id"

Determines if the product (