Difference between revisions of "Liquid Template Variables - related"

From Spiffy Stores Knowledge Base

m
 
Line 1: Line 1:
The liquid template variable ''related'' has the following attributes:
+
The Liquid template variable '''related''' has the following attributes:
  
 
== <code>related.id</code> ==
 
== <code>related.id</code> ==

Latest revision as of 11:44, 6 November 2013

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.