To properly set the priority of a facet, or the way the facet is arranged on the shopping page in SuiteCommerce Advanced (SCA) Denali, a change should be made to the Facets.FacetedNavigation.View.js file of the Facets module.
- On the SCA Denali folder, create a new folder under the custom Module folder.
- Name this folder FacetsOverride@1.0.0
- Copy all the files from the original Facets@2.0.8 module folder to the newly created folder on step #2.
- Edit the Facets.FacetedNavigation.View.js file and replace line #63 with the following line of code:
return (translator.getFacetConfig(b.url || b.id).priority || 0) - (translator.getFacetConfig(a.url || a.id).priority || 0);
5. Save the file
6. Edit and save the ns.package.json file under the custom Modules folder by adding the following line below the last entry:
"overrides": {
"suitecommerce/Facets@2.0.8/JavaScript/Facets.FacetedNavigation.View": "JavaScript/Facets.FacetedNavigation.View"
}
7. Instruct the distribution file (distro.json) to read from the new module by adding the following line below, “suitecommerce/Facets”: “2.0.8”, and save:
"<name of your custom Module Folder>/FacetsOverride": "1.0.0",
8. Open a command prompt window and point to the directory of the SCA Denali folder
9. Run gulp local
10. Verify the changes on the local site. Facets should now be arranged based on the priority set on the SC.Shopping.Configuration.js file