
Scenario
By Default in SCA Rating is showing as Star if want to change that Star into numbe we need to follow the below Solution
Solution
Create a extension
Extend ‘GlobalViews.StarRating.View’
in entry file write the code as shown below.
Entry FIle Code
//To show Review rating of item in PLP page
_.extend(GlobalViewsStarRatingView.prototype, {
getContext: _.wrap(GlobalViewsStarRatingView.prototype.getContext, function (fn) {
var originalRet = fn.apply(this, _.toArray(arguments).slice(1));
var rating=originalRet.value;
var ratingValue = rating.toString();
var dataview=this.attributes[“data-root-component-id”];
if(dataview===’Facets.Browse.View’){
originalRet.ratingValue = ratingValue;
}
return originalRet;
}),
});
Add {{ratingValue}} in TPL file where we want to Show.