List
This is a work in progress document and is subject to change.
Generate a list of content based on the type specified.
The [%list%]
is a new function that replaces many other Maropost Commerce Cloud B@SE functions such as [%thumb_list%]
, [%content_menu%]
and other functions.
Body template
While the [%thumb_list%]
function takes it's body template from the thumbs
directory, the [%list%]
function takes it's body template from the list
directory, which isn't in a theme directory by default. If you want the exact templates from your thumbs
directory then you could copy /httpdocs/assets/themes/[THEME-NAME]/templates/thumb/product/*.html
into /httpdocs/assets/themes/[THEME-NAME]/templates/list/product
. The [%list%]
type will dictate which sub directory the template comes from, e.g , [%list type:'content' template:'category'%]
would have a template at /httpdocs/assets/themes/[THEME-NAME]/templates/list/content/category.template.html
.
Parameters
[%list type:'content' template:'category' limit:'12' filter:'content_type=category' sort:'content_name' sort_direction:'asc'%]
...
[%/list%]
Name | Options | Description |
---|---|---|
type | string | See below for details on each type. |
template | string | A template filename without file extension. File should be placed under theme folder within below mentioned directory `[THEME_FOLDER]/template/list/[filename].template.html` **Usage**: template='filename' |
limit | number | Sets the limit of results. |
filter | urlencoded object | See each type for specific filters. |
sort | string | See each type for specific sort. |
sort_direction | string | Sets the sorting direction of the result set `sort_direction:'asc'` or `sort_direction:'desc'` |
Filters
Filters can be used to fine-tune the results of the list function. A single filter can be used, or multiple filters can be joined using an ampersand &
to further limit the results.
For example [%list type:'product' filter:'min_price=100'%]
will only show products that have a price higher than $100. By adding a max_price=500
filter we can limit the results to only products between $100 - $500:
[%list type:'product' filter:'min_price=100&max_price=500'%]
Some filters can take multiple values separated by a commaa ,
for example filter:'parent_sku=item2,item7'
will show only child products from those parent SKUs.
This is different to joining filters in that you are increasing the results by adding additional values to the same filter. Filters with multiple values can also be combined to different filters, for example:
[%list type:'product' filter:'parent_sku=item2,item7&promo_current=y'%]
will show all the child products that match those parent SKUs but only if they are on special.
For a full list of filters and their usage see under each list type.
Types
The list tag is consolidated into the following types:
The data tags available will be dependant on the type
Type:product
For displaying different types of products and product information.
Type product example
This list function will display the 4 top selling products, using the default product template: /httpdocs/assets/themes/[THEME-NAME]/templates/list/product/template.html
.
[%list type:'product' template:'' sort:'top_sellers' limit:'4'%]
[%param *header%]
<h3>Popular Products</h3>
<div class="row">
[%/param%]
[%param *footer%]
</div>
[%/param%]
[%/list%]
Filter
|
Usage
|
Description
|
---|---|---|
approval | `filter:'approval=y'` or `filter:'approval=n'` | Filter by product approval |
content | `filter:'content=1'` or `filter:'content=1,2,3'` | Filter by product content |
content_type | `filter:'content_type=1'` | Filter a product by content type |
first_letter | `filter:'first_letter=(text)'` | Filter product by matching product name |
user_group | `filter:'user_group=1'` | Filter by user groups |
min_height | `filter:'min_height=10'` | Filter by height |
hide_parent_products | `filter:'hide_parent_products=y'` or `filter:'hide_parent_products=n'` | Filter parent products |
promo_current | `filter:'promo_current=y'` or `filter:'promo_current=n'` | Filter by products currently in promotion |
in_stock | `filter:'in_stock=y'` or `filter:'in_stock=n'` | Filter by products in stock |
inventory_id | `filter:'inventory_id=22'` | Filter by inventory id |
item_group | `filter:'item_group=1'` | Filter by item group |
keywords | `filter:'keywords=(text)'` | Filter by keywords |
min_length | `filter:'min_length=(number)'` | Filter by length |
max_price | `filter:'max_price=(number)'` | Filter products by restricting maximum price |
min_price | `filter:'min_price=(number)'` | Filter products by restricting minimum price |
parent_inventory_id | `filter:'parent_inventory_id=[@inventory_id@]'` | Show the children of the specified inventory_id |
parent_sku | `filter:'parent_sku=[@sku@]'` | Show the children of the specified SKU |
product_type | `filter:'product_type=(text)'` | Filter by type of product |
promo_past | `filter:'promo_past=y'` or `filter:'promo_past=n'` | Filter by product not in promotion |
promo_future | `filter:'promo_future=y'` or `filter:'promo_future=n'` | Filter by upcoming promotion |
search_ids | `filter:'search_ids=1,2,3'` | Filter by providing list of inventory ids |
show_hidden | `filter:'show_hidden=1'` | Flag to display products regardless of visibility status |
show_unapproved | `filter:'show_unapproved=1'` | Flag to display products regardless of approval status |
specifics | `filter:'specifics='` | Filter by product specifics. Separate IDs by comma. E.g: `filter:'specifics=2,7'` |
visible | `filter:'visible=y`' or `filter:'visible=n'` | Filter by visibility |
warehouse | `filter:'warehouse=(text)'` | Filter products by warehouses |
min_width | `filter:'min_width=(number)'` | Filter by width |
wishlist | `filter:'wishlist=?'` | Filter by wishlist |
wishlist_purchased | `filter:'wishlist_purchased=y'` or `filter:'wishlist_purchased=n'` | Filter by already purchased wishlist products |
Sort
|
Usage
|
Description & Usage
|
---|---|---|
brand | `sort:'brand'` | Sort by product brand |
display_priority | `sort:'display_priority'` | Sort by display priority |
highest_price | `sort:'highest_price'` | sort by highest price |
highest_qty | `sort:'highest_qty'` | Sort by highest quantity |
inventory_id | `sort:'inventory_id'` | Sort by inventory id |
largest_item | `sort:'largest_item'` | Sort by largest item |
longest_item | `sort:'longest_item'` | Sort by longest item |
lowest_price | `sort:'lowest_price'` | Sort by lowest price |
lowest_qty | `sort:'lowest_qty'` | Sort by lowest quantity |
name | `sort:'name'` | Sort by name |
new_arrivals | `sort:'new_arrivals'` | Sort by new arrivals |
promo_end | `sort:'promo_end'` | Sort by promotion ending |
random | `sort:'random'` | Sort randomly |
shortest_item | `sort:'shortest_item'` | Sort by shortest item |
SKU | `sort:'SKU'` | Sort by sku |
smallest_item | `sort:'smallest_item'` | Sort by smallest item |
sortorder | `sort:'sortorder'` | Sort by sortorder |
sortorder2 | `sort:'sortorder2'` | Sort by other sort order |
sortorder_price | `sort:'sortorder_price'` | Sort by sort order price |
sortorder2_price | `sort:'sortorder2_price'` | Sort by other sort order price |
sortorder_sortorder2 | `sort:'sortorder_sortorder2'` | Sort by sort order's sort order |
subtype_sortorder2 | `sort:'subtype_sortorder2'` | Sort by subtype's sort order |
top_sellers | `sort:'top_sellers'` | Sort by top sellers |
trending | `sort:'trending'` | Sort by trending |
wishlist | `sort:'wishlist'` | Sort by wishlist |
Type:content
For displaying different content types information, e.g, brands or categories.
Type content example
This list function will display 6 items from the content type brands, using the 'brand' template: /httpdocs/assets/themes/[THEME-NAME]/templates/list/content/brand.template.html
.
[%list type:'content' filter:'content_type=brand' template:'brand' limit:'6' sort:'content_name'%]
[%param *header%]
<hr/>
<h2 class="text-center">Featured Brands</h2>
<div class="row featured-brands">
[%/param%]
[%param *footer%]
<div class="col-xs-12 text-center">
<a href="[%url type:'content' id:'100'/%]">Show All Brands</a>
</div>
</div>
[%/param%]
[%/list%]
Filter
|
Example
|
Description & Usage
|
---|---|---|
content | `filter:'content=1,2,3'` | Get child contents |
content_level | `filter:'content_level=1'` | Filter by content levels |
content_type | `filter:'content_type=blog'` | Filter by content type. By default content_type is set to 'category'. (Available content types: page, form, category, buying, brand and blog) |
first_letter | `filter:'first_letter=a'` | Filters by the starting character specified in the parameter |
hide_private | `filter:'hide_private=1'` | If hide_private is set to 1, contents will be hidden if access_control is set to private |
inventory_id | `filter:'inventory_id=1,2,3'` | Comma separated list to filter contents which contain this list of products |
related_content_inverse | `filter:'related_content_inverse=1,2,3'` | Get all contents that are related to these contents |
related_content | `filter:'related_content=1,2,3'` | Get all the related contents for these contents |
show_hidden | `filter:'show_hidden=1'` | Filter by show hidden. (eg: "Visible On Menu" is checked) `1` will show contents which are hidden on menu, 0 will filter them out. 0 is default if undefined. |
sku | `filter:'sku=SAMPLE'` | Filter by product sku |
user_group | `filter:'group_id=1'` | Specifies a group for the list. If not defined it will either use the current group_id or default group_id |
Sort
|
Example
|
Description & Usage
|
---|---|---|
content_name | `sort:'content_name'` | Sort by content name |
Type:content_review
For displaying content page reviews.
Type content_review example
This list function will display a max of 5 content reviews, which is standard for a page that uses the default.template.html
template, e.g blogs or information pages.
[%list type:'content_review' limit:'5' filter:'content_id=[@content_id@]'%]
[%param *header%]
<h3>Comments ([@reviews@])</h3>
[%/param%]
[%param *body%]
<div itemprop="review" itemscope itemtype="http://schema.org/Review">
<blockquote>
<h4 itemprop="name"><i>[%nohtml%][@title@][%/nohtml%]</i></h4>
<div>
<strong>[%if [@reviewname@]%]By: <span itemprop="author">[@reviewname@]</span> on [%/ if%]<meta itemprop="datePublished" content="[%FORMAT type:'date'%][@insert_date@][%/FORMAT%]">[%FORMAT type:'date'%][@insert_date@][%/FORMAT%]</strong>
</div>
<span itemprop="description">[%nohtml%][@review@][%/nohtml%]</span>
[%IF [@review_response@]%]
<br /><br />
<blockquote>
<span class="review_response text-muted"><strong><i>[@config:website_name@] Response</i></strong><br /> [%nohtml%][@review_response@][%/nohtml%]</span>
</blockquote>
[%/IF%]
</blockquote> <hr />
</div>
[%/param%]
[%/list%]
Filter
|
Example
|
Description & Usage
|
---|---|---|
content_id | `filter:'content_id=1'` | Filter by a content_id |
Sort
|
Description & Usage
|
---|---|
insert_date |
Sort by review insert date. Note: review insert date is the default sorting field. Any other field from the above listed data tags can be used to sort the list. However using other fields may affect performance. Usage sort:'title' |
Type:product_review
For displaying product reviews.
Type product_review example
review_response data tag doesn't look to work yet :(
[%list type:'product_review' limit:'5' filter:'sku=[@SKU@]'%]
[%param *body%]
<div itemprop="review" itemscope itemtype="http://schema.org/Review">
<meta itemprop="itemReviewed" content="[@name@]">
<blockquote>
<h4 itemprop="name">[%nohtml%][@title@][%/nohtml%]</h4>
<p itemprop="description">[%nohtml%][@review@][%/nohtml%]</p>
<div itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating">
<meta itemprop="worstRating" content = "1">
<meta itemprop="ratingValue" content = "[@score@]">
<meta itemprop="bestRating" content = "5">
</div>
[%set [@data:ratings-count@] = 1 /%]
[%while [@data:ratings-count@] <= [@data:score@]%]
[%set [@data:ratings-count@] = [@data:ratings-count@]+1 /%]
<i class="fa fa-star"></i>
[%/while%]
[%while [@data:ratings-count@] <= 5%]
[%set [@data:ratings-count@] = [@data:ratings-count@]+1 /%]
<i class="fa fa-star-o"></i>
[%/while%]
<span class="badge">[@score@]</span>
<div>
<small>[%if [@reviewname@]%]By: <span itemprop="author">[@reviewname@]</span> on [%/if%]<meta itemprop="datePublished" content="[%FORMAT type:'date'%][@insert_date@][%/FORMAT%]">[%FORMAT type:'date'%][@insert_date@][%/FORMAT%]</small>
</div>
[%if [@review_response@]%]
<br /><br />
<blockquote>
<span class="review_response text-muted"><strong><i>[@config:website_name@] Response</i></strong><br /> [%nohtml%][@review_response@][%/nohtml%]</span>
</blockquote>
[%/if%]
</blockquote>
</div>
[%/param%]
[%/list%]
Filter
|
Example
|
Description & Usage
|
---|---|---|
sku | `filter:'sku=SAMPLE'` | Filter by a product SKU |
inventory_id | `filter:'inventory_id=22'` | Filter by an inventory_id |
show_child_product_reviews | `filter:'inventory_id=22&show_child_product_reviews=1'` or `filter:'sku=SAMPLE&show_child_product_reviews=1'` | A flag used with inventory_id and sku to display child product reviews |
category | `filter:'category=1,2,3'` | Get all product reviews filter by provided product categories |
Sort
|
Description & Usage
|
---|---|
insert_date |
Sort by review insert date. Note: review insert date is the default sorting field. Any other field from the above listed data tags can be used to sort the list. However using other fields may affect performance. Usage sort:'title' |
Type:store_location
For displaying store / stockist information.
Type store_location example
[%list filter:'store_id=[@stloc_id@]' limit:'1'%]
[%PARAM *body%]
<h1>[@stloc_name@]</h1>
<hr>
<div class="row">
<div class="col-xs-12 col-sm-8">
<address>
<p>
[@stloc_street1@] [@stloc_street2@]<br>
[@stloc_city@][%if [@stloc_state@] or [@stloc_zip@]%], [@stloc_state@] [@stloc_zip@][%/if%][%if [@stloc_country@]%], [@stloc_country@][%/if%]
</p>
<p>
[%if [@stloc_phone@]%]<i class="fa fa-phone"></i> [@stloc_phone@]<br>[%/if%]
[%if [@stloc_fax@]%]<i class="fa fa-fax"></i> [@stloc_fax@]<br>[%/if%]
[%if [@stloc_email@]%]<i class="fa fa-envelope-o"></i> <a href="mailto:[@stloc_email@]">[@stloc_email@]</a><br>[%/if%]
</p>
</address>
<img src="[@thumb_image@]" alt="[@stloc_name@]">
</div>
[%if [@stloc_lat@] and [@stloc_lng@]%]
<div class="col-xs-12 col-sm-4">
<a href="https://www.google.com.au/maps/place/[%url_encode%][@stloc_street1@] [@stloc_street2@] [@stloc_city@] [@stloc_state@] [@stloc_zip@][%/url_encode%]/@[@stloc_lat@],[@stloc_lng@],15z">
<img src="https://maps.googleapis.com/maps/api/staticmap?center=[@stloc_lat@],[@stloc_lng@]&zoom=20&size=400x400&markers=color:blue%7Clabel:%7C[@stloc_lat@],[@stloc_lng@][%if [@config:GOOGLE_GEO_API@]%]&key=[@config:GOOGLE_GEO_API@][%/if%]" class="img-responsive" alt="[%nohtml%][@stloc_name@] [@stloc_street1@] [@stloc_street2@], [@stloc_city@], [@stloc_state@] [@stloc_zip@], [@stloc_country@][%/nohtml%]">
</a>
</div>
[%/if%]
</div>
[%/PARAM%]
[%/list%]
Filter
|
Example
|
Description & Usage
|
---|---|---|
store_id |
`filter:'store_id=1'` | Filter by a store_id |
username | `filter:'username=someone'` |
Filter by the username who added the store Note : When not provided only the list of active and approved store locations will be displayed. |
Sort
|
Description & Usage
|
---|---|
stloc_name |
Sort by store location name. Note: Location name is the default sorting field. Any other field from the above listed data tags can be used to sort the list. However using other fields may affect performance. Usage sort:'date_created' |