Remove Category from SCA website using code

Jira Code: TC – 106

We can show specific categories to websites if we are using same website instance for multiple websites. In order to do that we need to edit the header menu tree and side bar of categories page. Files will be updating are Categories.js and \Facets.FacetedNavigationItemCategory.View.js.

Categories.js


	,	makeNavigationTab: function (categories)
		{
			var result = []
			,	self = this;

			_.each(categories, function (category)
			{
				var href = category.fullurl;

				// console.log('category', category);

				var	tab = {
						'href': href
					,	'text': category.name
					,	'data':
						{
							hashtag: '#' + href
						,	touchpoint: 'home'
						}
					,	'class': 'header-menu-level' + category.level + '-anchor'
					,	'data-type': 'commercecategory'
					, 'thumbnailurl': category.thumbnailurl
					};

				if (category.categories)
				{
					tab.categories = self.makeNavigationTab(category.categories);
				}			
				if( category.metakeywords!='OW')
                    {
                    //ravin: added to distinguish category b/w website
                      result.push(tab);  
                    }
				//result.push(tab);
			});
            
			return result;
		}
Facets.FacetedNavigationItemCategory.View.js

 ,	getContext: function()
		{
			var showFacet = this.categories.length
			,	values = []
			,	self = this
			,	showMax = Configuration.get('categories.sideMenu.showMax')
			,	uncollapsible = Configuration.get('categories.sideMenu.uncollapsible')
			,	collapsed = Configuration.get('categories.sideMenu.collapsed');

			_.each(this.categories, function (category)
			{
				values.push({
					displayName: category.name
				,	label: category.name
				,	link: category.fullurl
				,   metakeywords: category.metakeywords
				,	isActive: category.fullurl === self.categoryUrl
				});
			});

			var max = showMax || values.length
			,	displayValues = _.first(values, max)
			,	extraValues = _.rest(values, max);

			var breadcrumb = this.model && (this.model.get('breadcrumb') || [])
			,	parentName = '';

			if (breadcrumb && breadcrumb.length)
			{
				var index = breadcrumb.length > 1 ? breadcrumb.length - 2 : breadcrumb.length - 1;
				parentName = breadcrumb[index].name;
			}
			displayValues = displayValues.filter(function( obj ) {
            return obj.metakeywords !== 'OW';
              });
            extraValues = extraValues.filter(function( obj ) {
            return obj.metakeywords !== 'OW';
              }); 		

Leave a comment

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