Zen Cart Logo
Forums / Basic Configuration / Need SideBox to show in One Catagory Only

Need SideBox to show in One Catagory Only

Locked

Views: 7,335

Results 1 to 20 of 32
This thread is locked. New replies are disabled.
27 Jul 2007, 8:49 PM
#1
ljdream00 avatar

ljdream00

Zen Follower

Join Date:
Jun 2007
Location:
Michigan
Posts:
168
Plugin Contributions:
0

Need SideBox to show in One Catagory Only

:no: I just can't figure this out. Please Help!!!!

I downloaded the Absolute Links Sidebox contribution and it works perfectly.:clap: Just wonderful.

Here's the delima:
The issue that I'm having is that it shows on ALL pages and I only want it to show up on certain pages and/or certain catagories.

Now, If it's a page with a page-name, I can surpress the sidebox on that particular page with no problem:cool:

BUT....
I have 2 specific catagories that I truly want this sidebox on, the only issue is that it does not have a typical page-name, it has 'main_page=product_info&cPath= 'somenumber'

What do I do to make the this particular side box only show on those pages?:mellow:

Thank you in advance for your quick response.
lj

28 Jul 2007, 2:38 AM
#2
ajeh avatar

ajeh

Oba-san

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

Re: Need SideBox to show in One Catagory Only

if ($_GET['cPath'] == 12 or $_GET['cPath'] == 47) {
//do it
} else {
//skip it
}

Or, you might use:

if ($current_category_id == 12 or $current_category_id == 47) {
//do it
} else {
// skip it
}

If you peek in the sideboxes ... you will see how many have a $show_blah_blah ... look to see how that is used ...

28 Jul 2007, 5:42 PM
#3
ljdream00 avatar

ljdream00

Zen Follower

Join Date:
Jun 2007
Location:
Michigan
Posts:
168
Plugin Contributions:
0

Re: Need SideBox to show in One Catagory Only

:shocking: Ummmm....guess what?:blush:

:clap:IT WORKED, IT ACTUALLY WORKED...

Okay, I'm about to go donate now....:wink:
Thank you so much.
lj

Ajeh:

if ($_GET['cPath'] == 12 or $_GET['cPath'] == 47) {
//do it
} else {
//skip it
}

