Product Loop
Product loop lists products from your shop. You very probably will have to use the product sale elements loop inside your product loop.
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, 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 |
---|---|
attribute_non_strict_match |
Only available if complex='true'
Expected values :
default : none example : attribute_non_strict_match="promo,new" : loop will return the product if it has at least a product sale element in promo and at least a product sale element as new ; even if it's not the same product sale element. |
brand |
A single or a list of brand ids. example : brand="2", brand="1,4,7" |
category |
A single or a list of category ids. example : category="2", category="1,4,7" |
category_default |
A single or a list of default category ids allowing to retrieve all products having this parameter as default category. example : category_default="2", category_default="1,4,7" |
complex |
A boolean. If set to true, product loop will consider all product sale elements else it will only consider default product sale element. Some of the arguments/outputs will not be available depending on the complex argument. default : false example : complex="true" |
content
Thelia >= 2.3 |
One or more content ID. When this parameter is set, the loop returns the products related to the specified content IDs. example : content="3" |
currency |
A currency id example : currency="1" |
current |
A boolean value which allows either to exclude current product from results either to match only this product example : current="yes" |
current_category |
A boolean value which allows either to exclude current category products from results either to match only current category products. If a product is in multiple categories whose one is current it will not be excluded if current_category="false" but will be included if current_category="yes" example : current_category="yes" |
depth |
A positive integer value which precise how many subcategory levels will be browse. Will not be consider if category parameter is not set. default : 1 example : depth="2" |
exclude |
A single or a list of product ids. example : exclude="2", exclude="1,4,7" |
exclude_category |
A single or a list of category ids. If a product is in multiple categories which are not all excluded it will not be excluded. example : exclude_category="2", exclude_category="1,4,7" |
exclude_tax_rule_id
Thelia >= 2.4 |
Filter products not having this tax rule ID example : exclude_tax_rule_id=21 |
feature_availability |
A list of mandatory features and the feature_availability expected for these. example : feature_availability="1: (1 | 2) , 2:*, 3: 10 | (11&12)" : feature 1 must have feature_availability 1 or 2 AND feature 2 must be set to any feature_availability AND feature 3 must have feature_availability 10 or both feature_availability 11 and 12 |
feature_values |
A list of mandatory features and the string value expected for these. example : feature_values="1: (foo | bar) , 2:*, 3: foobar" : feature 1 must have feature value "foo" or "bar" AND feature 2 must be set to any feature_availability AND feature 3 must have feature value "foobar" |
id |
A single or a list of product ids. example : id="2", id="1,4,7" |
lang |
A lang id example : lang="1" |
max_price |
A float value. Equal value matches. example : max_price="32.1" |
max_weight |
A float value. Equal value matches. example : max_weight="32.1" |
min_price |
A float value. Equal value matches. example : min_price="12.3" |
min_stock |
An integer value. Equal value matches. example : min_stock="3" |
min_weight |
A float value. Equal value matches. example : min_weight="32.1" |
new |
A boolean value. example : new="yes" |
order |
A list of values
Expected values :
default : alpha example : order="category,min_price" |
promo |
A boolean value. example : promo="yes" |
ref |
A single or a list of product references. example : ref="ref0", id="ref1,ref6" |
return_url
Thelia >= 2.3 |
A boolean value which allows the urls generation. default : yes example : return_url="no" |
tax_rule_id
Thelia >= 2.4 |
Filter products having this tax rule ID example : tax_rule_id=21 |
title |
filter by title example : title="foo" |
virtual |
A boolean value. example : virtual="yes" |
visible |
A boolean value. default : yes example : visible="no" |
with_prev_next_info |
A boolean. If set to true, $HAS_PREVIOUS, $HAS_NEXT, $PREVIOUS, and $NEXT output variables are available. default : false example : with_prev_next_info="yes" |
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 |
$UPDATE_DATE | The last modification date of this Product |
Loop outputs
Variable | Description |
---|---|
$BEST_PRICE | the product best tax-free price for the received arguments, depending on the attributes and promo status. |
$BEST_PRICE_TAX | the best price taxes amount |
$BEST_TAXED_PRICE | the best price including taxes |
$BRAND_ID | the brand id of this product. Empty if no brand is assigned for this product |
$CHAPO | the product chapo |
$DEFAULT_CATEGORY | the default category id associated to this product |
$DESCRIPTION | the product description |
$EAN_CODE |
Only available if complex='false' the default product sale elements EAN Code |
$HAS_NEXT | true if a product exists after this one in the current category, following products positions. Only available if with_prev_next_info parameter is set to true |
$HAS_PREVIOUS | true if a product exists before this one in the current category, following products positions. Only available if with_prev_next_info parameter is set to true |
$ID | the product id |
$IS_NEW |
If complex='true' returns if at least one of it's product sale element is new If complex='false' returns if the default product sale element is new |
$IS_PROMO |
If complex='true' returns if at least one of it's product sale element is in promo If complex='false' returns if the default product sale element is in promo |
$IS_TRANSLATED | check if the product is translated or not |
$LOCALE | the locale used for this loop |
$META_DESCRIPTION | the product meta description |
$META_KEYWORDS | the product meta keywords |
$META_TITLE | the product meta title |
$NEXT | The ID of product after this one in the current category, following products positions, or null if none exists. Only available if with_prev_next_info parameter is set to true |
$POSITION | the product position |
$POSTSCRIPTUM | the product postscriptum |
$PREVIOUS | The ID of product before this one in the current category, following products positions, or null if none exists. Only available if with_prev_next_info parameter is set to true |
$PRICE |
Only available if complex='false' the default product sale elements price |
$PRICE_TAX |
Only available if complex='false' the default product sale elements price tax |
$PRODUCT_SALE_ELEMENT |
Only available if complex='false' the default product sale elements id |
$PROMO_PRICE |
Only available if complex='false' the default product sale elements promo price |
$PROMO_PRICE_TAX |
Only available if complex='false' the default product sale elements promo price tax |
$PSE_COUNT |
Only available if complex='false' the number of product sale elements |
$QUANTITY |
Only available if complex='false' the default product sale elements stock quantity |
$REF | the product reference |
$TAXED_PRICE |
Only available if complex='false' the default product sale elements taxed price |
$TAXED_PROMO_PRICE |
Only available if complex='false' the default product sale elements taxed promo price |
$TAX_RULE_ID | the product's tax rule ID |
$TEMPLATE | the template id associated to this product |
$TITLE | the product title |
$URL | the product URL |
$VIRTUAL | Return if the product is a virtual product or not |
$VISIBLE | Return if the product is visible or not |
$WEIGHT |
Only available if complex='false' the default product sale elements weight |