Products¶
Products are saleable item displayed in your shop.
Products can be accessed in all Liquid templates via
store.products.store.products
represent a collection of all products
variants avalaible.
This variable is a collection of product stored in Algolia.
with_scope
, paginate
liquid tag are available with store.products
.
Note
In these examples below, product
variable is an occurence
of store.products
collection.
Attributes¶
The product
object has the following attributes:
Name | Type | Desciption |
---|---|---|
attributes | Array | Collection of variant attribute |
categories | Array | Collection of parents categories |
default_code | string | Odoo product Internal Reference |
description | String | Product HTML description |
hierarchicalCategories | Array | Parent categories list for faceting ex: {lvl0:…, lvl1:…} |
id | Integer | … |
images | Array | Collection of URL images, 4 image sizes are available for earch item (small, large, medium, original) |
main | Boolean | Main variant |
medias | Array | List of URL for products documentations files |
meta_description | String | Meta description tag value. |
meta_keywords | String | Meta keyword tag value. |
model | String | Product template object (with name attribute) |
name | String | Product name with model name and variant name |
objectID | Integer | Product’s ID |
price | Array | Price. See price documentation below |
qty_available | Integer | Stock quantity saleable |
redirect_url_key | Array | List URL redirection (HTTP status 301) |
rating | Array | Rating, See rating documentation |
relateds.cross_sell | Array | Collection of product ObjectID for cross selling ex: [{id:60}, {id: 78}]. |
relateds.up_sell | Array | Collection of product ObjectID for up selling ex: [{id:60}, {id: 78}]. |
seo_title | String | Product page Title , title tag value |
short_name | String | Variant name |
stock_state | String | Product stock status |
tags | Array | Product tag specification |
url_key | String | Product relative URL |
variant_count | Integer | Number of variant |
variants | Array | Provide product object of all variants available. The use of this variable make an API call to Algolia |
- Example :
Display product model name and variant name.
{% for product in store.products %} <b>{{product.model.name}}</b> - {{product.short_name}} {% endfor %}
Images¶
Shopinvader Odoo module generate images with 4 differents sizes (small, medium, large, original).
Image attribute of product’s data is a product’s images collection. Each image has 4 sizes. Original size is the size of image provided by the user in Odoo.
The image
object has the following attributes:
Name | Type | Desciption |
---|---|---|
src | String | Image URL |
alt | String | Alternate name |
Cart line json
{ "images": [ { "small": { "src": "https://..../image/product.product/44/image/60x60", "alt": "Product....bottom view " }, "large": { "src": "https://..../image/product.product/44/image/500x500", "alt": "Product....top view" }, "medium": { "src": "https://..../image/product.product/44/image/300x300", "alt": "Product....left view" }, "original": { "src": "https://..../image/product.product/44/image", "alt": "Product....side view" } } ] }
- Example :
Display medium size image product.
{% for image in product %} <img src={{image.medium.src}} alt="{{image.medium.alt}}"/> {% endfor %}
Price¶
Price is an attribute of product objet. Price attribute contains some product
price list. Shopinvader use the Locomotive CMS parameter
site.metafields.erp.default_price
value to get the default pricelist.
Price product’s attribute contains automatically the value of the current pricelist.
In case of logged user, Shopinvader get the user price list (pricelist field of customer content type).
Name | Type | Desciption |
---|---|---|
discount | Float | Discount value (Percentage) |
original_value | Float | Old price value without discount |
tax_included | Boolean | True => VAT included |
value | Float | Price value |
- Example :
JSON price data
{ "price": { "public_tax_exc": { "discount": 20, "tax_included": false, "value": 1530.37, "original_value": 1912.96 }, "public_tax_inc": { "discount": 20, "tax_included": true, "value": 1759.92, "original_value": 2199.9 } } }
Display product price
{{product.price.value | money}}
Rating¶
Rating attribute contains reviews list and a summary to get average rating.
Summary¶
Use to get average rating value.
¶ Name Type Desciption count Integer Number of rate average Float Average rate value distribution Array Get rate number for each rate step
- Example
JSON summary rating data (extract of product object)
{ "summary": { "count": 9, "average": 4, "distribution": { "1": 0, "2": 0, "3": 1, "4": 1, "5": 5 } } }Display rating
{{product.rating.summary.average}}
Review¶
Review object is an occurrence of
product.rating.reviews
array.This object represent a customer review.
¶ Name Type Desciption reviews.comment String meta description tag value. reviews.rating String meta keyword tag value.
- Example
JSON reviews data (extract of product object){ "reviews": [ { "comment": "Comment text", "rating": 4, "product_code": false, "nickname": "Customer name", "name": "Customer name" }, { "comment": "Comment text", "rating": 4, "product_code": false, "nickname": "Customer name", "name": "Customer name" } ], }