get_product_variations
Extract all the variations associated to a product.
Accepted Parameters
Parameter | Example | Required | Explanation |
---|---|---|---|
product_id | 1234 | Y | Which product will be used to extract the variations. |
attributes | attributes | Y | This is the name of the variables you would like the results of your query to be placed in. For example, if you set this to "attributes" then the items returned by this method will be loaded into the $attributes template variable. |
Example using template
{get_product_variations product_id="4" attributes="attributes"}
{include file="products/attributes.tpl.html"}
Output Data
As described in the Accepted Parameters section, the attribute data will be put into your nominated variable. Said variable will then contain the following data for your use, where 'x' is the name of your variable.
Parameter | Example | Type | Description |
---|---|---|---|
x[].id | 1234 | Attribute | This is the name of the variables you would like the results of your query to be placed in. For example, if you set this to "attributes" then the items returned by this method will be loaded into the $attributes template variable. |
x[].attribute_name | Size | String | The Name is configured via the Aurora Back-end under the Product > Attributes section. |
x[].attribute_prompt | Configurable Text | String | The Prompt is configured via the Aurora Back-end under the Product > Attributes section. |
x[].attribute_confirmation | Configurable Text | String | The Confirmation is configured via the Aurora Back-end under the Product > Attributes section. |
x[].attribute_info | Configurable Text | String | The Info is configured via the Aurora Back-end under the Product > Attributes section. |
x[].attribute_type | select | String | The type is configured via the Aurora Back-end under the Product > Attributes section and can be one of [select, checkbox, image, radio, rating ]. |
x[].attribute_required | 1 | 1|0 | Describes whether the attribute is required (1) or optional (0). |
x[].priority | 0 | Integer | This value dictates in what order the attribute should be displayed (0/Zero first and then getting larger). |
x[].values | N/A | Array of Values | This array contains the attribute's available values for the provided product_id. |
x[].values[].id | 123123 | Integer | The Unique ID used by Aurora to identify an attribute. |
x[].values[].attribute_value | 10 | String | The value's display text. |
x[].values[].attribute_value_abbreviation | si | String | The value's abbreviouse (often used for filter URLs). |
x[].values[].has_image | 1 | 1|0 | Whether an image has been uploaded for an attribute. |
x[].values[].is_default | 0 | 1|0 | Whether the attribute is considered the default attribute (1) or not (0). |
x[].values[].variation_reference | VU1039E4 | String | The Reference is configured via the Aurora Back-end under the All Products > Edit section. |
x[].values[].variation_upc | UPCN29R | String | The UPC is configured via the Aurora Back-end under the All Products > Edit section. |
x[].values[].variation_ean | EANNFD8024 | String | The EAN is configured via the Aurora Back-end under the All Products > Edit section. |
x[].values[].variation_price | 12.99 | Float | The Price of the variation in the currently selected Currency. |
x[].values[].variation_stock | 3 | Integer | The Reference is configured via the Aurora Back-end under the All Products > Edit section. |
x[].values[].variation_pre_order_stock | 4 | Integer | The Reference is configured via the Aurora Back-end under the All Products > Edit section. |
x[].values[].available | 1 | 1|0 | Whether this variation is Live and available for purchase. Note: Depending on your store settings, unavailable variations may not appear here at all. |
x[].values[].variation_id | 214113 | Integer | The Unique ID used by Aurora to identify a variation. |
x[].values[].fields | N/A | Associative Array of Variation Additional Fields | Variations can have additional fields attached to them. When they do, they are included here for your use. |
x[].values[].fields.field_name | Field Value | String |
Updated almost 2 years ago