You are here:  » Category Hierarchy Menu


Category Hierarchy Menu

Submitted by Keeop on Fri, 2016-06-10 14:28 in

Hi David,

Just wondering, is there a way of formatting the Category Hierarchy drop down to have more than one column? I have about 20-30 base categories on some sites and this means they drop off the page. Is there a way to auto-format the drop-down so it moves on to a new column when the drop down depth has reached the bottom of the page?

Cheers.
Keeop

Submitted by support on Sat, 2016-06-11 09:01

Hello Keeop,

I'll set-up a very large hierarchy on my test server first thing next week and work something out that will collapse / expand nicely across all device sizes. I'm wondering, for example, about having the next level load into the same container instead of into a sub-menu - I'll have a go and see what works..!

Cheers,
David.
--
PriceTapestry.com

Submitted by Keeop on Sun, 2016-06-12 09:09

Thanks David, sounds good!

Whilst you're working on that, could you work in another slight change? At the moment, clicking on a parent category in the menu only opens the list of child items. Can this be amended to not only open any child menu items but also load in the search results for that parent category?

Cheers.
Keeop

Submitted by support on Mon, 2016-06-13 08:46

Hi Keeop,

For a very large hierarchy, and where you'd like to show parent level search results as the user navigates down the hierarchy, one option would be to use the normal Category A-Z and modify categories.php to pull in search results for the parent category, which is straight forward to do.

If you'd like to give this a go start with a copy of search.php and save it as searchcode.php. In the new file, look for the following code at line 522:

  require("html/header.php");

...and DELETE that line and everything else until the end of the file, just leaving the closing PHP tag at the end. This file can now be called in from elsewhere.

Then in categories.php, look for the following code at line 101:

  if (isset($atoz)) require("html/atoz.php");

...and REPLACE with:

  if (isset($atoz)) require("html/atoz.php");
  if ($path)
  {
    $_GET["q"] = "category:".$path;
    require("searchcode.php");
    if (isset($searchresults)) require("html/searchresults.php");
  }

If all looking good, finally in html/menu.php look for the following code at line 21:

<?php if (isset($config_useCategoryHierarchy) && $config_useCategoryHierarchy): ?>

...and REPLACE with:

<?php if (FALSE): ?>

The menu bar will then show the link to /category/ for Category A-Z instead of the drop-down menu...

Hope this helps!

Cheers,
David.
--
PriceTapestry.com