Product Loop

A product loop lets you loop through products on a category or subcategory page.

Example:

{% pagination product(current, 20) %}
{% loop product(current, name, desc) %}
<div>
<a href="{current.product_url}">{current.product_image_tiny}</a>
<p><a href="{current.product_url}">{current.product_name}</a></p>
<p>Part #: {current.attr_part_number}</p>
</div>
{% endloop current %}

Product Loops can be called like any of the following:

  • {% loop product(current) %}
  • {% loop product(current, name, desc) %}
  • {% loop product(current, id, asc) %}
  • {% loop product(cat_slug) %}

A product loop can loop through any slug or current page. Current will inherit where the loop is being called. By specifying a particular slug (category or subcategory), you can loop through products within a category or subcategory.

The second and third parameters are not required

Parameter 2: name or id

Parameter 3: asc or desc

The following output tags are available:

Output Tag Description
{product_name} Product Display Name
{product_price} Product Price (not sku price)
{product_description_7} First 7 words of product description
{product_description_10} First 10 words of product description
{product_description_15} First 15 words of product description
{product_description_25} First 25 words of product description
{product_description_50} First 50 words of product description
{product_description_75} First 75 words of product description
{product_description_100} First 100 words of product description
{product_description_200} First 200 words of product description
{product_description} First 200 words of product description
{product_url} Product URL
{has_product_image} Boolean (true/false) if product has an image or not
{product_image_[size]} This will call the default image for the product. See the section about image sizes to enter for the word [size]
{product_image_[size]_url} This will call the url for the default image for the product. See the section about image sizes to enter for the word [size]
attribute slug All product attribute slugs that have been flagged to show externally
Loop Conditionals Click here to learn more about loop conditionals.

This loop requires pagination. Please see the section about pagination on how to implement and what variables are accessible using pagination.


Start your free, no-risk trial today.