User Guide | Getting Discount Session Data

When the flexi cart library is first loaded, an array is automatically created that is setup to match the carts default settings, this data is then stored in the browsers session. All items and settings that are then later added and altered within the cart are updated to the carts session data.

The data within the carts session can then be accessed and in many cases, formatted and customised using the large range of functions that are available from the lite and standard libraries.

Get Discount Session Data

Discount Function Index | Discount Config | Get Discount Helper Data | Set Discount Session Data | Discount Admin Data

Help with Session Data 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.

discount_codes()

Returns an array of discount codes that have been applied to the cart, regardless of whether they are currently active or not.


Library and Requirements

Available via the lite, standard and admin libraries.

Does not require any database tables to be enabled.

Return Values

Failure:FALSE

Success:array

Examples
Note: The returned example values below are displaying live data from the current cart session data.
discount_codes() Display any set discount codes as an array. Show / Hide Array
Array
(
)

excluded_discounts()

Returns the ids on all discounts that have been manually excluded from being auto applied by the cart.

Typically, auto applied discounts are discounts that are automatically applied by the cart when the discounts required quantity and value of items has been added to the cart.


Library and Requirements

Available via the lite, standard and admin libraries.

Does not require any database tables to be enabled.

Return Values

Failure:n/a

Success:array

Example
$this->flexi_cart->excluded_discounts();

discount_status()

Returns whether a discount has been applied to the cart.


Library and Requirements

Available via the lite, standard and admin libraries.

Does not require any database tables to be enabled.

Return Values

Not Applied:FALSE

Applied:TRUE

Examples
Note: The returned example values below are displaying live data from the current cart session data.
discount_status() Are any item or summary discounts applied to the cart? bool(false)

item_summary_discount_status()

Returns whether any item discounts have been applied to the cart.


Library and Requirements

Available via the lite, standard and admin libraries.

Does not require any database tables to be enabled.

Return Values

Not Applied:FALSE

Applied:TRUE

Examples
Note: The returned example values below are displaying live data from the current cart session data.
item_summary_discount_status() Are any item discounts applied to the cart? bool(false)

item_summary_discount_data()

Returns an array of discount values and descriptions for all item rows.


Library and Requirements

Available via the lite, standard and admin libraries.

Does not require any database tables to be enabled.

Function Parameters
item_summary_discount_data(format, internal_value) Help
Name Data Type Required Default Description
format bool No TRUE Define whether to format the returned monetary values as currencies.
internal_value bool No FALSE Defines whether to return the monetary values using the carts internal currency instead of the users current currency.
Return Values

Failure:array (Empty)

Success:array

Examples
Note: The returned example values below are displaying live data from the current cart session data.
item_summary_discount_data(TRUE, FALSE) Display the current discount value and description for any discounts set on any cart items. Show / Hide Array
Array
(
)
item_summary_discount_data(TRUE, TRUE) Display the internal discount value and description for any discounts set on any cart items. Show / Hide Array
Array
(
)

item_summary_discount_description()

Returns item summary discount values and descriptions formatted as a string.


Library and Requirements

Available via the lite, standard and admin libraries.

Does not require any database tables to be enabled.

Function Parameters
item_summary_discount_description(value_prefix, prefix_delimiter, suffix_delimiter, internal_value) Help
Name Data Type Required Default Description
value_prefix string No FALSE Defines a string of characters to separate the discount description and value.
If no 'value_prefix' is set, the discount value will be omitted from the returned description.
prefix_delimiter string No FALSE Defines a string of characters to prefix to the start of each discount description.
suffix_delimiter string No <br/> Defines a string of characters to suffix to the end of each discount description.
internal_value bool No FALSE Defines whether to return the monetary values using the carts internal currency instead of the users current currency.
Return Values

Failure:FALSE

Success:string

Examples
Note: The returned example values below are displaying live data from the current cart session data.
item_summary_discount_description(FALSE, FALSE, '<br/>', FALSE) Format the discount description on the item summary total with a line break after each row and the discount value omitted. bool(false)
item_summary_discount_description('@&nbsp;', '<p>', '</p>', FALSE) Format the discount description on the item summary total with a prefixed space and '@' sign between the description and currentvalue, and with each row wrapped in a html <p> tag. bool(false)
item_summary_discount_description('@&nbsp;', '<p>', '</p>', TRUE) Format the discount description on the item summary total with a prefixed space and '@' sign between the description and internalvalue, and with each row wrapped in a html <p> tag. bool(false)

summary_discount_status()

Returns whether any summary discounts have been applied to the cart.


Library and Requirements

Available via the lite, standard and admin libraries.

Does not require any database tables to be enabled.

Return Values

Not Applied:FALSE

Applied:TRUE

Examples
Note: The returned example values below are displaying live data from the current cart session data.
summary_discount_status() Are any summary discounts applied to the cart? bool(false)

summary_discount_data()

Returns an array of discount values and descriptions for either a particular summary column ('$summary_column' must be set), or all summary columns.


Library and Requirements

Available via the lite, standard and admin libraries.

Does not require any database tables to be enabled.

Function Parameters
summary_discount_data(summary_column, format, internal_value) Help
Name Data Type Required Default Description
summary_column string No FALSE Defines the summary column to return discount data for.
Valid values are 'item_summary_total', 'shipping_total' and 'total'.
If no value is set, discount data will be returned for all summary columns.
format bool No TRUE Define whether to format the returned monetary values as currencies.
internal_value bool No FALSE Defines whether to return the monetary values using the carts internal currency instead of the users current currency.
Return Values

Failure:array (Empty)

Success:array

Examples
Note: The returned example values below are displaying live data from the current cart session data.
summary_discount_data(FALSE, TRUE, FALSE) Display the current discount value and description for any discounts set on any summary column. Show / Hide Array
Array
(
)
summary_discount_data(FALSE, TRUE, TRUE) Display the internal discount value and description for any discounts set on any summary column. Show / Hide Array
Array
(
)
summary_discount_data('total', TRUE, FALSE) Display the current discount value and description for any discount set on the 'total' summary column. Show / Hide Array
Array
(
)

summary_discount_description()

Returns summary discount values and descriptions formatted as a string.


Library and Requirements

Available via the lite, standard and admin libraries.

Does not require any database tables to be enabled.

Function Parameters
summary_discount_description(value_prefix, prefix_delimiter, suffix_delimiter, internal_value) Help
Name Data Type Required Default Description
value_prefix string No FALSE Defines a string of characters to separate the discount description and value.
If no 'value_prefix' is set, the discount value will be omitted from the returned description.
prefix_delimiter string No FALSE Defines a string of characters to prefix to the start of each discount description.
suffix_delimiter string No <br/> Defines a string of characters to suffix to the end of each discount description.
internal_value bool No FALSE Defines whether to return the monetary values using the carts internal currency instead of the users current currency.
Return Values

Failure:FALSE

Success:string

Examples
Note: The returned example values below are displaying live data from the current cart session data.
summary_discount_description(FALSE, FALSE, '<br/>', FALSE) Format the discount description on the summary total with a line break after each row and the discount value omitted. bool(false)
summary_discount_description('@&nbsp;', '<p>', '</p>', FALSE) Format the discount description on the summary total with a prefixed space and '@' sign between the description and current value, and with each row wrapped in a html <p> tag. bool(false)
summary_discount_description('@&nbsp;', '<p>', '</p>', TRUE) Format the discount description on the summary total with a prefixed space and '@' sign between the description and internal value, and with each row wrapped in a html <p> tag. bool(false)