Zen Cart Logo
Forums / Addon Sideboxes / Additional Sidebox Only to Appear in current_category_id

Additional Sidebox Only to Appear in current_category_id

Locked

Views: 2,965

Results 1 to 9 of 9
This thread is locked. New replies are disabled.
20 Feb 2009, 7:02 PM
#1
limelites avatar

limelites

Totally Zenned

Join Date:
Jan 2009
Posts:
2,085
Plugin Contributions:
0

Additional Sidebox Only to Appear in current_category_id

If anyone could help me solve this then it'd be a real help. I'm struggling with a rather complex navigation system which I wont bore you with, but basically I'm planning to add an additional sidebox for each main category which must only appear when the category ID is the one specific to the box contents.

For Example, when someone clicks on the Lingerie category (http://www.dystynction.com/index.php?main_page=index&cPath=1_8) then I want the additional sidebox I created to appear.

I don't want this sidebox visible in any other category.

The existing contents of the relevant sidebox.php is this:

  $show_lingerie_sizes_sidebox = true;
  
  if ($show_lingerie_sizes_sidebox == true) {
      require($template->get_template_dir('tpl_lingerie_sizes_sidebox.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_lingerie_sizes_sidebox.php');
      $title =  BOX_HEADING_LINGERIE_SIZES_SIDEBOX;
      $title_link = false;
      require($template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base,'common') . '/' . $column_box_default);
 }
 

 
?>

I have read from another thread that I might be able to add something like this:

 IF ($current_category_id=='1_8') {
  $show_lingerie_sizes_sidebox == true;
} else {
  $show_lingerie_sizes_sidebox == false;
}

..........but when I try to add this it just doesn't work...

Can anyone please help me write this little piece of code? Thanks so much to anyone who can help me :-)

20 Feb 2009, 7:14 PM
#3
bunyip avatar

bunyip

Totally Zenned

Join Date:
Sep 2004
Location:
Western Massachusetts
Posts:
2,361
Plugin Contributions:
1

Re: Additional Sidebox Only to Appear in current_category_id

the current_category_id is not 1_8, but just 8 (the actual category id number).

20 Feb 2009, 7:54 PM
#4
limelites avatar

limelites

Totally Zenned

Join Date:
Jan 2009
Posts:
2,085
Plugin Contributions:
0

Re: Additional Sidebox Only to Appear in current_category_id

Hi guys,

thanks for replying, it's really appreciated.

I looked at the other thread and I tried to plug in the IF and GET statements but I can't get it to work :-(

I'm a total amateur with PHP code and this is my first website (you've probably guessed) and was just wondering if any of you guys knew how to 'shoogle' this code to make it work?

20 Feb 2009, 7:56 PM
#5
limelites avatar

limelites

Totally Zenned

Join Date:
Jan 2009
Posts:
2,085
Plugin Contributions:
0

Re: Additional Sidebox Only to Appear in current_category_id

bunyip:

the current_category_id is not 1_8, but just 8 (the actual category id number).

Thanks for pointing that out Neville, but still can't get it to work :-(

20 Feb 2009, 8:03 PM
#6
limelites avatar

limelites

Totally Zenned

Join Date:
Jan 2009
Posts:
2,085
Plugin Contributions:
0

Re: Additional Sidebox Only to Appear in current_category_id

This is how I've tried to edit the PHP:

  $show_lingerie_sizes_sidebox = true;


  if ($_GET['cPath'] == 8 or $_GET['cPath'] == 9) {
      require($template->get_template_dir('tpl_lingerie_sizes_sidebox.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_lingerie_sizes_sidebox.php');
      $title =  BOX_HEADING_LINGERIE_SIZES_SIDEBOX;
      $title_link = false;
      require($template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base,'common') . '/' . $column_box_default);
	  } else {
  $show_lingerie_sizes_sidebox == false;
 }

Which results in the box not showing at all.

By the way, I don't get the logic of the category reference numbers.... if http://www.dystynction.com/index.php?main_page=index&cPath=1_8 is category_id == 8 ............ then what is http://www.dystynction.com/index.php?main_page=index&cPath=1_8_9 ??? is it category_id == 9 ??

20 Feb 2009, 9:28 PM
#7
limelites avatar

limelites

Totally Zenned

Join Date:
Jan 2009
Posts:
2,085
Plugin Contributions:
0

Re: Additional Sidebox Only to Appear in current_category_id

If anyone reads this and wonders about a solution then please view this thread as i's been solved there thanks to the wonderful Ajeh

20 Feb 2009, 10:16 PM
#8
misty avatar

misty

Inactive

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

Re: Additional Sidebox Only to Appear in current_category_id

Aetherlux:

IF ($current_category_id=='8' or $current_category_id=='9')
Incorrect marked red...should be

if ($current_category_id == 8 or $current_category_id == 9 ... etc. etc. 
21 Feb 2009, 9:46 PM
#9
limelites avatar

limelites

Totally Zenned

Join Date:
Jan 2009
Posts:
2,085
Plugin Contributions:
0

Re: Additional Sidebox Only to Appear in current_category_id

**Aetherlux

use either:

if ($_GET['cPath:**

== 1_8 or $_GET['cPath'] == 1_9)

or

IF ($current_category_id=='8' or $current_category_id=='9')

I'm pretty sure you cannot use the underscores in the cPath and you do not use the apostrophes in the category_id

What exactly are you trying to achieve Aetherlux?

This is how I got it to work though:

if ($current_category_id == 8 or $current_category_id == 9 or $current_category_id == 33 or $current_category_id == 34 or $current_category_id == 35 ) {
require($template->get_template_dir('tpl_lingerie_sizes_sidebox.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_lingerie_sizes_sidebox.php');
$title = BOX_HEADING_LINGERIE_SIZES_SIDEBOX;
$title_link = false;
require($template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base,'common') . '/' . $column_box_default);
}