Zen Cart Logo
Forums / General Questions / Show/Hide sideboxes based on page

Show/Hide sideboxes based on page

Views: 43,781

Results 121 to 140 of 189
18 May 2010, 3:51 PM
#122
kezan98 avatar

kezan98

Zen Follower

Join Date:
Nov 2007
Location:
UK
Posts:
98
Plugin Contributions:
0

Re: Show/Hide sideboxes based on page

Thanks Jackie

It worked for the first checkout page ```php
#checkoutshippingBody #shoppingcart, #bannerbox, #reviews, #ezpages {display:none;}

but if I try to duplicate it for the pages that follow it does random things like show the shopping cart side box but push it all the way down to the bottom of the coloumn.
18 May 2010, 4:00 PM
#123
jackie_taferner avatar

jackie_taferner

Totally Zenned

Join Date:
Jun 2009
Location:
Orange County, California
Posts:
547
Plugin Contributions:
3

Re: Show/Hide sideboxes based on page

The code should be as follows:

#checkoutshippingBody #shoppingcart, #checkoutshippingBody #bannerbox, #checkoutshippingBody #reviews, #checkoutshippingBody #ezpages {display:none;}

otherwise, you call on the boxes in general, not specifically ones on the checkout page.

18 May 2010, 4:09 PM
#124
kezan98 avatar

kezan98

Zen Follower

Join Date:
Nov 2007
Location:
UK
Posts:
98
Plugin Contributions:
0

Re: Show/Hide sideboxes based on page

Thanks

I think I've got it fixed bar a box that sits at the bottom of the coloumn but I'm not to bothered about that. Thanks you everyone who's helped me out today.

Kerrie

9 Jun 2010, 1:45 AM
#125
neilg avatar

neilg

New Zenner

Join Date:
Dec 2006
Posts:
75
Plugin Contributions:
0

Re: Show/Hide sideboxes based on page

Is there a way I can turn off a right sidebox for just one particular ez-page?

Many thanks,
Neil

9 Jun 2010, 2:16 AM
#126
frank18 avatar

frank18

Deceased

Join Date:
Nov 2007
Location:
Sunny Coast, Australia
Posts:
3,427
Plugin Contributions:
2

Re: Show/Hide sideboxes based on page

neilg:

Is there a way I can turn off a right sidebox for just one particular ez-page?

Many thanks,
Neil

This tutorial may help:

https://www.zen-cart.com/tutorials/index.php?article=233

9 Jun 2010, 2:22 AM
#127
neilg avatar

neilg

New Zenner

Join Date:
Dec 2006
Posts:
75
Plugin Contributions:
0

Re: Show/Hide sideboxes based on page

Thanks so much Frank...the ability to do that right in admin makes life so easy!

Much appreciated!

9 Jun 2010, 2:24 AM
#128
frank18 avatar

frank18

Deceased

Join Date:
Nov 2007
Location:
Sunny Coast, Australia
Posts:
3,427
Plugin Contributions:
2

Re: Show/Hide sideboxes based on page

neilg:

Thanks so much Frank...the ability to do that right in admin makes life so easy!

Much appreciated!

My pleasure :smile:

11 Jun 2010, 4:55 PM
#129
ak6000 avatar

ak6000

Zen Follower

Join Date:
Apr 2010
Posts:
102
Plugin Contributions:
0

Re: Show/Hide sideboxes based on page

Ajeh:

Just curious ... are you trying to turn off individual sideboxes or are you trying to turn off columns? :unsure:

These variables and their values:
$flag_disable_left = true;
$flag_disable_right = true;

are used to control the left and right columns ... and, when placed correctly in the code the whole column will turn off ...

If you want to turn off individual sideboxes, look at how the featured.php sidebox module is written where you see:

// test if box should display
$show_featured= true;

if ($show_featured == true) {

> 
> currently, nothing "controls" or changes that sidebox but the code is there so that you "could" change when this shows such as only show the sidebox when on the main page:
> ```
// test if box should display
  $show_featured= true;

