AudienceView Connect

av.order - Utility Functions

av.order.productExists(product_type,product_name)

productExists is a utility function that searches the order for the product supplied and returns true if there is a match and false if there is no match. The function accepts the following parameters:

Parameter

Type

Description

product_type

string

The type of product being search for, allowed values are:
admission
bundle
miscellaneous_item
gift
stored_value

product_name

string or regex

The name of the product being searched for, will attempt to find a match on:
product name
product description
product short description
Supports regex pattern matching

One of either of the parameters are required to find a match. If neither one of them are supplied the function returns true if there are at least one product in the order.

Example Usage:

function call

 

productExists('admission','Wizard of Oz')

returns true if there is an admission type product on the order where the performance name, short description or description is an exact match of "Wizard Of Oz" - case sensitive

productExists('','Wizard of Oz')

returns true for any product type on the order where the product name, short description or description is an exact match of "Wizard Of Oz" - case sensitive

productExists('',/oz/i)

returns true for any product type on the order where the product name, short description or description contains 'oz' - case insensitive


top

av.order.productCount(product_type,product_name)

productCount is a utility function that search the order for the product supplied and return the count of how many times that product exists on the order. The function accepts the following parameters:

Parameter

Type

Description

product_type

string

The type of product being search for, allowed values are:
admission
bundle
miscellaneous_item
gift
stored_value

product_name

string or regex

The name of the product being searched for, will attempt to find a match on:
product name
product description
product short description
Supports regex pattern matching

One of either of the parameters are required to find a match. If neither of them are supplied the function returns the count of all products in the order.

Example Usage:

function call

 

productCount('admission','Wizard of Oz')

returns the count of admission if there is an admission type product on the order where the performance name, short description or description is an exact match of "Wizard Of Oz" - case sensitive

productCount('','Wizard of Oz')

returns the count of any product type on the order where the product name, short description or description is an exact match of "Wizard Of Oz" - case sensitive

productCount('',/oz/i)

returns the count for any product type on the order where the product name, short description or description contains 'oz' - case insensitive


top

av.order.productValue(product_type,product_name)

productValue is a utility function that search the order for the product supplied and returns the value of that product on the order. The function accepts the following parameters:

Parameter

Type

Description

product_type

string

The type of product being search for, allowed values are:
admission
bundle
miscellaneous_item
gift
stored_value

product_name

string or regex

The name of the product being searched for, will attempt to find a match on:
product name
product description
product short description
Supports regex pattern matching

One of either of the parameters are required to find a match. If neither of them are supplied the function returns the total value of all products in the order.

Example Usage:

function call

 

productValue('admission','Wizard of Oz')

returns the values of admissions if there is an admission type product on the order where the performance name, short description or description is an exact match of "Wizard Of Oz" - case sensitive

productValue('','Wizard of Oz')

returns the value of any product type on the order where the product name, short description or description is an exact match of "Wizard Of Oz" - case sensitive

productValue('',/oz/i)

returns the value for any product type on the order where the product name, short description or description contains 'oz' - case insensitive