Zen Cart Logo
Forums / Basic Configuration / Suppress Whats New sidebox

Suppress Whats New sidebox

Locked

Views: 2,485

Results 1 to 15 of 15
This thread is locked. New replies are disabled.
1 Nov 2008, 4:47 AM
#1
thebasher avatar

thebasher

New Zenner

Join Date:
Dec 2007
Posts:
53
Plugin Contributions:
0

Suppress Whats New sidebox

Is there a way to suppress the "whats new" sidebox on certain pages?

in the whats_new.php file in the modules/sidebox folder I have tried:

if (in_array($cPath,explode(",",'11')) ) {
    $show_whats_new= false;
  } else {
    $show_whats_new= true;
  }

But it didn't work. Is there another way to do this?

Thanks!

1 Nov 2008, 4:56 AM
#2
misty avatar

misty

Inactive

Join Date:
Apr 2004
Location:
UK
Posts:
5,752
Plugin Contributions:
1

Re: Suppress Whats New sidebox

Depends where you do not want that sidebox to show..
url below gives examples
http://www.zen-cart.com/forum/showthread.php?t=18624

1 Nov 2008, 5:25 AM
#3
thebasher avatar

thebasher

New Zenner

Join Date:
Dec 2007
Posts:
53
Plugin Contributions:
0

Re: Suppress Whats New sidebox

Hey misty,
I guess I'm confused on where to put the code since there is no "check is box should display" at the top of the page.

The pages I don't want it on are "document general" pages.

After reading through the post you suggested I'm even more confused because I think what I was trying should have worked...:wacko:

1 Nov 2008, 7:24 PM
#5
thebasher avatar

thebasher

New Zenner

Join Date:
Dec 2007
Posts:
53
Plugin Contributions:
0

Re: Suppress Whats New sidebox

Misty thanks for the help. I know the answer is here somewhere I just can't figure out where.

Here is the code I have for my "whats_new" sidebox. Am I putting the "if" statement in the correct place?

<?php
/**
 * whats_new sidebox - displays a random "new" product
 *
 * @package templateSystem
 * @copyright Copyright 2003-2007 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 6475 2007-06-08 21:10:33Z ajeh $
 */

	$show_whats_new= true;
	if (in_array($cPath,explode(",",'11')) ) {
    $show_whats_new= false;
  }
   

// 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 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);
  }
?>
2 Nov 2008, 3:40 AM
#6
ajeh avatar

ajeh

Oba-san

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

Re: Suppress Whats New sidebox

Close ... but no cigar ... :blink:

you got the right idea ...

Now go look at the featured.php sidebox ...

See how there is this IF surrounding the whole thing?

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

  if ($show_featured == true) {
//blah blah blah
  }

Notice the whats_new.php sidebox ...

You have the:
$show_whats_new= false;

and if your code is right, it will work great ... but ... you don't have an IF surrounding the whole code to say ... do it or don't do it ... :eek:

Compare the two files and it will help you sort that out ...

2 Nov 2008, 9:12 AM
#8
thebasher avatar

thebasher

New Zenner

Join Date:
Dec 2007
Posts:
53
Plugin Contributions:
0

Re: Suppress Whats New sidebox

:clap:Yeee Haw!!! Ya'll rule! I have been staring at that code the last 24 hours trying everything I could think of. I have always been iffy on the "if" statement but it makes a LOT more sense now.

Thank you both for the help.

2 Nov 2008, 9:23 AM
#9
misty avatar

misty

Inactive

Join Date:
Apr 2004
Location:
UK
Posts:
5,752
Plugin Contributions:
1

Re: Suppress Whats New sidebox

thebasher:

Yeee Haw!!! Ya'll rule! I have been staring at that code the last 24 hours trying everything I could think of. I have always been iffy on the "if" statement but it makes a LOT more sense now.

Thank you both for the help.
Been there, done it and got several tshirts..
thanks for confirming things are now clearer for you.
:smile:

30 Nov 2008, 3:16 PM
#10
reneberg avatar

reneberg

New Zenner

Join Date:
Nov 2008
Posts:
4
Plugin Contributions:
0

Re: Suppress Whats New sidebox

Hi guys.

I really hope someone can help me? :smile:

Ive been trying for ages to modify the presence of my information sidebox:

I only want it to show on my page_2 - so ive tried to read all the threads related to this.... but i cant seem to get it going....

$show_information_box = true;
if ($_GET['main_page'] == '$this_is_home_page'){
$show_information_box = false;

$show_information_box = false;
if ($_GET['main_page'] == '$page_2'){
$show_information_box = true;

Thx in advance

30 Nov 2008, 4:23 PM
#11
ajeh avatar

ajeh

Oba-san

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

Re: Suppress Whats New sidebox

Here are some IF conditions for these:

if ($this_is_home_page) {
  echo 'I AM HOME PAGE!<br>';
  } else {
  echo 'I AM NOT HOME PAGE!<br>';
}

if ($_GET['main_page'] == 'page_2') {
  echo 'I AM PAGE 2<br>';
} else {
  echo 'I AM NOT PAGE 2<br>';
}

You should be able to adapt these to your needs ...

2 Dec 2008, 12:58 PM
#12
schira avatar

schira

New Zenner

Join Date:
May 2006
Posts:
6
Plugin Contributions:
0

Re: Suppress Whats New sidebox

Hi,

I am trying to suppress the display of a sidebox on Secure (SSL) pages, does anyone know the if statement I need to put at the top of the sideobx php file?

Thanks,
Andrew

2 Dec 2008, 5:46 PM
#13
ajeh avatar

ajeh

Oba-san

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

Re: Suppress Whats New sidebox

See if using the variable:
$request_type

helps you out on knowing when you are or are not on a secure page ... :smile:

4 Dec 2008, 12:10 AM
#14
schira avatar

schira

New Zenner

Join Date:
May 2006
Posts:
6
Plugin Contributions:
0

Re: Suppress Whats New sidebox

Ajeh,

Thanks for your suggestion, I used - if ( $request_type == 'NONSSL' ) which worked well.

Regards,
Andrew

4 Dec 2008, 5:50 AM
#15
ajeh avatar

ajeh

Oba-san

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

Re: Suppress Whats New sidebox

Thanks for the update that this was able to help you as well as for posting the solution to your specific needs on the secure and non-secure pages selection for showing sideboxes ... :smile: