Forums / Addon Sideboxes / How to show sidebox "News Box Manager" only for certain menu item?

How to show sidebox "News Box Manager" only for certain menu item?

Locked

Views: 2,343

Results 1 to 4 of 4
This thread is locked. New replies are disabled.
1 Dec 2010, 10:38 PM
#1
adi2009 avatar

adi2009

New Zenner

Join Date:
Dec 2009
Location:
Sarajevo
Posts:
80
Plugin Contributions:
0

How to show sidebox "News Box Manager" only for certain menu item?

Hi,

I have just successfully installed News Box Manager which works OK on my website but problem is that news box sidebox is shown on each page and menu item on my website.
My web site main navigation look like this:


HOME | ABOUT US | SHOP | CONTACT |

and I would like for news box sidebox to be shown for example only where cPath=146 (which is equal to = menu item SHOP).

I have followed and read this thread but I still couldn't figure out how to solve this:unsure:

Any help is appreciated and thanks in advance for promt replys!

Cheers:wink:
Adi

MY Website
The best of the best: Zen Cart

1 Dec 2010, 11:06 PM
#2
gjh42 avatar

gjh42

Black Belt

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

Re: How to show sidebox "News Box Manager" only for certain menu item?

Similar to post 14 in that thread, you could add this to your review.php or tpl_review.php file```php
$show_review= false;

if ($_GET['cPath'] == '146') {
$show_review = true;
}

if ($show_review == true) {

//sidebox code

}
This would show the sidebox on that category and all products in it. If it has subcategories, you would want the line to bephp
if ( (int)$_GET['cPath'] == '146') {

2 Dec 2010, 8:41 AM
#3
adi2009 avatar

adi2009

New Zenner

Join Date:
Dec 2009
Location:
Sarajevo
Posts:
80
Plugin Contributions:
0

Re: How to show sidebox "News Box Manager" only for certain menu item?

It's working great , thnx a lot Glenn for your quick and precise answer/help as always, truly appreciate it:bigups::clap:

In case someone would had same problem like me this is how I sloved it:

news_scroll_box.php code

<?php
//
// +----------------------------------------------------------------------+
// |zen-cart Open Source E-commerce                                       |
// +----------------------------------------------------------------------+
// | Copyright (c) 2003 The zen-cart developers                           |
// |                                                                      |
// | http://www.zen-cart.com/index.php                                    |
// |                                                                      |
// | Portions Copyright (c) 2003 osCommerce                               |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.0 of the GPL license,       |
// | that is bundled with this package in the file LICENSE, and is        |
// | available through the world-wide-web at the following url:           |
// | http://www.zen-cart.com/license/2_0.txt.                             |
// | If you did not receive a copy of the zen-cart license and are unable |
// | to obtain it through the world-wide-web, please send a note to       |
// | [email protected] so we can mail you a copy immediately.          |
// +----------------------------------------------------------------------+
// | Do Not Remove: Coded for Zen-Cart by geeks4u.com                     |
// | Dedicated to Memory of Amelita "Emmy" Abordo Gelarderes		  |
// +----------------------------------------------------------------------+
// $Id: news_scroll_box.php,v 1.2 2004/08/26
//

  $show_news_scroll_box= false;

  if ($_GET['cPath'] == '148') {
    $show_news_scroll_box= true;
  }

  if ($show_news_scroll_box == true) {

$languages_id = zen_db_prepare_input((int)$_SESSION['languages_id']);
$news_box_query = $db->Execute("select nc.news_title, nc.news_content
								from " . TABLE_BOX_NEWS_CONTENT . " nc, " . TABLE_BOX_NEWS . " n
								where n.box_news_id = nc.box_news_id and nc.languages_id = " . $languages_id . " and n.news_status = 1 and now() between n.news_start_date and n.news_end_date");
while (!$news_box_query->EOF) {
  if(($news_box_query->fields['news_title']) || ($news_box_query->fields['news_content'])){
    require($template->get_template_dir('tpl_news_scroll_box.php', DIR_WS_TEMPLATE, $current_page_base,'sideboxes') . '/tpl_news_scroll_box.php');

    $title =  BOX_HEADING_SCROLL_BOX;
    $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);
    break;
  } 
  else{
    $news_box_query->MoveNext();
  }
}
}
?>

MY Website
The best of the best: Zen Cart

2 Dec 2010, 8:52 AM
#4
gjh42 avatar

gjh42

Black Belt

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

Re: How to show sidebox "News Box Manager" only for certain menu item?

Glad it works for you.
Just as an aside, I notice that this sidebox file has some obsolete code in it that has not been useful for several years:```
$title = BOX_HEADING_SCROLL_BOX;
$left_corner = false;
$right_corner = false;
$right_arrow = false;

$title_link = false;