Product sale elements Loop

Product sale elements loop lists product sale elements from your shop. You may need to use the attribute combination loop inside your product sale elements loop.

{loop type="product_sale_elements" 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 : ref, ean_code

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
currency

A currency id

example : currency="1"

default

A boolean value. If true, returns only the default product sale elements. If false, the default product sale element is not returned

example : default="yes"

id

A comma separated list of product sale elements id. Mandatory if the 'product' parameter is not present

example : id="1,3,8"

new

A boolean value. If true, returns only product sale elements for which promo is on. The reverse with 'false'

example : new="yes"

order

A list of values

Expected values :
  • id : ascending id Thelia >= 2.3
  • id_reverse : descending id Thelia >= 2.3
  • max_price : descending price
  • min_price : ascending price
  • new : new products first
  • promo : promo products first
  • quantity : ascending quantity
  • quantity_reverse : descending quantity
  • random
  • ref : ascending reference Thelia >= 2.4
  • ref_reverse : descending reference Thelia >= 2.4
  • weight : ascending weight Thelia >= 2.2
  • weight_reverse : descending weight Thelia >= 2.2

default : random

example : order="promo,min_price"

product

A single product id. Mandatory if the 'id' parameter is not present

example : product="2"

promo

A boolean value. If true, returns only product sale elements for which new is on. The reverse with 'false'

example : promo="yes"

visible
Thelia >= 2.4

A boolean value, or * (the default) for ignoring this filter

default : *

example : visible="no"

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 Product_sale_elements
$UPDATE_DATE The last modification date of this Product_sale_elements

Loop outputs

Variable Description
$EAN_CODE the product sale element EAN Code
$ID the product sale element id
$IS_DEFAULT returns if the product sale element is the default product sale element for the product
$IS_NEW returns if the product sale element is new
$IS_PROMO returns if the product sale element is in promo
$PRICE the product sale element price
$PRICE_TAX the product sale element price tax
$PRODUCT_ID the related product id
$PROMO_PRICE the product sale element promo price
$PROMO_PRICE_TAX the product sale element promo price tax
$QUANTITY the product sale element stock quantity
$REF the product sale element reference
$TAXED_PRICE the product sale element taxed price
$TAXED_PROMO_PRICE the product sale element taxed promo price
$WEIGHT the product sale element weight
I want to display all products sale elements for current product and show all the attribute combinations which matched it.
{loop name="pse" type="product_sale_elements" product="$PRODUCT_ID"}
    <div>
        {loop name="combi" type="attribute_combination" product_sale_elements="$ID"}
        {$ATTRIBUTE_ID}. {$ATTRIBUTE_TITLE} = {$ATTRIBUTE_AVAILABILITY_ID}. {$ATTRIBUTE_AVAILABILITY_TITLE}<br />
        {/loop}
        <br />{$WEIGHT} g
        <br /><strong>{if $IS_PROMO == 1} {$PROMO_PRICE} € (instead of {$PRICE}) {else} {$PRICE}{/if}</strong>
        <br /><br />
        Add
        <select>
            {for $will=1 to $QUANTITY}
            <option>{$will}</option>
            {/for}
        </select>
        to my cart
    </div>
{/loop}