I want to hide the left column for not-logged-in visitors
Hello, I'm trying to hide left column (category, ez pages, info etc.) from the non-registered users, but it is not working.
Searching the forum about this subject I found similar topic which is also unresolved, so I tought to report the problem.
I am using fresh ZC v1.3.8a install with no addons.
My Admin > Configuration > Customer details are following:
- Customer Shop Status - View Shop and Prices = 2
- Customer Approval Status - Authorization Pending = 2
- Customer Authorization: filename = customers_authorization
- Customer Authorization: Hide Column Left = true
Re: Hide Column Left does not work
Add code below to stylesheet of CURRENT Template
Code:
#navColumnOne {display:none}
Re: Hide Column Left does not work
Add code below to stylesheet of CURRENT Template
Code:
#navColumnOne {display:none}
Re: Hide Column Left does not work
Quote:
Originally Posted by
misty
Add code below to stylesheet of CURRENT Template
Code:
#navColumnOne {display:none}
Thank you misty for the comment but this will completely remove the column from the template. My wish is to hide the columns from the non-registered users and make it visible only when they register.
Re: Hide Column Left does not work
If you wish to disable certain sideboxes only to non members then
https://www.zen-cart.com/tutorials/i...hp?article=279
should help..
Re: I want to hide the left column for not-logged-in visitors
Moderator Note: Since this discussion has digressed from the alleged bug report aspect, it has been moved to a different forum category for further discussion.
Re: Hide Column Left does not work
Quote:
Originally Posted by
misty
With this tutorial I can hide from registered users following sideboxes:
- banner_box.php
- banner_box2.php
- banner_box_all.php
- best_sellers.php
- currencies.php
- featured.php
- languages.php
- manufacturers.php
- product_notifications.php
- search_header.php
- shopping_cart.php
- specials.php
- tell_a_friend.php
- whos_online.php
How do I hide categories.php, ezpages.php and information.php since they do not contain $show_XY?
Re: I want to hide the left column for not-logged-in visitors
To control a sidebox and when it displays you are just needing to stop the code from running in the:
/includes/modules/sideboxes/blah_blah.php
/includes/templates/templates_default/sideboxes/blah_blah.php
file that has the code ...
I prefer to copy both peices of a sidebox to the overrides to avoid confusion on what is customized and what is not ...
/includes/modules/sideboxes/your_template_dir/blah_blah.php
/includes/templates/your_template_dir/sideboxes/blah_blah.php
To manage the control of the code, you customize the file:
/includes/modules/sideboxes/your_template_dir/blah_blah.php
For example, look at the
/includes/modules/sideboxes/tell_a_friend.php
code and how that is constructed:
Code:
// test if box should display
$show_tell_a_friend= false;
if (isset($_GET['products_id']) and zen_products_id_valid($_GET['products_id'])) {
if (!($_GET['main_page']==FILENAME_TELL_A_FRIEND)) $show_tell_a_friend = true;
}
if ($show_tell_a_friend == true) {
require($template->get_template_dir('tpl_tell_a_friend.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_tell_a_friend.php');
$title = BOX_HEADING_TELL_A_FRIEND;
$title_link = false;
require($template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base,'common') . '/' . $column_box_default);
}
The IF statement has a variable $show_tell_a_friend which when true allows the code to run ... when false the code will not run and the sidebox is disabled, even though it is set to run in the Layout Boxes Controller ...
To manage any other sidebox, you do the same thing where you set a variable with a condition to set true or false and then use that variable to run the code or not ...
Many sideboxes already have a variable set as they have conditions as part of the original code ...
Those sideboxes that do not have a variable can, but simply adding the variable and the conditions to set it to true or false and then surrounding the code with an IF that lets the code run or not based on that condition ...
The categories sidebox:
/includes/modules/sideboxes/categories.php
has the code:
Code:
$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);
There isn't, by default, a variable set to control the condition of when to run this, so one needs to be added and the IF needs to be added to control the code ...
Code:
// test if box should display
$show_categories= false;
if (something_happens_here) {
// run the code
$show_categories= true;
} else {
// do not run the code
$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);
}
Again, follow the use of the templates and overrides to make life easier on future upgrades ...
Easy smeazy, eh? :cool: