Class AddSortLinkProcessor

java.lang.Object
org.broadleafcommerce.presentation.dialect.AbstractBroadleafAttributeModifierProcessor
org.broadleafcommerce.core.web.processor.AddSortLinkProcessor
All Implemented Interfaces:
org.broadleafcommerce.presentation.dialect.BroadleafAttributeModifierProcessor, org.broadleafcommerce.presentation.dialect.BroadleafProcessor

@Component("blAddSortLinkProcessor") @ConditionalOnTemplating public class AddSortLinkProcessor extends org.broadleafcommerce.presentation.dialect.AbstractBroadleafAttributeModifierProcessor

A Thymeleaf processor that generates a search query href that will reflect the current search criteria in addition to the requested sort string

This is intended to be used in an anchor tag:

 
  <a blc:addsortlink="price">Sort By Price</a>
 
 

Produces:

 
  <a class="asc" href="http://mysite.com/category?sort=price+asc">Sort By Price</a>
 
 

This sort link can then be picked up by the BroadleafCategoryController to actually translate search queries based on that query parameter. If there is no sort active on the request then this will print out a link to sort ascending. Otherwise the link will output the non-active sort (so that you can switch between them).

Author:
apazzolini
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected boolean
     

    Fields inherited from interface org.broadleafcommerce.presentation.dialect.BroadleafProcessor

    DEFAULT_PRECEDENCE, DEFAULT_PREFIX
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.broadleafcommerce.presentation.model.BroadleafAttributeModifier
    getModifiedAttributes(String tagName, Map<String,String> tagAttributes, String attributeName, String attributeValue, org.broadleafcommerce.presentation.model.BroadleafTemplateContext context)
     
     
    int
     

    Methods inherited from class org.broadleafcommerce.presentation.dialect.AbstractBroadleafAttributeModifierProcessor

    getPrefix, useSingleQuotes

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • allowMultipleSorts

      protected boolean allowMultipleSorts
  • Constructor Details

    • AddSortLinkProcessor

      public AddSortLinkProcessor()
  • Method Details

    • getName

      public String getName()
    • getPrecedence

      public int getPrecedence()
      Specified by:
      getPrecedence in interface org.broadleafcommerce.presentation.dialect.BroadleafProcessor
      Overrides:
      getPrecedence in class org.broadleafcommerce.presentation.dialect.AbstractBroadleafAttributeModifierProcessor
    • getModifiedAttributes

      public org.broadleafcommerce.presentation.model.BroadleafAttributeModifier getModifiedAttributes(String tagName, Map<String,String> tagAttributes, String attributeName, String attributeValue, org.broadleafcommerce.presentation.model.BroadleafTemplateContext context)