Skip to main content

Generic

Generic loop can return any table present in your database and configured with propel. This loop is often useful on your own module table because most of the Thelia table already have dedicated loop.
{loop type="generic" name="the-loop-name" [argument="value"], [...]}

Arguments

ArgumentDescriptionDefaultExample
table_nameThe table name you want query
filtersA single or a list of filters to apply on columns in this format column_name:value1,value2|other_column:valuefilters="id:1,3|visible:1"
orderA single or a list of orders to apply on columns in this format column_name:DESC|other_column:ASCorder="id:DESC|created_at:ASC"
localeThe locale for translated columnsThe current locale for session

Plus the global arguments

Outputs

This loop will output every column of the selected table and the columns of i18n table associated if the table is translatable. The fields are in UPPERCASE.

Plus the global outputs

Examples

I want to display all products visible and not virtual sorted by creation date (just for example, normally it is better to use a dedicated product loop)

<ul>
{loop type="generic" name="my_product_loop" table_name="product" filters="visible:1|virtual:0" orders="created_at:DESC"}
<li>{$ID} {$TITLE} ({$REF})</li>
{/loop}
</ul>