ccrz.ccLogicPIFetchEntitled.fetchSpecFilters

Evaluate any specs and spec values included in the input map for an extra layer of filtering entitled products. This method invokes the ccrz.ccApiSpec.fetchProductSpecIndices method to query product spec index records and return a map of specs and entitled products that have values for those specs.

Compatibility

This reference applies to:

Release Managed Package Version API Version
B2B Commerce for Visualforce Winter ’21 4.13 12
B2B Commerce for Visualforce Spring ’20 4.12 11
B2B Commerce for Visualforce Summer ’19 4.11 10
B2B Commerce for Visualforce Spring ’19 4.10 9
B2B Commerce for Visualforce Summer ’18 4.9 8

Signature

global virtual Map<String, Object> fetchSpecFilters(Map<String, Object>)

Inputs (Required)

This method accepts the working Map<String, Object> from the ccrz.ccLogicPIFetchEntitled.processInput method.

This method requires the following key in the working map:

ccrz.ccApiProductIndex.PRODUCT_SPEC_FILTERS
List<Map<String, Object>> or List<Object> of specs and spec values to pass to the ccrz.ccApiSpec.PRODUCT_SPEC_INDICES key for the ccrz.ccApiSpec.fetchProductSpecIndices method. Include each spec's ID and the values that you want to filter by, such as:
[ {
    "specValues" : [ {
        "value" : "Blue"
    } ],
    "sfid" : "a1h6A00000045s5QAA"
} ]

If you specify multiple values for the same spec, the method applies an OR condition for evaluating all values.

Note

For a spec where Filter Type is Slider, you can specify a filterMin and filterMax range for filtering:

[ {
    "sfid" : "a1h6A00000045s5QAA",
    "filterMin" : "1.0",
    "filterMax" : "10.0"
} ]

This method checks the value of the Spec Value Query Limit setting of the Product List storefront configuration module. By default, the method queries at most 20,000 spec values. You can override this default value with a custom limit. The complexity of your product data can also affect the scope of the query, regardless of a limit that you specify.

Note

Outputs

This method returns the working Map<String, Object>, and sets the following key:

ccrz.ccApiProductIndex.PRODUCT_FILTERS
Map<String, List<String>> that relates each matching spec ID with a list of entitled product IDs that have spec values for that spec.