logo
Welcome to our new AbleCommerce forums. As a guest, you may view the information here. To post to this forum, you must have a registered account with us, either as a new user evaluating AbleCommerce or an existing user of the application. For all questions related to the older version of Gold and earlier, please go to AbleCommerce Gold forum. Please use your AbleCommerce username and password to Login. New Registrations are disabled.

Notification

Icon
Error

Options
Go to last post Go to first unread
IDAutomation  
#1 Posted : Wednesday, October 14, 2020 11:05:27 AM(UTC)
IDAutomation

Rank: Member

Groups: Authorized User, Developers
Joined: 11/13/2018(UTC)
Posts: 23

Thanks: 16 times
Was thanked: 1 time(s) in 1 post(s)
Our review ratings are drawn out 14 decimal places, how can we change this to just 1 or 2 places?

Average rating 9.53846153846154 out of 10 ( based on 39 reviews )

And also how can we show the most recent review first and not the oldest?

UserPostedImage

Wanna join the discussion?! Login to your AbleCommerce Forums forum account. New Registrations are disabled.

shari  
#2 Posted : Wednesday, October 14, 2020 12:33:05 PM(UTC)
shaharyar

Rank: Advanced Member

Groups: Admin, Developers, Registered, HelpDesk, Authorized User
Joined: 10/5/2018(UTC)
Posts: 704

Thanks: 5 times
Was thanked: 113 time(s) in 112 post(s)
I am able to reproduce the issues. Thanks for pointing this out. I am reporting this issue.

To fix, you can follow these steps:

To fix decimal places issue
1- Open \Website\Views\Product\_ProductReviewsPanel.cshtml
2- Search

Code:
<span>@GetResourceString("retail.productreviewspanel.average_rating") @Model.Rating.Value @GetResourceString("retail.productreviewspanel.out_of_10")</span>


3- Replace it with

Code:
<span>@GetResourceString("retail.productreviewspanel.average_rating") @Model.Rating.Value.ToString("0.##") @GetResourceString("retail.productreviewspanel.out_of_10")</span>



To fix the sorting issue

1- Open Website\Controllers\ProductController.cs

2- Search for
Code:
var model = new ProductReviewsPanelModel()
            {
                Show = show,
                ProductId = productId,
                Rating = product.Rating ?? 0,
                TotalReviews = totalReviews,
                IsPaged = isPaged,
                Reviews = new StaticPagedList<ProductReviewModel>(reviews.Select(review => new ProductReviewModel()
                {
                    Id = review.Id,
                    IsApproved = review.IsApproved,
                    Rating = review.Rating,
                    ReviewBody = review.ReviewBody,
                    ReviewDate = review.ReviewDate,
                    ReviewTitle = review.ReviewTitle,
                    ReviewRating = GetReviewRating(review),
                    ReviewerProfile = new ReviewerProfileModel()
                    {
                        Id = review.ReviewerProfile.Id,
                        DisplayName = review.ReviewerProfile.DisplayName,
                        Email = review.ReviewerProfile.Email,
                        EmailVerificationCode = review.ReviewerProfile.EmailVerificationCode,
                        EmailVerified = review.ReviewerProfile.EmailVerified,
                        Location = review.ReviewerProfile.Location
                    }
                }).ToList(), page, pageSize, totalReviews)
            };


3- Replace
Code:
var model = new ProductReviewsPanelModel()
            {
                Show = show,
                ProductId = productId,
                Rating = product.Rating ?? 0,
                TotalReviews = totalReviews,
                IsPaged = isPaged,
                Reviews = new StaticPagedList<ProductReviewModel>(reviews.Select(review => new ProductReviewModel()
                {
                    Id = review.Id,
                    IsApproved = review.IsApproved,
                    Rating = review.Rating,
                    ReviewBody = review.ReviewBody,
                    ReviewDate = review.ReviewDate,
                    ReviewTitle = review.ReviewTitle,
                    ReviewRating = GetReviewRating(review),
                    ReviewerProfile = new ReviewerProfileModel()
                    {
                        Id = review.ReviewerProfile.Id,
                        DisplayName = review.ReviewerProfile.DisplayName,
                        Email = review.ReviewerProfile.Email,
                        EmailVerificationCode = review.ReviewerProfile.EmailVerificationCode,
                        EmailVerified = review.ReviewerProfile.EmailVerified,
                        Location = review.ReviewerProfile.Location
                    }
                }).ToList().OrderByDescending(review => review.ReviewDate), page, pageSize, totalReviews)
            };


4- You will need to compile the code to apply these changes.
thanks 1 user thanked shaharyar for this useful post.
IDAutomation on 10/15/2020(UTC)
shari  
#3 Posted : Wednesday, October 14, 2020 12:40:59 PM(UTC)
shaharyar

Rank: Advanced Member

Groups: Admin, Developers, Registered, HelpDesk, Authorized User
Joined: 10/5/2018(UTC)
Posts: 704

Thanks: 5 times
Was thanked: 113 time(s) in 112 post(s)
Updated:

The issue will be fixed in our upcoming release.

Thanks for your support!
IDAutomation  
#4 Posted : Wednesday, October 14, 2020 12:45:15 PM(UTC)
IDAutomation

Rank: Member

Groups: Authorized User, Developers
Joined: 11/13/2018(UTC)
Posts: 23

Thanks: 16 times
Was thanked: 1 time(s) in 1 post(s)
Thank you!
IDAutomation  
#5 Posted : Thursday, October 15, 2020 8:29:02 AM(UTC)
IDAutomation

