Zen Cart Logo
Forums / General Questions / Hide product category sidebar when on EZ pages

Hide product category sidebar when on EZ pages

Views: 7,494

Results 1 to 16 of 16
20 Sep 2011, 9:01 PM
#1
hockey2112 avatar

hockey2112

Zen Follower

Join Date:
Jun 2010
Posts:
204
Plugin Contributions:
0

Hide product category sidebar when on EZ pages

Hello,

I have a client who wants to hide their product category sidebar when you are on an EZ Page (I know, I know...). lIs this possible? If so, how?

Thanks!

20 Sep 2011, 10:02 PM
#2
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Hide product category sidebar when on EZ pages

The whole sidebar, or just the categories sidebox?

It can be done with CSS (quick & dirty) or by a small edit in a PHP file (which file depends on exactly what you want to do).

21 Sep 2011, 2:53 AM
#3
mishutkadesign avatar

mishutkadesign

New Zenner

Join Date:
May 2008
Location:
Maryland, USA
Posts:
73
Plugin Contributions:
0

Re: Hide product category sidebar when on EZ pages

I am also working on a client's site, and need to hide specific categories on specific EZ Pages. What is the best way to do it? I saw some discussion about creating a CSS file; would appreciate any help on the best way to accomplish it. Thank you!

Irina

21 Sep 2011, 11:07 PM
#4
hockey2112 avatar

hockey2112

Zen Follower

Join Date:
Jun 2010
Posts:
204
Plugin Contributions:
0

Re: Hide product category sidebar when on EZ pages

gjh42:

The whole sidebar, or just the categories sidebox?

It can be done with CSS (quick & dirty) or by a small edit in a PHP file (which file depends on exactly what you want to do).

Just the sidebox. The EZ Pages sidebox (and a few others) will still be displayed.

22 Sep 2011, 3:53 PM
#5
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Hide product category sidebar when on EZ pages

Quick & dirty: Add to your stylesheet

#pageBody #categories {display: none;}

Proper way: Edit /includes/modules/sideboxes/categories.php; at the top of the file, add

if ($current_page_base != 'page') {

before
$main_category_tree = new category_tree;

and after
require($template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base,'common') . '/' . $column_box_default);
add

}

Save the edited file to /includes/modules/sideboxes/your_template/categories.php

22 Sep 2011, 4:13 PM
#6
mishutkadesign avatar

mishutkadesign

New Zenner

Join Date:
May 2008
Location:
Maryland, USA
Posts:
73
Plugin Contributions:
0

Re: Hide product category sidebar when on EZ pages

Quick & dirty: Add to your stylesheet
#pageBody #categories {display: none;}

This works great for hiding ALL categories on an EZ page.

What if I needed to hide several, but not all, categories on a page? Not sure of the best way of doing it (client's choice, BTW).

Would greatly appreciate any ideas on how to go about it. I'm quite stuck here :smile:

22 Sep 2011, 4:45 PM
#7
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Hide product category sidebar when on EZ pages

You mean just some of the category links in your categories sidebox? The only way beside new custom coding would be to install Categories Dressing, configure it so that the desired categories were in "groups" (see the readme), and add a rule to your stylesheet like

#pageBody #catGroup23, #pageBody #catGroup47, #pageBody #catGroup69 {display: none;}

22 Sep 2011, 6:20 PM
#8
mishutkadesign avatar

mishutkadesign

New Zenner

Join Date:
May 2008
Location:
Maryland, USA
Posts:
73
Plugin Contributions:
0

Re: Hide product category sidebar when on EZ pages

Yes, that's what I am talking about. Since I can't write my own custom coding, I'll try your second suggestion. I'll be back :smile: Thank you so much for great advice--always!

Irina

22 Sep 2011, 10:29 PM
#9
hockey2112 avatar

hockey2112

Zen Follower

Join Date:
Jun 2010
Posts:
204
Plugin Contributions:
0

Re: Hide product category sidebar when on EZ pages

gjh42:

Quick & dirty: Add to your stylesheet

#pageBody #categories {display: none;}

Proper way: Edit /includes/modules/sideboxes/categories.php; at the top of the file, add

if ($current_page_base != 'page') {

before
$main_category_tree = new category_tree;

and after
require($template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base,'common') . '/' . $column_box_default);
add

}

Save the edited file to /includes/modules/sideboxes/your_template/categories.php