>  
> Or, you might use:
> ```php
if ($current_category_id == 12 or $current_category_id == 47) {
//do it
} else {
// skip it
}

If you peek in the sideboxes ... you will see how many have a $show_blah_blah ... look to see how that is used ...

28 Jul 2007, 6:14 PM
#4
ajeh avatar

ajeh

Oba-san

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

Re: Need SideBox to show in One Catagory Only

Thanks for the update ... glad that this could work for you ... :smile:

We also appreciate the support to help us continue to make your e-commerce solution better ... :cool:

14 Jan 2009, 3:13 AM
#5
bigjoed avatar

bigjoed

Zen Follower

Join Date:
Apr 2006
Location:
Fort Bragg, North Carolina
Posts:
152
Plugin Contributions:
0

Re: Need SideBox to show in One Catagory Only

Could this be done also for a specific product instead of the entire category?

Thanks

14 Jan 2009, 3:20 AM
#6
bigjoed avatar

bigjoed

Zen Follower

Join Date:
Apr 2006
Location:
Fort Bragg, North Carolina
Posts:
152
Plugin Contributions:
0

Re: Need SideBox to show in One Catagory Only

Never mind, I think I got it.

if ($_GET['products_id'] == 12 or $_GET['products_id'] == 47) {
//do it
} else {
//skip it
} 
14 Jan 2009, 3:24 AM
#7
gjh42 avatar

gjh42

Black Belt

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

Re: Need SideBox to show in One Catagory Only

Yep, it certainly could. Depending on what page you want this on, test for the product id, seen in the url:
...com/index.php?main_page=product_info&cPath=21_57&products_id=149

$_GET['products_id'] will give you the current product id to test against.

OK, looking good!

20 Feb 2009, 8:25 PM
#8
limelites avatar

limelites

Totally Zenned

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

Re: Need SideBox to show in One Catagory Only

Hi Guys,

I have an identical dilema to the OP but having read your thread cannot get it to work at all. I am a complete amateur with PHP, building my first website in my spare time.

My dilema is that I want a sidebox only to appear in certain categories. Now, here is the original PHP:

  $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've read this thread and tried to implement your advice but what I've come up with just doesn't work at all:

  $show_lingerie_sizes_sidebox = true;


  if ($_GET['cPath'] == 8 or $_GET['cPath'] == 9 or $_GET['cPath'] == 33 or $_GET['cPath'] == 34 or $_GET['cPath'] == 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);
	  } else {
  $show_lingerie_sizes_sidebox == false;
 }

With the original PHP the sidebox appears on all pages. When I upload my modified PHP then the sidebox simply doesn't appear at all. Please, could you tell me where I'm going wrong? I know it's something silly and it would be such a fantastic help.

20 Feb 2009, 8:45 PM
#9
ajeh avatar

ajeh

Oba-san

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

Re: Need SideBox to show in One Catagory Only

You have to watch $cPath ...

Your categories_id 8 is really using:
/index.php?main_page=index&cPath=1_8

Go to your categories_id 8 where you think you want to see this ... and edit the URL in your browser from =1_8 to =8 ... does it work now?

You could also use:
$current_category_id

on the test as it does evaluate to 8 ...

20 Feb 2009, 8:50 PM
#10
limelites avatar

limelites

Totally Zenned

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

Re: Need SideBox to show in One Catagory Only

Ajeh, you are genius, you are! When I change the URL from 1_8 to just 8 then it does indeed work....

However, I created the categories from ADMIN and they created their own dynamic URL.... how do I stop the URL from going 1_8 instead of 8 ?? Or is there a way to tell the PHP if ($_GET['cPath'] == 1_8 ?????

OR... could you tell me how to use $current_category_id in correcting this problem?

Thanks for your help, I know your time is valuable.

20 Feb 2009, 8:58 PM
#11
ajeh avatar

ajeh

Oba-san

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

Re: Need SideBox to show in One Catagory Only

It gets really trickie here ... :blink:

if ($current_category_id == 8 or $current_category_id == 9 ... etc. etc.

Easy smeazy, eh? :flex:

20 Feb 2009, 9:15 PM
#12
limelites avatar

limelites

Totally Zenned

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

Re: Need SideBox to show in One Catagory Only

GOT IT!!!! EUREKA!!

$show_lingerie_sizes_sidebox = true;

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);
}

Ajeh, I owe you a whole weeks supply of coffee!!

BTW Ajeh, your homepage link in your signature ( http://www.thewebmakerscorner.com/ ) does not work at all. Not sure if you're aware?

21 Feb 2009, 9:52 AM
#13
limelites avatar

limelites

Totally Zenned

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

Re: Need SideBox to show in One Catagory Only

Now that I've solved the way to make the new sidebox appear only when browsing specific categories, its created a sort of reverse problem to the OP title Re: "Need SideBox to show in One Catagory Only"

My question now is the reverse of this, i.e., "Need One Category to show in Sidebox Only"

The new sidebox I've installed allows PHP or HTML content. I don't suppose you'd know what PHP code to insert into the box content in order to show only a specific category, example this one:

http://www.dystynction.com/index.php?main_page=index&cPath=1_8_9

Then, to make things even more interesting, how would I manipulate the code so that this category would only appear if the category was populated and active?

Sorry if this has jumped off topic a little but had a search on the forums and couldn't find anything on this at all.

21 Feb 2009, 3:41 PM
#14
ajeh avatar

ajeh

Oba-san

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

Re: Need SideBox to show in One Catagory Only

Get the sidebox so it works with all categories correctly then add the same IF but just for the:
$current_categories_id == 9

22 Feb 2009, 1:12 PM
#15
limelites avatar

limelites

Totally Zenned

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

Re: Need SideBox to show in One Catagory Only

Hi, thanks for the reply but not sure you understand what I'm trying to achieve?

Not trying to make the box appear in category 9. I'm trying to make category 9 appear in the box :-)

22 Feb 2009, 3:39 PM
#16
ajeh avatar

ajeh

Oba-san

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

Re: Need SideBox to show in One Catagory Only

If your cPath from the categories box were 3_10 ... you could use:

  $information[] = '<a href="' . zen_href_link(FILENAME_DEFAULT, 'cPath=' . '3_10') . '">' . 'SOME NAME' . '</a> ';
22 Feb 2009, 8:31 PM
#17
limelites avatar

limelites

Totally Zenned

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

Re: Need SideBox to show in One Catagory Only

Hi Linda,

Excuse my ignorance here but it's not working... there are obviously serious errors in my file because as soon as I upload it the whole site ceases to function.

The sidebox.php file I'm entering content to, allows one to enter the content of the box in PHP or HTML between two apostrophes ''

I can enter html in there easy but as soon as I try to input PHP it just causes the site to stop working :-)

For example, I tried to enter ```php
$information[] = '<a href="' . zen_href_link(FILENAME_DEFAULT, 'cPath=' . '3_10') . '">' . 'SOME NAME' . '</a> ';


