Difference between revisions of "Liquid Template Variables - related"

From Spiffy Stores Knowledge Base

(New page: The liquid template variable ''related'' has the following attributes: == <code>related.id</code> == A related collection always returns 0 because it is a pseudo collection. == <code>re...)
(No difference)

Revision as of 17:25, 16 September 2008

The liquid template variable related has the following attributes:

related.id

A related collection always returns 0 because it is a pseudo collection.

related.handle

This is the related collection handle. related is always returned.

related.title

Returns the title of the related collection. This consists of the product's title followed by - Related Products.

related.description

There is no description for a related collection.

related.products

Returns a collection of all products that are related by tag matching to the current product. The list of products takes pagination into account.

You can access each product using a for iteration.

{% for product in related.products %}
   {{ product.title }}
{% endfor %}

related.products_count

Returns the number of related products.

related.all_products

Returns a collection of all products that are related to this product. There are a maximum of 22 related products.

related.url

The is the relative URL address of the related collection.