Difference between revisions of "Liquid Template Variables - image"

From Spiffy Stores Knowledge Base

m
m
Line 1: Line 1:
 
The Liquid template variable '''image''' cannot be invoked on its own. It is only available as a result of calling the image attributes on [[Liquid_Template_Variables_-_product|product]] and [[Liquid_Template_Variables_-_collection|collection]] variables.
 
The Liquid template variable '''image''' cannot be invoked on its own. It is only available as a result of calling the image attributes on [[Liquid_Template_Variables_-_product|product]] and [[Liquid_Template_Variables_-_collection|collection]] variables.
  
The Liquid template variable '''image''' has the following attributes:
+
The variable has the following attributes:
  
 
== <code>image.id</code> ==
 
== <code>image.id</code> ==
  
Returns the unique internal number of the product.
+
Returns the unique internal number of the image.
  
 
This is normally only for internal usage.
 
This is normally only for internal usage.
 +
 +
== <code>image.product_id</code> ==
 +
 +
Returns the unique internal number of the product that the image belongs to.
 +
 +
This value is the same as ''product.id''.
 +
 +
== <code>image.collection_id</code> ==
 +
 +
Returns the unique internal number of the collection that the image belongs to.
 +
 +
This value is the same as ''collection.id''.
 +
 +
== <code>image.position</code> ==
 +
 +
Returns the position of the image within the collection of images belonging to the product or collection.
 +
 +
It is the same as the value of ''forloop.index'' when you iterate through the array of images returned by ''product.images'' or ''collection.images''.
 +
 +
The featured, or first, image of the product or collection will always have a position value of 1.

Revision as of 12:16, 6 November 2013

The Liquid template variable image cannot be invoked on its own. It is only available as a result of calling the image attributes on product and collection variables.

The variable has the following attributes:

image.id

Returns the unique internal number of the image.

This is normally only for internal usage.

image.product_id

Returns the unique internal number of the product that the image belongs to.

This value is the same as product.id.

image.collection_id

Returns the unique internal number of the collection that the image belongs to.

This value is the same as collection.id.

image.position

Returns the position of the image within the collection of images belonging to the product or collection.

It is the same as the value of forloop.index when you iterate through the array of images returned by product.images or collection.images.

The featured, or first, image of the product or collection will always have a position value of 1.