Hide Sub Categories on Categories Page

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
6 years ago
Hi all, i am having trouble hiding the sub categories image boxes on the categories pages.

for example when i click on one category it has all of the sub categories with their images at the top of the page. i have tried hiding the sub categories however it the hides all of the categories when i got onto the cateogies page.

i want the categories to be displayed on the categories pages however i dont want the sub categories to be displayed.
6 years ago
Try to remove following code from CategoryTemplate.ProductsInGridOrLines.cshtml


@*subcategories*@
        @if (Model.SubCategories.Count > 0)
        {
            <div class="category-grid sub-category-grid">
                <div class="item-grid">
                    @foreach (var item in Model.SubCategories)
                    {
                        <div class="item-box">
                            <div class="sub-category-item">
                                <h2 class="title">
                                    <a href="@Url.RouteUrl("Category", new { SeName = item.SeName })" title="@item.PictureModel.Title">
                                        @item.Name
                                    </a>
                                </h2>
                                <div class="picture">
                                    <a href="@Url.RouteUrl("Category", new { SeName = item.SeName })" title="@item.PictureModel.Title">
                                        <img alt="@item.PictureModel.AlternateText" src="@item.PictureModel.ImageUrl" title="@item.PictureModel.Title" />
                                    </a>
                                </div>
                            </div>
                        </div>
                    }
                </div>
            </div>
        }


OR

* Create a new category template (clone "CategoryTemplate.ProductsInGridOrLines.cshtml" content), named "CategoryTemplate.ProductsInGridOrLinesWithoutSubCategories.cshtml", without above code.

* Create a new category template in admin, map it with the new template created above.

* Finally, select that new template for the category you don't want to show its sub-categories.
6 years ago
Have same problem.   I select a category from menu, I go to page with three subcategories.   Great... but...  under the three subcategories i get a search grid with products (for all the categories!?)   How do i stop the search grid showing?   I tried the suggestion to check the "Include products from subcategories" and set or not set, I get the search grid showing.   I'm baffled and dont want to drop into the code to fix something i should be able toggle.   V4.00    Maybe a bug in this version?   Any ideas greatly appreciated.
6 years ago
Figured it out so will post :   User error, me :)

In products I specified both a Parent and sub-category.    eg.  "Cannabis" and "Cannabis>>Satvia"   when I removed the first category i no longer got the product showing on the categories.

In other words, each time you give a product a category, it will show up at that node.    Kind of nice in that you can surface products at any category or level you want.

(upvote on that suggestion:  the Forum needs a search option)
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.