Totally Zenned
- Join Date:
- Jun 2009
- Location:
- Orange County, California
- Posts:
- 547
- Plugin Contributions:
- 3
Show/Hide sideboxes based on page
kezan98,
There's an easy CSS fix on this thread:
https://www.zen-cart.com/forum/showthread.php?t=76543
Views: 43,781
Totally Zenned
kezan98,
There's an easy CSS fix on this thread:
https://www.zen-cart.com/forum/showthread.php?t=76543
Zen Follower
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.
Totally Zenned
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.
Zen Follower
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
New Zenner
Is there a way I can turn off a right sidebox for just one particular ez-page?
Many thanks,
Neil
Deceased
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:
New Zenner
Thanks so much Frank...the ability to do that right in admin makes life so easy!
Much appreciated!
Deceased
neilg:
Thanks so much Frank...the ability to do that right in admin makes life so easy!
Much appreciated!
My pleasure :smile:
Zen Follower
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.
Oba-san
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);}
?>
Zen Follower
Thanks Ajeh. It worked perfectly!:yes:
Oba-san
You are most welcome ... thanks for the update that this is working for you ... :smile:
Totally Zenned
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);
}
?>
Black Belt
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?
Black Belt
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;
Totally Zenned
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. =)
Black Belt
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);
//}
?>
Black Belt
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...
Totally Zenned
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.
Totally Zenned
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:
Tell staff why this post should be reviewed.