The PriceSlider
cartridge allows a Commerce Reference Store shopper to refine the current results list based on the active price of the skus associated with the currently displayed products. The active price is defined as the price that is in effect for the current user on the current site. The PriceSlider
has two controls that indicate a minimum and maximum price. Items whose active price falls within these two values are included in the results list. A shopper can click and drag the minimum or maximum control to alter the price range to be displayed; alternatively, a shopper can drag the entire range up or down. Upon mouse release, a POST request is sent to the server to retrieve the new results list and the page is refreshed.
The PriceSlider
applies an Endeca range filter to the current result set. The range filter is applied through an Nf
URL parameter that gets added to the POST request. The Nf
parameter takes the form of Nf=<record property name>|<function>+<value>
. Because the price slider has two controls, a minimum and maximum, the Nf
parameter takes two different values and uses the between function. For example:
Nf=sku.activePrice|BTWN+105+1148
Note: For more details on the active price, see the Handling Price Data section.
Template
The XML template for the PriceSlider
cartridge, located in <ATG10dir>/CommerceReferenceStore/Store/Storefront/deploy/cartridge_templates/Navigation-PriceSlider.xml
, must be available for use within the GuidedNavigation
cartridge, so its content type is set to Navigation
while its ID is set to PriceSlider
. The Navigation-PriceSlider.xml
file defines one property for the PriceSlider
cartridge, priceProperty
, that is not editable in Experience Manager. This property specifies the record property that the slider should be based on which, in this case, is sku.activePrice
.
Content Item and Handler
The atg.projects.store.assembler.cartridge.PriceSliderContentItem
class represents the content item that the PriceSlider
cartridge returns to the renderer. The PriceSliderContentItem
class has these properties:
filterCrumb
: This property references thecom.endeca.infront.cartridge.model.RangeFilterBreadcrumb
object that is created by thePriceSliderHandler
whenever price slider settings have been applied for the current query. Continue reading below for more information on this object and how it is used.priceProperty
: This property references the record property that the slider is based on which, in this case, issku.activePrice
.sliderMin
: Specifies the lower end point for the price slider.sliderMax
: Specifies the upper end point for the price slider.enabled
: Indicates whether the price slider should be rendered. When this property is set totrue
, the slider is rendered. When it is set tofalse
, it is not rendered. ThePriceSliderHandler
sets this property based on the number of results returned for the query. If 0 or 1 result is returned,PriceSliderHandler
sets this property to false.
The /atg/endeca/assembler/cartridge/handler/PriceSlider
component, which is of class atg.projects.store.assembler.cartridge.handler.PriceSliderHandler
, is responsible for creating and populating the PriceSliderContentItem
object. The PriceSliderHandler
class is an extension of the com.endeca.infront.cartridge.NavigationCartridgeHandler
class and it overwrites the preprocess()
and process()
methods.
The PriceSliderHandler.preprocess()
method creates an MDEX request but does not execute it. The process()
method executes the MDEX request to get the search results. It also retrieves the current com.endeca.infront.navigation.NavigationState
object using the /atg/endeca/assembler/cartridge/manager/NavigationState
component referenced by the PriceSliderHandler
component’s navigationStateProperty
. The NavigationState
object contains the navigation choices that have led to the current result set, including any range filters that have been applied and the properties those range filters have been applied to. If an existing range filter has been applied to the sku.activePrice
property, it is an indicator that the price slider has already been applied to the current result set and the rendering of the price slider must take into account the existing settings. To do this, the PriceSliderHandler
creates a com.endeca.infront.cartridge.model.RangeFilterBreadcrumb
object and populates it with data from the range filter. Specifically, the RangeFilterBreadcrumb
includes:
The name of the property the range filter was applied to, the
sku.activePrice
property.The operation name, in this case,
BTWN
for the between operation.The upper and lower bounds of the range filter.
The PriceSliderHandler
then sets the PriceSliderContentItem.filterCrumb
property to reference this RangeFilterBreadcrumb
object, thereby making the existing slider settings available to the JSP renderer.
The PriceSliderHandler
also sets the slider end points by retrieving the priceSliderMaximumValue
and priceSliderMinimumValue
properties for the currently searched site (or sites) from the Site repository. The priceSliderMaximumValue
and priceSliderMinimumValue
properties are site-specific and can be configured through the Site Administration UI. If the current results come from more than one site, the PriceSliderHandler
uses the lowest priceSliderMinimumValue
and the highest priceSliderMaximumValue
from the sites. If no values have been set, PriceSliderHandler
uses the defaults of 0 and 1500 for the minimum and maximum values, respectively.
Finally, the PriceSliderHandler
evaluates the number of results returned for the query and sets the PriceSliderContentItem.enabled
property to true
if there is more than one result and false
if there is 0 or 1 result.
The PriceSlider
component has the following configurable properties:
storeSitePropertiesManager
: Specifies the component thatPriceSliderHandler
uses to retrieve the names of the site properties that store the slider minimum and slider maximum values.PriceSliderHandler
then queries the sites, uses these names, to get the values. Out of the box, this property is set to/atg/multisite/StoreSitePropertiesManager
.searchedSites
: Specifies the component thatPriceSliderHandler
uses to determine which sites have contributed records to the current results set.siteManager
: Specifies the component thatPriceSliderHandler
uses to retrieve sites from the Site repository.
The PriceSlider
component also inherits a number of properties from the /atg/endeca/assembler/cartridge/handler/NavigationCartridgeHandler
component, through a $basedOn
property configuration. Specifically, PriceSlider
inherits a reference to the /atg/endeca/assembler/cartridge/manager/NavigationState
component that provides information on the shopper’s current navigation state.
JSP Renderer
The store.war/cartridges/PriceSlider/PriceSlider.jsp
page renders the content in the PriceSliderContentItem
object. This renderer retrieves the current price slider settings, if any exist, from the PriceSliderContentItem.filterCrumb
property. It also retrieves the slider end points from the PriceSliderContentItem.sliderMin
and PriceSliderContentItem.sliderMax
properties.