Magnolia 6.1 reached end of life on March 31, 2021. This branch is no longer supported, see End-of-life policy.
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.
The method gets information about a category by ID.
Category getCategoryById(String definitionName, String connectionName, String categoryId)
definitionName | required The definition name, for example |
connectionName | required The connection name, for example |
categoryId | required The category ID. |
A category.
ecomfn.getCategoryById(definitionName, connectionName, categoryId)
The method gets information about a product by ID.
Product getProductById(String definitionName, String connectionName, String productId)
definitionName | required The definition name, for example |
connectionName | required The connection name, for example |
productId | required The product ID. |
A product.
ecomfn.getProductById(definitionName, connectionName, productId)
The method gets all categories.
Collection<Category> getAllCategories(String definitionName, String connectionName)
definitionName | required The definition name, for example |
connectionName | required The connection name, for example |
A list of categories.
ecomfn.getAllCategories(definitionName, connectionName)
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
.
Collection<Category> getCategoriesByProductId(String definitionName, String connectionName, String productId)
definitionName | required The definition name, for example |
connectionName | required The connection name, for example |
productId | required The product ID. |
A list of all categories by product ID.
ecomfn.getAllCategories(definitionName, connectionName, productId)
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.
Collection<Category> getCategoriesByParentCategoryId(String definitionName, String connectionName, String categoryId)
definitionName | required The definition name, for example |
connectionName | required The connection name, for example |
categoryId | required The ID of the parent category, for example |
A list of all categories by the parent category ID.
ecomfn.getCategoriesByParentCategoryId(definitionName, connectionName, categoryId)
The method gets all products.
Collection<Product> getAllProducts(String definitionName, String connectionName)
definitionName | required The definition name, for example |
connectionName | required The connection name, for example |
A list of all products.
ecomfn.getAllProducts(definitionName, connectionName)
The method gets all products by category ID.
Collection<Product> getProductsByCategoryId(String definitionName, String connectionName, String categoryId)
definitionName | required The definition name, for example |
connectionName | required The connection name, for example |
categoryId | required The ID of the category. |
A list of products by category ID.
ecomfn.getProductsByCategoryId(definitionName, connectionName, categoryId)
The method gets a URL link to an image by product.
String getImageLink(Product product)
product | required The product object. |
An image URL.
ecomfn.getImageLink(product)