How to display Hierarchy of categories by using JS

In entry file , we need to allow the level of categories to display .

_.extend(FacetsFacetedNavigationItemCategoryView.prototype, {
					template: jj_categorypage_categorypage_tpl,
					events: _.extend(FacetsFacetedNavigationItemCategoryView.prototype.events, {

						'click .subdiv2': 'hide'
						
					}),
					
					

					getContext: _.wrap(FacetsFacetedNavigationItemCategoryView.prototype.getContext, function (fn) {
						let originalRet = fn.apply(this, _.toArray(arguments).slice(1));
						let categories = {}
						_.each(SC.CATEGORIES, (level2) => {
							if (level2.categories.length > 0) {
								categories.isAvalable = true;
								categories.level2Categories = level2.categories;

							}
						})
						originalRet.categories = SC.CATEGORIES[0].categories;

						return originalRet;
					})
				})

Update the template ,place a categories in the level wise .

Leave a comment

Your email address will not be published. Required fields are marked *