User Guide | Reward Point and Voucher Helper Data

Helper functions are used to provide value formatting and calculation functionality, or to return data from the carts database tables.

The functions can act independently of data within the cart session, using database table ids or custom data directly submitted to the function to return values, rather than for example requiring the row id of an item in the cart.

This independence from data within the cart session means the functions can be used on pages across a site that do not display cart data, or even on items that have not been added to the cart.

Reward Point and Voucher Helper Functions

Reward Function Index | Reward Config | Set Reward Session Data | Reward Admin Data
Calculate Reward Points

calculate_reward_points()

Help with Helper Functions

Show / Hide Help

Name: The name of the function (method).

Data Type: The data type that is expected by the function.

  • bool : Requires a boolean value of 'TRUE' or 'FALSE'.
  • string : Requires a textual value.
  • int : Requires a numeric value. It does not matter whether the value is an integer, float, decimal etc.
  • array : Requires an array.

Required: Defines whether the parameter requires a value to be submitted.

Default: Defines the default parameter value that is used if no other value is submitted.

calculate_reward_points()

Returns the number of reward points that would be earnt from a submitted currency value.


Library and Requirements

Available via the lite, standard and admin libraries.

Does not require any database tables to be enabled.

Function Parameters
calculate_reward_points(value) Help
Name Data Type Required Default Description
value int Yes 0 Sets the monetary value to calculate the number of reward points for.
Return Values

Failure:n/a

Success:int

Examples
Note: The returned example values below are displaying live data from the current cart session data.
calculate_reward_points(100) How many reward points would be earnt from an item costing £100.00? 1000