public interface Product extends Adaptable
Product interface reflects resources that represent products and
their variants in an e-commerce system.
Products have properties. Properties which drive product variation are known as
"variant axes". Note that this does not include properties which change as a
result of variation, such as "shipping-weight" or "price".
Each product variation must have a unique resource. Hierarchy above those leaf
resources may or may not be present, depending on the PIM architecture, but if
present should also be modelled by the Product interface.| Modifier and Type | Field and Description |
|---|---|
static String |
RESOURCE_TYPE_PRODUCT
Base resource type for products.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
axisIsVariant(String axis)
Tests a single axis (property) for variation.
|
Resource |
getAsset()
Get the primary asset for this product, or
null if no asset was found. |
List<Resource> |
getAssets()
Get all the assets for this product.
|
Product |
getBaseProduct()
Returns the product which forms the base of a set of variations.
|
String |
getDescription()
Returns the product's description.
|
String |
getDescription(String selectorString)
Returns the product's description based on the given selector.
|
ImageResource |
getImage()
Get the primary image for this product, or
null if no image was found. |
String |
getImagePath()
Deprecated.
since 5.6.1; use
getImage() instead. |
List<ImageResource> |
getImages()
Get all the images for this product.
|
String |
getImageUrl()
Deprecated.
since 5.6.1; use
getImage() instead. |
String |
getPagePath()
Get the path of the parent page which renders the product/variation.
|
String |
getPath()
Get the underlying resource's path.
|
Product |
getPIMProduct()
Returns the PIM Product (under /etc/commerce/products) which stores this product's
data.
|
<T> T |
getProperty(String name,
Class<T> type)
Returns a product property.
|
<T> T |
getProperty(String name,
String selectorString,
Class<T> type)
Return a product property based on the given selector.
|
String |
getSKU()
Get a unique identifier for a product variation.
|
ImageResource |
getThumbnail()
Deprecated.
since 6.1; use
getThumbnailUrl() instead. |
String |
getThumbnailUrl()
Returns the URL to the product's thumbnail image.
|
String |
getThumbnailUrl(int width)
Returns the URL to the product's thumbnail image, resized to the specified width.
|
String |
getThumbnailUrl(String selectorString)
Returns the URL to the product's thumbnail image, based on the given selector string.
|
String |
getTitle()
Returns the product's title.
|
String |
getTitle(String selectorString)
Returns the product's title based on the given selector.
|
Iterator<String> |
getVariantAxes()
Returns an iterator over the property names of the variant axes.
|
Iterator<Product> |
getVariants()
Returns an iterator over the list of all product variations to which this
particular product/variant belongs.
|
Iterator<Product> |
getVariants(VariantFilter filter)
Returns an iterator over the list of product variants for this product filtered by
the
VariantFilter. |
static final String RESOURCE_TYPE_PRODUCT
String getPath()
String getPagePath()
String getSKU()
String getTitle()
String getTitle(String selectorString)
The selector is often a language token, but could also be a regional identifier or some other discriminator.
selectorString - String getDescription()
String getDescription(String selectorString)
The selector is often a language token, but could also be a regional identifier or some other discriminator.
selectorString - String getThumbnailUrl()
String getThumbnailUrl(int width)
width - String getThumbnailUrl(String selectorString)
The selector is often a size or orientation specification, but could also be used for language- or region-specific images.
selectorString - Resource getAsset()
null if no asset was found.List<Resource> getAssets()
ImageResource getImage()
null if no image was found.List<ImageResource> getImages()
<T> T getProperty(String name, Class<T> type)
name - The property nametype - The type the property value should be converted to<T> T getProperty(String name, String selectorString, Class<T> type)
The selector is often a language token, but could also be a regional identifier or some other discriminator.
T - name - selectorString - type - Iterator<String> getVariantAxes()
["color", "size"].boolean axisIsVariant(String axis)
axis - The name of the propertytrue if the given axis is variantIterator<Product> getVariants() throws CommerceException
coat/
coat-blue/
coat-blue-S
coat-blue-M
coat-green/
coat-green-S
it must return [coat-blue-S, coat-blue-M, coat-green-S] whether called
from the Product representing coat or coat-green-S.CommerceExceptionIterator<Product> getVariants(VariantFilter filter) throws CommerceException
VariantFilter.
Example usages:
To get the complete list of sizes, irrespective of color:
Iterator iter = product.getVariants(new EnumerateAxisFilter("size"));
To get the list of sub-variants of the color "blue":
Iterator iter = product.getVariants(new AxisFilter("color", "blue"));
CommerceExceptionVariantFilter,
EnumerateAxisFilter,
AxisFilterProduct getBaseProduct() throws CommerceException
Product which is already the base, will return this.ProductCommerceExceptionProduct getPIMProduct() throws CommerceException
ProductCommerceException@Deprecated String getImageUrl()
getImage() instead.@Deprecated String getImagePath()
getImage() instead.@Deprecated ImageResource getThumbnail()
getThumbnailUrl() instead.null if no thumbnail was found."Copyright © 2010 - 2017 Adobe Systems Incorporated. All Rights Reserved"