Jump to content

Display subcategories on main category page


Recommended Posts

When I browse to my subcategories I see products, but when I use the breadcrumbs to get to the top level category, I get a blank page (unless I add a picture or hard coded text ) that says "There are no products in this category".  I don't want my products to show in this main category, ideally I would prefer this top level category to launch my custom cms page that I launch from my menu to select the subcategories, but if this is not possible, can this category page at least list the subcategories? 

 

Otherwise if you click on the breadcrumbs up to this level, you have to either continue to the "HOME" level or click on the link from my menu to get back to the cms page to select the appropriate subcategory.

 

 

Link to comment
Share on other sites

Yes, I am using a theme I purchased, and was not aware that subcategories should display by default.  I guess I will have to open a ticket with them about them not showing.  Unless you are aware of something to check?
 

I am looking for other options, at this point I am not using the menu to display my category/subcategory selection for navigation, I am using a custom CMS page that is accessed via the menu on my page.  Is it possible to link the top level category in the breadcrumbs to a custom cms page, rather than the default category?  I was shown how to do this for the Home link, but not the top level category

 

Thanks

Link to comment
Share on other sites

Hi,

Well breadcrumb is generated by the Tools core class, so you might have to edit that one if you want to achieve that kind of result.

As for subcategories, there might be a switch considering it's a custom theme, so you can go through the readme, and open a ticket if you don't find anything

Link to comment
Share on other sites

You were right, they suggested to set my site back to the default theme to test the behavior on that page, and when I did, all the subcategories showed on that category page, so they are now going to work on fixing that issue with their theme.  However I am interested in the edit of the Tools core class you mention, as I would much prefer it to just launch my cms page and bypass that main category anyway.  Where is this Tools Core class located?

 

Thanks

Link to comment
Share on other sites

Ok, I found what I believe to be the correct portion of the code that determines the path for the clicked breadcrumb, but I am not sure on the syntax for hard coding a URL for category =3, as that is the main category and I want that CMS page to launch in place of it launching the category.  Any suggestions would be appreciated.

 

    foreach ($categories as $category)
    {
     $full_path .=
     (($n < $n_categories || $link_on_the_item) ? '<a href="'.Tools::safeOutput($context->link->getCategoryLink((int)$category['id_category'], $category['link_rewrite'])).'" title="'.htmlentities($category['name'], ENT_NOQUOTES, 'UTF-8').'">' : '').
     htmlentities($category['name'], ENT_NOQUOTES, 'UTF-8').
     (($n < $n_categories || $link_on_the_item) ? '</a>' : '').
     (($n++ != $n_categories || !empty($path)) ? '<span class="navigation-pipe">'.$pipe.'</span>' : '');
    }

    return $full_path.$path;
   }

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...