This code works, but it does the opposite of what I want to do... it hides the product categories sidebox when you are on a product-related page; I want the products sidebox to be hidden when you are on any of the EZ Pages. :)

Possible?

22 Sep 2011, 10:42 PM
#10
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Hide product category sidebar when on EZ pages

Exactly how did you copy the code into your file? As written here, it will only show the sidebox if $current_page_base is NOT 'page'.

22 Sep 2011, 10:50 PM
#11
hockey2112 avatar

hockey2112

Zen Follower

Join Date:
Jun 2010
Posts:
204
Plugin Contributions:
0

Re: Hide product category sidebar when on EZ pages

gjh42:

Exactly how did you copy the code into your file? As written here, it will only show the sidebox if $current_page_base is NOT 'page'.

My code now looks like this:

if ($current_page_base == 'page') {

    $main_category_tree = new category_tree;

and this...

 $title_link = false;



    require($template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base,'common') . '/' . $column_box_default);

}
22 Sep 2011, 10:54 PM
#12
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Hide product category sidebar when on EZ pages

if ($current_page_base == 'page') {

    $main_category_tree = new category_tree;  
```is wrong. It needs to be != (not equal) instead of == (equal).```php
if ($current_page_base != 'page') {

    $main_category_tree = new category_tree;  
22 Sep 2011, 11:27 PM
#13
hockey2112 avatar

hockey2112

Zen Follower

Join Date:
Jun 2010
Posts:
204
Plugin Contributions:
0

Re: Hide product category sidebar when on EZ pages

gjh42:

if ($current_page_base == 'page') {

$main_category_tree = new category_tree;  

is wrong. It needs to be != (not equal) instead of == (equal).php
if ($current_page_base != 'page') {

$main_category_tree = new category_tree;  

That did the trick! Thanks!
13 Jan 2012, 8:44 AM
#14
nwfap avatar

nwfap

New Zenner

Join Date:
Dec 2011
Posts:
20
Plugin Contributions:
0

Re: Hide product category sidebar when on EZ pages

gjh42:

You mean just some of the category links in your categories sidebox? The only way beside new custom coding would be to install Categories Dressing, configure it so that the desired categories were in "groups" (see the readme), and add a rule to your stylesheet like

#pageBody #catGroup23, #pageBody #catGroup47, #pageBody #catGroup69 {display: none;}

GJH - You're advise has been great in helping me set up my zen cart. I'm working with your category dressings mod to style my site category navigation and I'm also using the multsite model. I've got several categories for my other sites that I don't want to show up in the navigation on my primary site. Here is a link:

http://nwfapco.com/index.php?main_page=index&cPath=1&zenid=0hl8kfftts9ipmn0p3mai27oo0

Basically you can see the categories on the right side navigation have many more than are being displayed on actual site. How could I basically hide the "Real Estate Signs" Category and the sub categories? I'd like to hide all the categories for all my other sites.

Thanks!

NWFAP

23 Oct 2019, 11:39 PM
#15
nick1973 avatar

nick1973

Totally Zenned

Join Date:
Sep 2008
Location:
Cleethorpes
Posts:
1,230
Plugin Contributions:
3

Re: Hide product category sidebar when on EZ pages

I want to display a sidebox containing a banner on EZ Pages only. NOT everywhere else on the site. So what is the method for that?

I have this but this displays the banner everywhere else except EZ Pages

<?php if ($current_page_base != 'page') {  $show_new_sidebox = true; if ($show_new_sidebox == true){   require($template->get_template_dir('tpl_venbanner_sidebox.php',DIR_WS_TEMPLATE,   $current_page_base,'sideboxes'). '/tpl_venbanner_sidebox.php');   $title =  BOX_HEADING_NEW_SIDEBOX;   $left_corner = false;   $right_corner = false;   $right_arrow = false;   require($template->get_template_dir($column_box_default, DIR_WS_TEMPLATE,   $current_page_base,'common') . '/' . $column_box_default); }}?>

I've obviously tried it like this

if ($current_page_base = 'page')

But that just displays it everywhere.

I could of course use CSS but I want to avoid that if possible.

24 Oct 2019, 11:28 AM
#16
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,100
Plugin Contributions:
56

Re: Hide product category sidebar when on EZ pages

Try, instead

if ($current_page_base =[B]=[/B] 'page')  

or, even better

if ($current_page_base =[B]= FILENAME_EZPAGES[/B])  

With a single =, that statement was an assignment that always evaluated to 'true'.