How to show the items based on the subsidiary in PLP page using search API without causing a break in page numbers and page count

We can use this solution to show only the items that are available in the customer subsidiary without causing a page break or item count break.

_.extend(ProfileModel.prototype, {
		  //This function is used to update the searchAPI based on the subsidery.
		  getSearchApiUrl: function () {
let profile = ProfileModel.getInstance();
		let subsidiary = profile.get("subsidiary");
		let allowedSubsidiaries = {
		  1: "custitem141",
		  17: "custitem144",
		  2: "custitem150",
		  8: "custitem146",
		  12: "custitem148",
		  11: "custitem142",
		};
			if (
			  Configuration.getRegistrationType() !== "disabled" &&
			  (Configuration.get("siteSettings.requireloginforpricing", "F") ===
				"T" ||
				Configuration.get("siteSettings.siteloginrequired", "F") ===
				"T") &&
			  this.get("isLoggedIn") === "T"
			) {
			  let url = Utils.getAbsoluteUrl("searchApi.ssp") + '?' + allowedSubsidiaries[subsidiary] + '=true';
			  return url;
			}
			return "/api/items";
		  },
		});

Leave a comment

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