How can I leave the New Products - Right Sidebar turned on for the index page, but turned off for all other pages?
Thanks!!
How can I leave the New Products - Right Sidebar turned on for the index page, but turned off for all other pages?
Thanks!!
Actually, the entire right sidebar can probably go, on the secondary pages...not just the New Products. If that helps simplify things. :-)
Stevesh, I tried following those instructions, but apparently I'm even more stupid than I thought, because I keep wiping out the entire page. Could you please explain it nice and slow, for this poor php-challenged moron, because I'm just not getting it. :-/
Sorry!
I've tried again, several times, and I'm just not getting it. Sorry to be so stupid...I know it's probably something that's incredibly easy to those who have more experience...but I really do need step-by-step help here. Thanks.
Here's the code from includes/modules/sideboxes/whats_new.php: Add the red parts.
<?php
/**
* whats_new sidebox - displays a random "new" product
*
* @package templateSystem
* @copyright Copyright 2003-2010 Zen Cart Development Team
* @copyright Portions Copyright 2003 osCommerce
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* @version $Id: whats_new.php 15880 2010-04-11 16:24:30Z wilt $
*/
if ($this_is_home_page) {
$show_whatsnew = true;
} else {
$show_whatsnew = false;
}
if ($show_whatsnew == true) {
// display limits
// $display_limit = zen_get_products_new_timelimit();
$display_limit = zen_get_new_date_range();
$random_whats_new_sidebox_product_query = "select p.products_id, p.products_image, p.products_tax_class_id, p.products_price, pd.products_name,
p.master_categories_id
from (" . TABLE_PRODUCTS . " p
left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id )
where p.products_id = pd.products_id
and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'
and p.products_status = 1 " . $display_limit;
// $random_whats_new_sidebox_product = zen_random_select($random_whats_new_sidebox_product_query);
$random_whats_new_sidebox_product = $db->ExecuteRandomMulti($random_whats_new_sidebox_product_query, MAX_RANDOM_SELECT_NEW);
if ($random_whats_new_sidebox_product->RecordCount() > 0 ) {
require($template->get_template_dir('tpl_whats_new.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_whats_new.php');
$title = BOX_HEADING_WHATS_NEW;
$title_link = FILENAME_PRODUCTS_NEW;
require($template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base,'common') . '/' . $column_box_default);
}
} ?>
Don't forget the stuff at the bottom, and save it to includes/modules/sideboxes/YOUR_CUSTOM_TEMPLATE_NAME.
Last edited by stevesh; 23 Sep 2013 at 05:30 PM.
The instructions stevesh linked to are not relevant for turning onn/off the whole sidebar. For that, you need one simple edit to /includes/templates/your_template/common/tpl_main_page.php (copy it from /template_default/ if you don't already have a custom copy).
There are instructions in the comments at the top of the file, but I will summarize:
Add a line near the top of the file (after the comments) and inside existing <?php .... ?> tags, like
You can put it below this part:PHP Code:
if (!$this_is_home_page) {
$flag_disable_right = true; //turn off right column except on homepage
}
PHP Code:
// the following IF statement can be duplicated/modified as needed to set additional flags
if (in_array($current_page_base,explode(",",'list_pages_to_skip_all_right_sideboxes_on_here,separated_by_commas,and_no_spaces')) ) {
$flag_disable_right = true;
}
Now that's what I call timing! LOL I was just about to respond to stevesh's post telling him that it worked...but..............
So I changed the tpl_main_page.php file per your instructions, and now it works perfectly.
Thank you both!!!!!
Bookmarks