If I enter the entire content of a categories sidebox between the two '' then same again....

Am I being stupid?
22 Feb 2009, 8:39 PM
#18
limelites avatar

limelites

Totally Zenned

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

Re: Need SideBox to show in One Catagory Only

My apologies for wasting your time but having re-read the readme file I am only allowed to enter HTML between the apostrophes... I guess I'd need to reqwrite the sidebox_defines.php totally which might just be beyond my level :-(

22 Feb 2009, 8:39 PM
#19
ajeh avatar

ajeh

Oba-san

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

Re: Need SideBox to show in One Catagory Only

First, check your code for spaces or blank lines before the starting **<?php**or ending **?>**php tags as that will cause problems ...

If there aren't any, could you post the code for the information.php file that you are using?

22 Feb 2009, 8:49 PM
#20
limelites avatar

limelites

Totally Zenned

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

Re: Need SideBox to show in One Catagory Only

Hi Linda

I think this is probably beyond my capability as an amature but I hate to throw in the towel.

the empty php file is like this:

FILE 1 (includes\languages\english\extra_definitions):

<?php
/**
 * blank sidebox definitions - text for inclusion in a new blank sidebox
 *
 * @package templateSystem
 * @copyright 2007 Kuroi Web Design
  * @copyright Portions Copyright 2003-2007 Zen Cart Development Team
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 * @version $Id: blank_sidebox.php 2007-05-26 kuroi $
 */

define('BOX_HEADING_DYNAMIC_CATEGORIES_SIDEBOX', 'Filtered Categories');
define('TEXT_DYNAMIC_CATEGORIES_SIDEBOX', 'HTML ONLY');

?>

FILE 2(includes\modules\sideboxes):

<?php
/**
 * blank sidebox - allows a blank sidebox to be added to your site
 *
 * @package templateSystem
 * @copyright 2007 Kuroi Web Design
  * @copyright Portions Copyright 2003-2007 Zen Cart Development Team
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 * @version $Id: blank_sidebox.php 2007-05-26 kuroi $
 */
  // test if box should display
  $show_dynamic_categories_sidebox = true;
  
  if ($current_category_id == 18 or $current_category_id == 202 or $current_category_id == 203 or $current_category_id == 204 or $current_category_id == 205 or $current_category_id == 206 or $current_category_id == 207 or $current_category_id == 208 or $current_category_id == 209 ) {
      require($template->get_template_dir('tpl_dynamic_categories_sidebox.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_dynamic_categories_sidebox.php');
      $title =  BOX_HEADING_DYNAMIC_CATEGORIES_SIDEBOX;
      $title_link = false;
      require($template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base,'common') . '/' . $column_box_default);
 }
?>

FILE 3(includes\templates\template_default\sideboxes):

<?php
/**
 * blank sidebox - allows a blank sidebox to be added to your site
 *
 * @package templateSystem
 * @copyright 2007 Kuroi Web Design
  * @copyright Portions Copyright 2003-2007 Zen Cart Development Team
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 * @version $Id: blank_sidebox.php 2007-05-26 kuroi $
 */

  $content = '';
  $content .= '<div id="' . str_replace('_', '-', $box_id . 'Content') . '" class="sideBoxContent">';

  // Replace the text and HTML tags between the apostophes on lines 19 and 20.
  // Use as many or as few lines using this model as you need for your custom content.
  // If you have a multilingual site define your text in the languages/YOUR_LANGUAGE/extra_definitions/blank_sidebox_defines.php and include it as shown in line 19.
  // If your site is monolingual, you can put the text right here as shown on line 20 (and nobody will know!)
  $content .= '<h1>' . TEXT_DYNAMIC_CATEGORIES_SIDEBOX . '</h1>';
?>

Not sure exactly where to begin. I thought initially that I'd have been able to manipulate FILE1 between the apostrophes but that's just for HTML content. I wouldn't have a clue how to change the content of the box so that it would show only specific categories (a sort of miniature version of the main categories sidebox but with only specific categories relating to the current category_id)....

If this is too difficult to talk me through then I totally understand, I've taken so much of your time already.