Zen Cart Logo
Forums / General Questions / New Products - Right Sidebar

New Products - Right Sidebar

Views: 3,245

Results 1 to 8 of 8
18 Sep 2013, 9:24 PM
#1
scully avatar

scully

Zen Follower

Join Date:
Dec 2010
Posts:
257
Plugin Contributions:
0

New Products - Right Sidebar

How can I leave the New Products - Right Sidebar turned on for the index page, but turned off for all other pages?

Thanks!!

18 Sep 2013, 9:34 PM
#2
scully avatar

scully

Zen Follower

Join Date:
Dec 2010
Posts:
257
Plugin Contributions:
0

Re: New Products - Right Sidebar

Actually, the entire right sidebar can probably go, on the secondary pages...not just the New Products. If that helps simplify things. :-)

19 Sep 2013, 1:31 PM
#4
scully avatar

scully

Zen Follower

Join Date:
Dec 2010
Posts:
257
Plugin Contributions:
0

Re: New Products - Right Sidebar

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!

23 Sep 2013, 3:26 PM
#5
scully avatar

scully

Zen Follower

Join Date:
Dec 2010
Posts:
257
Plugin Contributions:
0

Re: New Products - Right Sidebar

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.

23 Sep 2013, 4:25 PM
#6
stevesh avatar

stevesh

Black Belt

Join Date:
Feb 2005
Location:
Lansing, Michigan USA
Posts:
19,793
Plugin Contributions:
2

Re: New Products - Right Sidebar

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.

23 Sep 2013, 4:31 PM
#7
gjh42 avatar

gjh42

Black Belt

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

Re: New Products - Right Sidebar

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

if (!$this_is_home_page) {
  $flag_disable_right = true; //turn off right column except on homepage
}

You can put it below this part: ```php
// 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;
}

23 Sep 2013, 5:08 PM
#8
scully avatar

scully

Zen Follower

Join Date:
Dec 2010
Posts:
257
Plugin Contributions:
0

Re: New Products - Right Sidebar

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!!!!!