Error in admin page nopcommerce 3.0

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
11 năm cách đây
After install nopcommerce 3.0, i have get this error when I go to admin page : "Attempted to divide by zero" in PagedList.cs
"
public PagedList(IQueryable<T> source, int pageIndex, int pageSize)
        {
            int total = source.Count();
            this.TotalCount = total;
            this.TotalPages = total / pageSize;

            if (total % pageSize > 0)
                TotalPages++;

            this.PageSize = pageSize;
            this.PageIndex = pageIndex;
            this.AddRange(source.Skip(pageIndex * pageSize).Take(pageSize).ToList());
        }

"
The pageSize is come from
public ActionResult BestsellersBriefReportByQuantityList(GridCommand command)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageOrders))
                return Content("");

            var gridModel = GetBestsellersBriefReportModel(command.Page - 1,
                command.PageSize, 1);
            return new JsonResult
            {
                Data = gridModel
            };
        }


May I know where is the GridCommand from? All item count in command is 0

Anyone know what was the issue, i didnt change anything yet
11 năm cách đây
do we need to add this to all GridCommand:
if ( command.PageSize == 0 )  
{  
    command.PageSize = 10;  
}  

if ( command.Page == 0 )  
{  
    command.Page = 1;  
}
11 năm cách đây
Please see this topic
11 năm cách đây
BTW, could you please add the following code to the <head> of your \Administration\Views\Shared\_AdminLayout.cshtml file
<meta http-equiv="X-UA-Compatible" content="edge"/> 

Let me know if it helps (or not)
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.