The following code sample creates new identifiers in the out-of-the-box filter map for calls made to the getCollection and productListing endpoints. The new identifier for the getCollection endpoint is customIdentifer1 and the response filter key that is returned for it is customFilterKey1. The new identifier for the productListing endpoint is customIdentifer2 and the response filter key that is returned for it is customFilterKey2.

define(

  //-------------------------------------------------------------------
  // DEPENDENCIES
  //-------------------------------------------------------------------
  ['ccStoreConfiguration'],

  //-------------------------------------------------------------------
  // Module definition
  //-------------------------------------------------------------------
  function(CCStoreConfiguration) {

    'use strict';

    return {
      onLoad : function() {

        console.log("Loading Application Level JS");

           var priorityList = ["endpoint","page","identifier"];

           var newFilterMap = {
           "getCollection":{
              "megaMenuNavigation": {"ccFilterConfigKey": "categoryNavData"},
              "categoryNavigation": {"ccFilterConfigKey": "categoryNavData"},
              "customIdentifier1": {"ccFilterConfigKey": "customFilterKey1"}
            },
            "listProducts":{
              "productListingData": {"ccFilterConfigKey": "PLPData"},
              "collectionWidget": {"ccFilterConfigKey": "collectionData"},
              "getProductData": {"ccFilterConfigKey": "productData"},
              "getProductDataAndRedirect": {"ccFilterConfigKey": "productData"},
              "customIdentifier2": {"ccFilterConfigKey": "customFilterKey2"}
            }
          };
          CCStoreConfiguration.getInstance().updateFiltersToUse(newFilterMap);
      },
    }
  }
);

Note that, when you override the filter map, the top-level objects you define completely replace any existing top-level objects. In other words, if you created a new filter map that looked like this:

// This code overwrites the getCollection top-level object entirely
var newFilterMap = {
  "getCollection":{
    "customIdentifier1": {"ccFilterConfigKey": "customFilterKey1"}
  },
};

You would lose the megaMenuNavigation and categoryNavigation identifiers defined out of the box for the getCollection top-level object. However, the listProducts top-level object would remain unchanged because no new top-level object definition for it has been introduced. For this reason, you should be careful to include the out-of-the-box identifiers, shown earlier, along with any new identifiers you create unless you explicitly intend to overwrite them.


Copyright © 1997, 2017 Oracle and/or its affiliates. All rights reserved. Legal Notices