Close

Setting number of home-page-category-grid items

mihailo82
9 years ago
#8237 Quote
Avatar
  • 3
Please, 

Could anyone help me with setting number of items in home-page-category-grid div on home page.
Thanks a lot.
Boyko
9 years ago
#8245 Quote
Avatar
  • Moderator
  • 1570
mihailo82 wrote:
Please, 

Could anyone help me with setting number of items in home-page-category-grid div on home page.
Thanks a lot.


Hi mihailo82,

Unfortunately there is no setting in nopCommerce that can set the number of visible categories on the home page. nopCommerce shows all the categories that are marked with "Show on home page".
But you can limit them directly in the Razor view file.
For example if you want to show maximum 3 categories you can do it like this.
Open this file: Themes\Smart\Views\Catalog\HomepageCategories.cshtml

Change this line:

@foreach (var item in Model)


To be:

@foreach (var item in Model.Take(3))


You can change the number to meet your needs.
Regards,
Nop-Templates.com Team
mihailo82
9 years ago
#8250 Quote
Avatar
  • 3
Thank you for quick answer. Although, in source code of the home page all top categories are listed, yet only three are visible. My guess is that the problem occurs in style, since backend script reads them from DB, but only three are shown, and i'd like to show them all in rows by three. I use Smart theme.
Thanks.
mihailo82
9 years ago
#8251 Quote
Avatar
  • 3
Thanks, I got it solved. It was some style problem, few modifications in CSS and now it looks like it was meant to be.

Again, thanks for help!
Stefan
9 years ago
#8267 Quote
Avatar
  • Moderator
  • 157
mihailo82 wrote:
Thanks, I got it solved. It was some style problem, few modifications in CSS and now it looks like it was meant to be.

Again, thanks for help!


Hi mihailo82,

I am glad you managed to fix this by yourselves. We have also fixed this and uploaded on our site. If you want you can download the theme again and replace the following files with the one from your downloaded package:

Themes/Smart/Content/css/980.css
Themes/Smart/Content/css/forum.css
Themes/Smart/Content/css/styles.css


and add the following file
Themes/Smart/Content/img/multipad.png

If you want to preserve your fix, you do not need to do the above steps.

Again thank you for your feedback!
Best Regards,

Stefan Hristov
Nop-Templates.com