if (!$this_is_home_page) {
  $show_featured= false;
}
  if ($show_featured == true) {

Notice on this sidebox how the IF statement surrounds the whole code ...

Any sidebox where this type of IF does not exist, you can set it up yourself to have similar logic ...

How can I duplicate this logic for "categories sidebox" to turn the categories sidebox off on main page? I tried this on other sideboxes and they all work. but I don't know what should I use in category.php file. I used show_categories = fales; but it did not work.

12 Jun 2010, 1:59 PM
#130
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Show/Hide sideboxes based on page

You can customize the categories sidebox by using your templates and overrides for:

// test if box should display
$show_categories= true;

if ($this_is_home_page) {
$show_categories= false;
}

if ($show_categories == true) {
$main_category_tree = new category_tree;
$row = 0;
$box_categories_array = array();

// don't build a tree when no categories
$check_categories = $db->Execute("select categories_id from " . TABLE_CATEGORIES . " where categories_status=1 limit 1");
if ($check_categories->RecordCount() > 0) {
$box_categories_array = $main_category_tree->zen_category_tree();
}

require($template->get_template_dir('tpl_categories.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_categories.php');

$title = BOX_HEADING_CATEGORIES;
$title_link = false;

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

}
?>

12 Jun 2010, 2:25 PM
#131
ak6000 avatar

ak6000

Zen Follower

Join Date:
Apr 2010
Posts:
102
Plugin Contributions:
0

Re: Show/Hide sideboxes based on page

Thanks Ajeh. It worked perfectly!:yes:

12 Jun 2010, 4:48 PM
#132
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Show/Hide sideboxes based on page

You are most welcome ... thanks for the update that this is working for you ... :smile:

26 Sep 2010, 9:52 AM
#133
joyjoy avatar

joyjoy

Totally Zenned

Join Date:
Sep 2010
Posts:
611
Plugin Contributions:
0

Re: Show/Hide sideboxes based on page

Help! Help! Please...

I have added a sidebox to my site that I want to remain throughout my site. I don't understand the php enough to know what I have to add/remove.

Thank you.

  if (($_GET['main_page'] != FILENAME_LOGIN && $_GET['main_page'] != FILENAME_CREATE_ACCOUNT && $_GET['main_page'] != FILENAME_PASSWORD_FORGOTTEN)) {

          $login_box[] = TEXT_LOGIN_BOX;

      if ((!$_SESSION['customer_id'])) {
            $title =  BOX_HEADING_LOGIN_BOX;
      } else {
            $title =  BOX_HEADING_LOGGEDIN_BOX;
      }

      require($template->get_template_dir('tpl_login_box.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_login_box.php');

      $left_corner = false;
      $right_corner = false;
      $right_arrow = false;
      $title_link = false;

      require($template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base,'common') . '/' . $column_box_default);
 }
?>
26 Sep 2010, 1:02 PM
#134
gjh42 avatar

gjh42

Black Belt

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

Re: Show/Hide sideboxes based on page

That code will show the box on every page except for the login/create account/my account pages (where it makes no sense). What else did you want? Does your design require that box to stay even on those pages?

26 Sep 2010, 4:42 PM
#135
gjh42 avatar

gjh42

Black Belt

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

Re: Show/Hide sideboxes based on page

By the way, there is a bit of code there that is for an old version of Zen Cart, and is useless for current versions. You can delete these lines and make the file a bit cleaner:```php
$left_corner = false;
$right_corner = false;
$right_arrow = false;

This line IS needed:```php
      $title_link = false;
27 Sep 2010, 9:15 PM
#136
joyjoy avatar

joyjoy

Totally Zenned

Join Date:
Sep 2010
Posts:
611
Plugin Contributions:
0

Re: Show/Hide sideboxes based on page

I want this box to appear on all pages, even the login/registration page. I know it doesn't make sense...but it makes more sense to me to just have it fixed throughout the page than to waste anymore time on the layout issues.

Thanks for the heads up on the dead coding. I'll adjust it. =)

27 Sep 2010, 10:11 PM
#137
gjh42 avatar

gjh42

Black Belt

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

Re: Show/Hide sideboxes based on page

Seems a bit odd to have a layout that is so picky that one sidebox more or less in a sidebar would throw it off, but whatever suits you...
To remove the conditional, comment out this linephp //if (($_GET['main_page'] != FILENAME_LOGIN && $_GET['main_page'] != FILENAME_CREATE_ACCOUNT && $_GET['main_page'] != FILENAME_PASSWORD_FORGOTTEN)) { and its closing }```php
require($template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base,'common') . '/' . $column_box_default);
//}
?>

27 Sep 2010, 10:17 PM
#138
gjh42 avatar

gjh42

Black Belt

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

Re: Show/Hide sideboxes based on page

It sounds like from the other thread where you're asking this same question that it is actually a header box (which uses sidebox tpl coding). That makes sense that you would want to keep it...

27 Sep 2010, 10:21 PM
#139
joyjoy avatar

joyjoy

Totally Zenned

Join Date:
Sep 2010
Posts:
611
Plugin Contributions:
0

Re: Show/Hide sideboxes based on page

That didn't work...

Do you think you can make the adjustment to the code I posted and then repost? Then I can copy and paste it?

Thank you.

27 Sep 2010, 10:24 PM
#140
joyjoy avatar

joyjoy

Totally Zenned

Join Date:
Sep 2010
Posts:
611
Plugin Contributions:
0

Re: Show/Hide sideboxes based on page

The sidebox in the header goes wacky every time the page is viewed in IE. I've heard that there have been positioning issues with IE before. That seems to be the case.

So what I have done is shifted the entire right column up to the top of my page so that my "header box" or "sidebox" is fixed within the column. Now it doesn't move around when the page is viewed in different browsers.

Soooo...that is why I want it to show at all times. =) When it disappears on my login page, my entire right colum shifts up since there is an open space where the login box should be.

Thank you for your help.:smile: