org.broadleafcommerce.core.web.processor
Class RelatedProductProcessor
java.lang.Object
org.thymeleaf.processor.AbstractProcessor
org.thymeleaf.processor.element.AbstractElementProcessor
org.broadleafcommerce.common.web.dialect.AbstractModelVariableModifierProcessor
org.broadleafcommerce.core.web.processor.RelatedProductProcessor
- All Implemented Interfaces:
- Comparable<org.thymeleaf.processor.IProcessor>, org.thymeleaf.processor.IProcessor
@Component(value="blRelatedProductProcessor")
public class RelatedProductProcessor
- extends AbstractModelVariableModifierProcessor
A Thymeleaf processor that will find related products. A product or category id must be specified. If both are specified, only the productId will be used.
Takes in the following parameters
- productId - productId to find related products.
- categoryId - categoryId to find related products.
- type - the type of relations to find (e.g. FEATURED (DEFAULT), UPSELL, CROSSSELL). Implementations may have other specific types of related products.
- cumulativeResults - true (DEFAULT) /false - indicates that the system should add results from the parent categories of the passed in item as well as the current item
- qty - if specified, determines the max-number of results that will be returned; otherwise, all results are returned.
- productsResultVar - if specified, adds the products to the model keyed by this var. Otherwise, uses "products" as the model identifier.
- relatedProductsResultVar - if specified, adds the RelatedProduct(s) to the model keyed by this var. Otherwise, uses "relatedProducts" as the model identifier.
The output from this operation returns a list of PromotableProducts which represent the following.
relatedProduct.product
relatedProduct.promotionMessage.
- Author:
- bpolster
| Methods inherited from class org.thymeleaf.processor.element.AbstractElementProcessor |
doProcess, getMatcher |
| Methods inherited from class org.thymeleaf.processor.AbstractProcessor |
compareTo, getMessage, getMessageForProcessor, getMessageForTemplate, process |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
relatedProductsService
protected RelatedProductsService relatedProductsService
RelatedProductProcessor
public RelatedProductProcessor()
- Sets the name of this processor to be used in Thymeleaf template
getPrecedence
public int getPrecedence()
- Specified by:
getPrecedence in class org.thymeleaf.processor.AbstractProcessor
modifyModelAttributes
protected void modifyModelAttributes(org.thymeleaf.Arguments arguments,
org.thymeleaf.dom.Element element)
- Specified by:
modifyModelAttributes in class AbstractModelVariableModifierProcessor
convertRelatedProductsToProducts
protected List<Product> convertRelatedProductsToProducts(List<? extends PromotableProduct> relatedProducts)
Copyright © 2013. All Rights Reserved.