Set the order of size option in PDP page

  • Updated the size of the matrix option on the PDP page to display it in the ascending order. 
  • The new order now displaying is SM, MD, LG, XL, 2X, 3X, 4X, 5X, 6X. 
  • Created an extension named setMatrixOrder with version 1.0.0 and vendor name JJ to perform the update. 
  • Extended the ‘ProductViews.Option.View’ to update the matrix option in the ascending order then returned the context with updated value. 
	_.extend(ProductViewsOptionView.prototype, {

					getContext: _.wrap(ProductViewsOptionView.prototype.getContext, function (fn) {

						var originalRet = fn.apply(this, _.toArray(arguments).slice(1));
						var optionarray = originalRet.values;
						//console.log("optionarray", optionarray);
						var sortoption = _.sortBy(optionarray, obj => obj.internalId);
						//console.log("sortoption", sortoption);
						//console.log("originalRetnew", originalRet);
						originalRet.values = sortoption;
						return originalRet;

					})
				});

Leave a comment

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