Application modules that need to support price range refinements in their Price dimension (for example, $1 - $10, $10 - $50, and so on) must configure price ranges using one of several methods. The B2CStore
application module configures price ranges so that they are auto-generated based on the prices of individual SKUs. The following section describes this configuration in order to provide an example of one approach to price range refinement generation.
product-sku-output-config.xml
A new sku.priceRange
property is created as a non-auto-generated dimension in CommerceAccelerator/Applications/B2CStore/src/main/config/atg/commerce/endeca/index/product-sku-output-config.xml
:
<item property-name="childSKUs"> <properties> <!-- Properties --> <property name="priceRange" output-name="sku.priceRange" is-dimension="true" autogen-dimension-values="false" is-non-repository-property="true" type="float" multiselect-type="multi-or" property-accessor= "/atg/commerce/endeca/index/accessor/ActivePriceAccessor"/> … … … </properties> </item>
PriceDimensionValueExporter.properties
The PriceDimensionValueExporter
component, included in the DCS
module, is the primary component that implements automatic price range generation. This component is of class atg.endeca.index.dimension.RangedValuesExporter
, which extends atg.endeca.index.PerApplicationExporter
, and it contains a number of configuration settings that control how the price range refinements are generated. The B2CStore
module configures these settings in CommerceAccelerator/Applications/B2CStore/src/main/config/atg/commerce/endeca/index/PriceDimensionValueExporter.properties
:
# The dimension name. dimensionName=product.price_range # The specifier for the parent root dimval. If null, defaults to # dimension name. rootParentSpecifier=/ # The source output property name to create dimvals for sourceOutputPropertyNames=sku.priceRange # The default string for manually specifying which ranges will be # used. # A simple example would be "*:1000,*:100,*:10" # which specifies that the top level should have facets which cover # a range of 1000, the middle 100, and the bottom 10. # # One can also specify sub-ranges. For example: "*:1000,*:100,*:1,,5:5,,20:10" # # As in the first example, it specifies the top range should have facets # that cover a range of 1000, a middle the covers a range of 100, but # the bottom tier is more complex. For low values, ranges should # cover 1, for values starting at 5 a range should cover 5, and # starting at # 10, a range should cover ten. This would result in facets like: # 0-1, 1-2, 2-3, 3-4, 5-10, 10-15, 15-20, 20-30, 30-40, 40-50, 50-60, # etc. defaultFacetDefinitionRangeTiersString=*:10,,0:10,,100:100,,500:250,,1000:500 # Always generate facet ranges, starting at zero. minimumFacetsValue=0.0 # Whether to add localized display names as multi-language synonyms. # This is generally not useful numeric ranges, but may be useful if # use verbal display-names. multiLanguageSynonyms=false # Whether to stop exactly at the maximum encountered value. If true, # no bounded facet will have an ending point higher than the specified # price. If false, facets will end at the next normal boundary. stopExactlyAtMaxValue=false # The dimval.range.comparison_type value. Use decimal for # price-type numbers (the default). Other valid value would be # integer. dimvalNameComparisonType=decimal # If true, use a language suffix ("_en" or "_es", for example) to # construct localized attribute names. If full, uses the complete # locale (such as "_en_US" or "_en_DE_EURO"). useLanguageSuffix=false
ProductCatalogSimpleIndexingAdmin.properties
The PriceDimensionValueExporter
component is added to the indexing job in CommerceAccelerator/Applications/B2CStore/src/main/config/atg/commerce/endeca/index/ProductCatalogSimpleIndexingAdmin.properties
:
phaseToPrioritiesAndTasks+=\ RepositoryExport+=PriceDimensionValueExporter
SchemaExporter.properties
The PriceDimensionValueExporter
component is added as a dimension name provider to CommerceAccelerator/Applications/B2CStore/src/main/config/atg/commerce/endeca/index/SchemaExporter.properties
:
dimensionNameProviders+=\ PriceDimensionValueExporter
ProductCatalogOutputConfig.properties
The /atg/commerce/endeca/index/DynamicPriceValueSynchronization
component (located in DCS) is added to the indexingSynchronizations
property of the CommerceAccelerator/Applications/B2CStore/src/main/config/atg/commerce/search/ProductCatalogOutputConfig
component so that it can monitor price properties and invoke the PriceDimensionValueExporter
after product and SKU records have been generated:
indexingSynchronizations+=\ /atg/commerce/endeca/index/DynamicPriceValueSynchronization
index-config.json
To ensure that the correct indexing configuration properties are set for the new product.price_range
dimension, the following configuration is added to CommerceAccelerator/Applications/B2CStore/src/main/deploy/index_config/index-config.json
:
"product.price_range" : { "displayOrder" : 1, "mergeAction" : "UPDATE", "jcr:primaryType" : "endeca:dimension", "rangeComparisonType" : "FLOAT" }
initial_dval_id_mappings.csv
In order to have consistent price range dimension value IDs every time the deployment template is executed, the CommerceAccelerator/Applications/B2CStore/src/main/deploy/test_data/initial_dval_id_mappings.csv
includes the following configuration:
"product.price_range","/","3494134414" "product.price_range","product.price_range","2323533082" "product.price_range","r0-10","2187310031" "product.price_range","r10-20","566039580" "product.price_range","r20-30","2131962054" "product.price_range","r30-40","2481498198" "product.price_range","r40-50","2961085591" "product.price_range","r50-60","4219068011" "product.price_range","r60-70","3437059647" "product.price_range","r70-80","3588385073" "product.price_range","r80-90","3639965157" "product.price_range","r90-100","2299607508" "product.price_range","r100-200","180223605" "product.price_range","r200-300","3888546018" "product.price_range","r300-400","3560702933" "product.price_range","r400-500","1541355225" "product.price_range","r500-750","4047109018" "product.price_range","r750-1000","839602541" "product.price_range","r1000-1500","1085939743" "product.price_range","r1500-2000","3430508338" "product.price_range","r2000-2500","3885777590" "product.price_range","r2500-unbounded","3470947321"
GuidedNavigation content.xml
To include the product.price_range
dimension in the Guided Navigation cartridge, it is added to CommerceAccelerator/Applications/B2CStore/src/main/deploy/import/content/Web/Guided Navigation/Default Guided Navigation/content.xml
. To ensure that the price ranges within the product.price_range
dimension are displayed in a logical order in the store, they need to be ordered properly in the boostRefinements
property.
<ContentItem type="Navigation"> <TemplateId>RefinementMenu</TemplateId> <Name>Price Range</Name> <Property name="dimensionName"> <String>product.price_range</String> </Property> <Property name="dimensionId"> <String>3494134414</String> </Property> <Property name="sort"> <String>default</String> </Property> <Property name="showMoreLink"> <Boolean>false</Boolean> </Property> <Property name="moreLinkText"> <String>Show More Refinements...</String> </Property> <Property name="numRefinements"> <String>10</String> </Property> <Property name="maxNumRefinements"> <String>200</String> </Property> <Property name="boostRefinements"> <List name="boost" xmlns="http://endeca.com/schema/xavia/2010"> <Item class="com.endeca.infront.navigation.model.DvalSpec"> <Property name="id">2187310031</Property> <Property name="name">$0.00 - $9.99</Property> </Item> <Item class="com.endeca.infront.navigation.model.DvalSpec"> <Property name="id">566039580</Property> <Property name="name">$10.00 - $19.99</Property> </Item> <Item class="com.endeca.infront.navigation.model.DvalSpec"> <Property name="id">2131962054</Property> <Property name="name">$20.00 - $29.99</Property> </Item> … <Item class="com.endeca.infront.navigation.model.DvalSpec"> <Property name="id">3885777590</Property> <Property name="name">$2,000.00 - $2,499.99</Property> </Item> </List> </Property> <Property name="buryRefinements"> <aaa:List xmlns:aaa="http://endeca.com/schema/xavia/2010"/> </Property> <Property name="displayNamePropertyAlias"> <String>displayName</String> </Property> </ContentItem>