How to Restrict the items from the reorder section based on subsidiaries in my account page.

Based on subsidiary selection the add to cart button will show .

		// reorder items in myaccount page 
			_.extend(ReorderItemsActionsAddToCartView.prototype, {
				template: jj_restrictitems_restrictitems_tpl,
				getContext: _.wrap(ReorderItemsActionsAddToCartView.prototype.getContext, function (fn) {
					let originalRet = fn.apply(this, _.toArray(arguments).slice(1));
					var profile = ProfileModel.getInstance();
					var subsidiary = profile.get('subsidiary');
					var allowedSubsidiaries = {
						1: 'custitem141',
						17: 'custitem144',
						2: 'custitem150',
						8: 'custitem146',
						12: 'custitem148',
						11: 'custitem142'
					};
					
					originalRet.isItemAvailable = this.model.get('item').get(allowedSubsidiaries[subsidiary]);
					
					return originalRet
				})
			});

Leave a comment

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