get_basket_promotions
Overview
This function finds current and upcoming active promotions.
Promotions are returned in order of start date, from earliest to latest.
Aurora Demo Example
- URL: http://www.aurorademo.co.uk/members/summary
- Template:
templates/example.com/members/summary.tpl.html
Accepted Parameters
Parameter | Values | Description | Required |
---|---|---|---|
display_members_content | Boolean or Null | Limits the returned promotions to those where display_members_content is enabled/disabled | No |
item | String | The name of the Smarty variable to assign the function result | Yes |
limit | Integer | The maximum number of promotions to return. Value must be between 1 and 100. | No |
Data Returned
An array of promotions is returned. Each promotion is an array with a number of fields describing the promotion.
The following is an example of a promotion returned by this function:
promotion_name => "Bardot dresses - Buy 1 Get 10% off an..."
start_date => "2023-01-01"
end_date => "2024-01-01"
promotion_type => "buy_x_get_y_for_z"
promotion_amount => "10.00"
promotion_amount_type => "percent"
require_login => false
coupon_required => false
product_listing_page => ""
product_details_page => ""
members_content => ""
display_members_content => true
Example template code
{get_basket_promotions item=promotions limit=10 display_members_content=true}
Errors
The following table describes the various errors this function could emit.
Error text | Description |
---|---|
Smarty::item is required | The item parameter must be specified so that the function result can be assigned to a Smarty variable. |
Smarty::item value cannot contain spaces | The item parameter must not contain spaces so that it is a valid Smarty variable name. |
Smarty::display_members_content must be a boolean or null | The display_members_content parameter value may be true , false , null or omitted entirely. |
Smarty::limit must be between 1 and 100 | The function can return between 1 and 100 promotions. The limit value must be between 1 and 100. |
Updated almost 2 years ago