Rank: Advanced Member
Groups: Authorized User, Developers, Registered, HelpDesk Joined: 1/7/2019(UTC) Posts: 112
Thanks: 1 times Was thanked: 2 time(s) in 2 post(s)
|
I would like to use the Featured Category Grid Widget to display a selection of Categories, but in a static order.
Is it possible for us to change the behaviour of this widget to NOT Random Sort the displayed categories on each page load? We would like the categories to be shown in the same order at all times, using the order that they are created in the Admin side.
Thanks!
-Jeff
|
|
|
|
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)
|
You have to make changes in controller to achieve the requirements. Please follow the steps: 1- Open category controller file \Website\Controllers\CategoryController.cs 2- Search for the code Code:var categories = _categoryRepo.GetRandomFeaturedCategories(parameters.PublicOnly, parameters.Size)
.Select(category => new CategoryModel()
{
Id = category.Id,
Name = category.Name,
NavigateUrl = category.NavigateUrl,
ThumbnailUrl = category.ThumbnailUrl,
ThumbnailAltText = category.ThumbnailAltText,
Summary = category.Summary,
}).ToList();
3- Replace it with Code:var categories = _categoryRepo.GetFeaturedCategories(parameters.PublicOnly, maximumRows: parameters.Size)
.Select(category => new CategoryModel()
{
Id = category.Id,
Name = category.Name,
NavigateUrl = category.NavigateUrl,
ThumbnailUrl = category.ThumbnailUrl,
ThumbnailAltText = category.ThumbnailAltText,
Summary = category.Summary,
}).ToList();
4- Compile the project This is a server side change so you must use the code after compilation.
|
|
|
|
Rank: Advanced Member
Groups: Authorized User, Developers, Registered, HelpDesk Joined: 1/7/2019(UTC) Posts: 112
Thanks: 1 times Was thanked: 2 time(s) in 2 post(s)
|
|
|
|
|
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.
Important Information:
The AbleCommerce Forums uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close