Link Topic to Subcategory

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
6 years ago
Given a Category structure of:

My Playground
My Playground => What is My Playground?
My Playground => Sandboxes
My Playground => Monkey Bars
My Playground => See Saws

How can I best link "What is My Playground?" to a Topic page instead of a Product grid but retain default behavior for the remaining subCategories (they link to their respective Product grids)?

Is this possible without touching code?
6 years ago
Hi,

kramffud wrote:
Is this possible without touching code?

I suppose, not. But change is small, so you do not need to worry.

If I will have something like that, I will do something like below:
First go to Admin/System/Templates/Category templates and create new

Name like you want, for example: Topic in Category
View path (anything what you want, for example): TopicCategoryTemplate.ProductsInGridOrLines

Than open your Themes folder, look for Views/Catalog/CategoryTemplate.ProductsInGridOrLines.cshtml and make copy, which you will rename as you define it at the view path above.
Please note, if your theme do not have that file, you may copy it from default view folder.

Now, you may edit TopicCategoryTemplate.ProductsInGridOrLines.cshtml file, and remove all, which you do not need to show on that page. You need to add
@Html.Action("TopicBlock", "Topic", new { systemName = "SYSTEM NAME FOR TOPIC PAGE HERE" })

For example, I would leave only breadcumb section and

<div class="page category-page">
    <div class="page-body">
        @Html.Action("TopicBlock", "Topic", new { systemName = "SYSTEM NAME FOR TOPIC PAGE HERE" })
    </div>
</div>


The last thing, is to apply that category template to specific category. So open your category at the admin panel, and you may find "Category template" dropdown field. Just assign your new template and save.

All done.

Regards,
Tomasz
3 years ago
How can I give link of view page to category menu?
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.