Sale
Sale loop provides an access to sale operations defined on your shop.
{loop type="sale" name="the-loop-name" [argument="value"], [...]}
Arguments
| Argument | Description | Default | Example |
|---|---|---|---|
| active | A boolean value, to get only active (1) or inactive sales (0) or both (*) | 1 | active="1" |
| currency | A currency id, to get the price offset defined for this currency | The current shop currency | currency="1" |
| exclude | A single or a list of sale ids to excluded from results. | exclude="2", exclude="1,4,7" | |
| id | A single or a list of sale ids. | id="2", id="1,4,7" | |
| order | A list of values see sorting possible values | start-date | order=" random" |
| product | A single or a list of product IDs. If specified, the loop will return the sales in which these products are selected | product="2", product="1,4,7" |
Plus the global arguments and search arguments
Outputs
| Variable | Value |
|---|---|
| $ACTIVE | true if the sale is active, false otherwise |
| $AUDIENCE_MODE | 0 for a public sale, 1 for a sale reserved for named customers |
| $CHAPO | the sale chapo |
| $DESCRIPTION | the sale description |
| $COUNTDOWN_LEAD_HOURS | the number of hours before the end date the countdown starts, in mode 1 |
| $COUNTDOWN_MODE | 0 never, 1 from the lead hours before the end, 2 from the opening |
| $COUNTDOWN_REMAINING_SECONDS | the seconds left before the end date, or nothing when there is no countdown to show |
| $DISPLAY_INITIAL_PRICE | true if the products initial price should be displayed, false otherwise |
| $END_DATE | the sale end date |
| $HAS_END_DATE | true if the sale has a end date, false otherwise |
| $HAS_START_DATE | true if the sale has a start date, false otherwise |
| $HIDE_PRODUCTS | 1 if a reserved sale hides its products from everyone it is not open to |
| $ID | the content id |
| $IS_TRANSLATED | check if the content is translated |
| $LOCALE | the locale (e.g. fr_FR) of the returned data |
| $POSTSCTIPTUM | the sale postscriptum |
| $PRICE_OFFSET_SYMBOL | the offset unit symbol, % for a percentage, the currency symbol for an amount |
| $PRICE_OFFSET_TYPE | the price offset type, P for a percentage, A for an amount |
| $PRICE_OFFSET_VALUE | the price offset value, as a percentage (0-100) or a constant amount. |
| $SALE_LABEL | the sale advertising label |
| $SHOULD_DISPLAY_COUNTDOWN | 1 if the countdown has to be shown right now |
| $START_DATE | the sale start date |
| $TITLE | the sale title |
| $URL | the rewritten url of the sale page |
Reserved sales
Since Thelia 3.1 a sale can be reserved for named customers, and the loop only returns a reserved sale to a customer it is open to. Price sorting still reads the raw catalogue columns, so the price of a reserved sale does not take part in it. See Reserved Sales and Countdown.
Plus the global outputs
Order possible values
| Ascending value | Descending value | Sorted fields |
|---|---|---|
| active | active-reverse | active |
| alpha | alpha-reverse | title |
| created | created-reverse | date of sale creation |
| end-date | end-date-reverse | end date |
| id | id-reverse | id |
| label | label-reverse | label |
| start-date | start-date-reverse | start date |
| updated | updated-reverse | date of sale update |