The ecomfn
templating functions provide access to the products from your external e-commerce solution in your FreeMarker templates.
The ecomfn
templating functions are provided by the E-commerce templating module. The Java class that implements the methods is EcommerceTemplatingFunctions.
Get a category by ID
The method gets information about a category by ID.
Method signature
Category getCategoryById(String definitionName, String connectionName, String categoryId)
Arguments
definitionName | required The definition name, for example |
connectionName | required The connection name, for example |
categoryId | required The category ID. |
Returns
A category.
Usage
ecomfn.getCategoryById(definitionName, connectionName, categoryId)
Get a product by ID
The method gets information about a product by ID.
Method signature
Product getProductById(String definitionName, String connectionName, String productId)
Arguments
definitionName | required The definition name, for example |
connectionName | required The connection name, for example |
productId | required The product ID. |
Returns
A product.
Usage
ecomfn.getProductById(definitionName, connectionName, productId)
Get all categories
The method gets all categories.
Method signature
Collection<Category> getAllCategories(String definitionName, String connectionName)
Arguments
definitionName | required The definition name, for example |
connectionName | required The connection name, for example |
Returns
A list of categories.
Usage
ecomfn.getAllCategories(definitionName, connectionName)
Get all categories by product ID
The method gets all categories by product ID. For example, you have a product with the ID redhandbag1
that belongs to categories such as accessories
, red
, evening-wear
and formal
.
Method signature
Collection<Category> getCategoriesByProductId(String definitionName, String connectionName, String productId)
Arguments
definitionName | required The definition name, for example |
connectionName | required The connection name, for example |
productId | required The product ID. |
Returns
A list of all categories by product ID.
Usage
ecomfn.getAllCategories(definitionName, connectionName, productId)
Get all categories by parent ID
The method gets all categories by parent category. For example, you have a parent category with the ID summer
, that has child categories such as sun-glasses
, sun-cream
, swimwear
and so on.
Method signature
Collection<Category> getCategoriesByParentCategoryId(String definitionName, String connectionName, String categoryId)
Arguments
definitionName | required The definition name, for example |
connectionName | required The connection name, for example |
categoryId | required The ID of the parent category, for example |
Returns
A list of all categories by the parent category ID.
Usage
ecomfn.getCategoriesByParentCategoryId(definitionName, connectionName, categoryId)
Get all products
The method gets all products.
Method signature
Collection<Product> getAllProducts(String definitionName, String connectionName)
Arguments
definitionName | required The definition name, for example |
connectionName | required The connection name, for example |
Returns
A list of all products.
Usage
ecomfn.getAllProducts(definitionName, connectionName)
Get all products by category ID
The method gets all products by category ID.
Method signature
Collection<Product> getProductsByCategoryId(String definitionName, String connectionName, String categoryId)
Arguments
definitionName | required The definition name, for example |
connectionName | required The connection name, for example |
categoryId | required The ID of the category. |
Returns
A list of products by category ID.
Usage
ecomfn.getProductsByCategoryId(definitionName, connectionName, categoryId)
Get image link
The method gets a URL link to an image by product.
Method signature
String getImageLink(Product product)
Arguments
product | required The product object. |
Returns
An image URL.
Usage
ecomfn.getImageLink(product)