nop 2.2 set default product view to list

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
12 years ago
Nop 2.2 set default product view to list

I’ve already done the following but I don’t know what files to actually change to implement the “List view from the Grid View”

1.  Go to admin area > configuration > settings > all settings
2.  Find ‘CatalogSetting.AllowProductVewModeChanging’ set value to “false”

I don’t know what files to change now to make the product page view to list instead of Grid, can someone tell me which files and possibly which line to change.  

( I found instructions from another forum page to change this for version 2x but can’t find the same files in 2.2)

Thanks so much!
12 years ago
I think the easiest way is in Nop.Web/Controllers/CatalogController, action Category(int categoryId, CatalogPagingFilteringModel command)


//view mode
model.AllowProductViewModeChanging = _catalogSettings.AllowProductViewModeChanging;
if (model.AllowProductViewModeChanging)
{
     var currentPageUrl = _webHelper.GetThisPageUrl(true);
     //list
     model.AvailableViewModes.Add(new SelectListItem()
     {
          Text = _localizationService.GetResource("Categories.ViewMode.List"),
          Value = _webHelper.ModifyQueryString(currentPageUrl, "viewmode=list", null),
          Selected = command.ViewMode == "list"
     });
     //grid
     model.AvailableViewModes.Add(new SelectListItem()
     {
          Text = _localizationService.GetResource("Categories.ViewMode.Grid"),
          Value = _webHelper.ModifyQueryString(currentPageUrl, "viewmode=grid", null),
          Selected = command.ViewMode == "grid"
     });
}


I think it normally has grid first but if you switch them, List will be the default until the customer chooses one.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.