Sale Loop

Sale loop provides an access to sale operations defined on your shop.

{loop type="sale" name="the-loop-name" [argument="value"], [...]}

Important informations :

* : argument is required
** : at least one of ** marked argument is required

Global arguments

Argument Description
backend_context

Determine if loop is use in backend context.

default : false

example : backend_context="on"

force_return

force return result for i18n tables even if there is no record

default : false

example : force_return="on"

limit

The maximum number of results to display.

example : limit="10"

name *

The loop name. This name must be unique and is used to reference this loop further in the page (see ifloop, elseloop or pageloop)

offset

The first product to display offset. Will not be used if `page` argument is set.

default : 0

example : offset="1"

page

The page to display.

example : page="2"

Text search arguments
Argument Description
search_in

A comma separeted list of field in which the search is performed

Possible values : sale_label, title, chapo, description, postscriptum

example : search_in="title"

search_mode

the search mode : `any_word` (search any word separeted by a space), `sentence` (the sentence, anywhere in the field) or `strict_sentence` (the exact sentence)

default : strict_sentence

search_term

The term to search

example : search_term="my product"

Loop arguments

Argument Description
active

A boolean value, to get only active (1) or inactive sales (0) or both (*)

default : 1

example : active="1"

currency

A currency id, to get the price offset defined for this currency

default : The current shop currency

example : currency="1"

exclude

A single or a list of sale ids to excluded from results.

example : id="2", id="1,4,7"

id

A single or a list of sale ids.

example : id="2", id="1,4,7"

order

A list of values

Expected values :
  • active : return active sales first
  • active-reverse : return inactive sales first
  • alpha : alphabetical order on title
  • alpha-reverse : reverse alphabetical order on title
  • created : ascending order on date of sale creation
  • created-reverse : descending order on date of sale creation
  • end-date : ascending order on sale end date
  • end-date-reverse : descending order sale start date
  • id : ID order
  • id-reverse : reverse ID order
  • label : alphabetical order on sale label
  • label-reverse : reverse alphabetical order on sale label
  • start-date : ascending order on sale start date
  • start-date-reverse : descending order sale end date
  • updated : ascending order on date of sale update
  • updated-reverse : descending order on date of sale update

default : manual

example : 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

example : id="2", id="1,4,7"

Global outputs

Variable Description
$LOOP_COUNT the current results index, starting from 1
$LOOP_TOTAL the total number of results returned by the loop
$CREATE_DATE The creation date of this Sale
$UPDATE_DATE The last modification date of this Sale

Loop outputs

Variable Description
$ACTIVE true if the sale is active, false otherwise
$CHAPO the sale chapo
$DESCRIPTION the sale description
$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
$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
$START_DATE the sale start date
$TITLE the sale title