Rank: Member

Groups: Authorized User, Developers
Joined: 11/13/2018(UTC)
Posts: 23

Thanks: 16 times
Was thanked: 1 time(s) in 1 post(s)
I implemented this last night and it worked great!
I just changed this one from
Originally Posted by: shari Go to Quoted Post
@Model.Rating.Value.ToString("0.##")

to
@Model.Rating.Value.ToString("0.#")
so the decimal only went out one place :)
IDAutomation  
#6 Posted : Monday, November 2, 2020 10:13:25 AM(UTC)
IDAutomation

Rank: Member

Groups: Authorized User, Developers
Joined: 11/13/2018(UTC)
Posts: 23

Thanks: 16 times
Was thanked: 1 time(s) in 1 post(s)
Not sure why, but our reviews are no longer showing with the newest first?

The code is correct, I checked that it hadn't reverted back.

The only thing we changed since then was updating the general settings page as outlined in this post:
https://www.ablecommerce...tton-in-Terms-Conditions
shari  
#7 Posted : Monday, November 2, 2020 10:48:33 AM(UTC)
shaharyar

Rank: Advanced Member

Groups: Admin, Developers, Registered, HelpDesk, Authorized User
Joined: 10/5/2018(UTC)
Posts: 704

Thanks: 5 times
Was thanked: 113 time(s) in 112 post(s)
Is there any error related to Reviews in error logs?
IDAutomation  
#8 Posted : Monday, November 2, 2020 11:13:07 AM(UTC)
IDAutomation

Rank: Member

Groups: Authorized User, Developers
Joined: 11/13/2018(UTC)
Posts: 23

Thanks: 16 times
Was thanked: 1 time(s) in 1 post(s)
apparently yes, here's what it shows:

An error has occured at https://www.idautomation...2&ProductId=55') UNION ALL SELECT NULL%2CNULL%2CNULL%2CNULL%2CNULL%2CNULL%2CNULL%2CNULL%2CNULL%2CNULL%23&showPanelView=False View less
Exception: Object reference not set to an instance of an object. Stack Trace: at AbleCommerce.Controllers.ProductController.ProductReviewsPanel(ProductReviewsPanelWidgetParams parameters, Int32 productId, Int32 pageSize, Int32 page, Boolean showPanelView) in C:\Data\www.idautomation.com\Controllers\ProductController.cs:line 1841 at lambda_method(Closure , ControllerBase , Object[] ) at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass15.b__12() at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) at System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) at System.Web.Mvc.Controller.ExecuteCore() at System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) at System.Web.Mvc.Async.AsyncResultWrapper.<.cctor>b__0(IAsyncResult asyncResult, Action action) at System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) at System.Web.Mvc.MvcHandler.b__5(IAsyncResult asyncResult, ProcessRequestState innerState) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) at System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
IDAutomation  
#9 Posted : Monday, November 2, 2020 11:21:19 AM(UTC)
IDAutomation

Rank: Member

Groups: Authorized User, Developers
Joined: 11/13/2018(UTC)
Posts: 23

Thanks: 16 times
Was thanked: 1 time(s) in 1 post(s)
Reviewing this a little further, I see each "page" of the review, the dates are in the correct order, but as a whole, they are not taking into effect the reviews in their entirety.

but the errors we are getting are pages and pages of the error message :(

You can see what I'm referring to at https://www.idautomation...l-software/idautomation/
shari  
#10 Posted : Tuesday, November 3, 2020 2:00:41 AM(UTC)
shaharyar

Rank: Advanced Member

Groups: Admin, Developers, Registered, HelpDesk, Authorized User
Joined: 10/5/2018(UTC)
Posts: 704

Thanks: 5 times
Was thanked: 113 time(s) in 112 post(s)
Quote:
Reviewing this a little further, I see each "page" of the review, the dates are in the correct order, but as a whole, they are not taking into effect the reviews in their entirety.


Sorry about that. The fix shared related to sorting wasn't correct. I can share the actual fix that is part of 9.0.3.

Moreover, this is recommended to upgrade to the latest version (9.0.3)

Edited by user Tuesday, November 3, 2020 2:02:39 AM(UTC)  | Reason: Not specified

IDAutomation  
#11 Posted : Tuesday, November 10, 2020 1:16:41 PM(UTC)
IDAutomation

Rank: Member

Groups: Authorized User, Developers
Joined: 11/13/2018(UTC)
Posts: 23

Thanks: 16 times
Was thanked: 1 time(s) in 1 post(s)
Bossman wants to do the update at the beginning of December.
In the interim, is it a quick code fix I can implement myself?
shari  
#12 Posted : Wednesday, November 11, 2020 2:16:18 AM(UTC)
shaharyar

Rank: Advanced Member

Groups: Admin, Developers, Registered, HelpDesk, Authorized User
Joined: 10/5/2018(UTC)
Posts: 704

Thanks: 5 times
Was thanked: 113 time(s) in 112 post(s)
To fix the sorting issue

1- Open Website\Controllers\ProductController.cs

2- Search for
Code:

Code:
reviews = _reviewRepo.Search(productId, BitFieldState.True, "ReviewDate", pageSize, pageIndex * pageSize);


3- Replace with
Code:
reviews = _reviewRepo.Search(productId, BitFieldState.True, "ReviewDate DESC", pageSize, pageIndex * pageSize);


4- You will need to compile the code to apply these changes.
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.