You are here:  » categories sidebox


categories sidebox

Submitted by wesse249 on Sat, 2015-11-07 08:54 in

Hello david,

I installed the newest version of your script (with categories and subcategories on the top) on my test domain.

I was wondering if it is possible to place the categories in a box on the left side of the page with under the categories the product filter?

And if its possible that when you click on the main category a new page is loading and then only see the sub categories of that main category? The same if there are subsub categories?

Thanks jan roel

Submitted by support on Mon, 2015-11-09 13:20

Hello Jan,

I've been meaning to create a sidebar version of the Category Hierarchy navigation using Foundation's Accordion class - have a look at;

http://www.webpricecheck.co.uk/catdemo.php

Is it something like that you are after, displayed permanently in a sidebar (can be made desktop only and to render full width at the top on mobile) and then below, and then if on a search result page the filters are displayed vertically and below this point instead of above the results?

Cheers,
David.
--
PriceTapestry.com

Submitted by wesse249 on Mon, 2015-11-09 21:04

Yes almost exactly. Maybe this is a good example: {link saved}

So in the black menu on the top only the main categories. When you click on the main you go to the searchresultpage of the main categorie with al subcategoriess and subsubcategories at the left. At the subcategory page also at the right of the menu a gridview of al categories with a little image. And when you click on a subcategory or subsubcategory you have to go to the productpage in a grid view with the actual subcategory or subsubcategories at the left.

And then the filters vertically and below the category block.

Is this possible or is it very difficult?

Thanks Jan roel

Submitted by support on Tue, 2015-11-10 13:40

Hello Jan,

Taking it step-by-step, the first stage would be to convert the Category drop-down to link the top level categories directly to search results instead of expanding out down the entire tree. To do this, edit html/menu_categories.php and look for the following code at line 14:

  if (database_querySelect($sql3,$rows3))

...and REPLACE with:

  if (FALSE)

This will cause the top level categories to be treated as if they were lowest level sub-categories. Next, these need to link to search results instead of the normal category hierarchy navigation page. To do this, edit .htaccess and look for the following rule at line 20:

RewriteRule ^category/(.*)/$ categories.php?path=$1 [L,B]

...and REPLACE with:

RewriteRule ^category/(.*)/$ search.php?q=category:$1:&rewrite=1&%{QUERY_STRING} [L,B]

With that in place, your top menu should just link each top level category to search results, where you will see a Category filter containing all applicable lower level categories, and without any filter selected will start off by showing all products from the selected top level category and all sub-categories.

Let me know when that's up and running and then I'll help you out with the next step of converting the category filter into a clickable list, with filters displayed below, all together in sidebar alongside search results instead of above...

Cheers,
David.
--
PriceTapestry.com

Submitted by wesse249 on Wed, 2015-11-11 20:22

Hello David,

It's running.

Greetings Jan Roel

Submitted by robdeg on Thu, 2015-11-12 11:35

Hello David.

I have been playing with foundation css for some time but usually i destroy my design :)

If i want a simple sidebar box like in your example http://www.webpricecheck.co.uk/catdemo.php,
for my custom content and ads, what would be the correct code just for the box?

And how to get it not showing for mobile, can u please suggest how i can do that? I use 15/09 version.

Thanks!
Rob

Submitted by wesse249 on Thu, 2015-11-12 12:09

Hello David,

Can you help me with the next steps?

Thanks Jan Roel

Submitted by support on Thu, 2015-11-12 13:40

Hello Rob,

Sure - i've popped it into a separate thread as a number of people will find it useful...

How to add a sidebar for custom content or advertising

Cheers,
David.
--
PriceTapestry.com

Submitted by support on Thu, 2015-11-12 14:07

Hello Jan,

Sure - the search filters collapse into a sidebar nicely with just a little modification. Firstly, edit html/searchfilters.php and using your text editor's Search and Replace function, first DELETE all medium-x class definitions from the script which are:

medium-2 (4 instances)

and

medium-3 (2 instances)

And finally, look for each instance of:

small-6 (2 instances)

...and REPLACE with:

small-12

Finally, edit search.php and look for the following code beginning at line 534:

    if ($config_enableSearchFilters)
    {
      require("html/searchfilters.php");
    }
    require("html/searchresults.php");

...and REPLACE with:

    print "<div class='row'>";
    print "<div class='small-12 medium-2 columns'>";
    require("html/searchfilters.php");
    print "</div>";
    print "<div class='small-12 medium-10 columns'>";
    require("html/searchresults.php");
    print "</div>";
    print "</div>";

I've enabled this on the demo site for the query Panasonic TX. On mobile view, the filters will display exactly as previously - above the search results and initially hidden, brought into view on first click of the "Filter These Results ↓" button...

The final modification to expand out the category filter into a clickable list is slightly more of a code change so as soon as the you have the above up and running nicely, if you could please email me your modified html/searchfilters.php and I'll help you out with the final part...

Cheers,
David.
--
PriceTapestry.com