Zen Cart Logo
Forums / General Questions / Howto: NOT list category on sidebox ?

Howto: NOT list category on sidebox ?

Locked

Views: 1,279

Results 1 to 10 of 10
This thread is locked. New replies are disabled.
25 Sep 2007, 6:45 PM
#1
nullmind avatar

nullmind

Zen Follower

Join Date:
Jul 2007
Posts:
129
Plugin Contributions:
0

Howto: NOT list category on sidebox ?

is there a way to not show a certain category on the categories sidebox ?

25 Sep 2007, 8:26 PM
#2
gjh42 avatar

gjh42

Black Belt

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

Re: Howto: NOT list category on sidebox ?

In /includes/templates/your_template/sideboxes/tpl_categories.php, find this line near the top of the file:```php
if (zen_get_product_types_to_category($box_categories_array[$i]['path']) == 3 or ($box_categories_array[$i]['top'] != 'true' and SHOW_CATEGORIES_SUBCATEGORIES_ALWAYS != 1)) {
// skip if this is for the document box (==3)
} else {


($box_categories_array[$i]['path'] == 'cPath=23') or

to the beginning to get```php
    if (($box_categories_array[$i]['path'] == 'cPath=23') or zen_get_product_types_to_category($box_categories_array[$i]['path']) == 3 or ($box_categories_array[$i]['top'] != 'true' and SHOW_CATEGORIES_SUBCATEGORIES_ALWAYS != 1)) {
      // skip if this is for the document box (==3), or category 23
    } else {
 

Replace the 23 with the correct cPath for your category so it reads (say) 'cPath=4_37'.

25 Sep 2007, 9:29 PM
#3
nullmind avatar

nullmind

Zen Follower

Join Date:
Jul 2007
Posts:
129
Plugin Contributions:
0

Re: Howto: NOT list category on sidebox ?

THANKS !!!

Worked great

29 Sep 2007, 2:23 PM
#4
mikeyg avatar

mikeyg

Totally Zenned

Join Date:
May 2005
Posts:
515
Plugin Contributions:
0

Re: Howto: NOT list category on sidebox ?

Hi

I am trying to get a link to category to disappear of a product page if you are in that category.

the code works but if I am on a different category and I want the same to happen but this is a subcategory then code does not seem to work. I am a novice at php and so have pinched code from else where to get it to work for the first bit.

elseif ($_GET['cPath'] != 11_233 )

does not seem to like the underscore in the cPath reference. Could some one help with the syntax

Thanks MG

29 Sep 2007, 6:58 PM
#5
gjh42 avatar

gjh42

Black Belt

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

Re: Howto: NOT list category on sidebox ?

You might try using quotes around the value, as it is a string and not a numeric value:

elseif ($_GET['cPath'] != '11_233' )

30 Sep 2007, 12:21 AM
#6
mikeyg avatar

mikeyg

Totally Zenned

Join Date:
May 2005
Posts:
515
Plugin Contributions:
0

Re: Howto: NOT list category on sidebox ?

gjh42

I did try this but then this caused a complete error on the page and did not load at all.

MG

30 Sep 2007, 12:45 AM
#7
gjh42 avatar

gjh42

Black Belt

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

Re: Howto: NOT list category on sidebox ?

It's impossible to troubleshoot a partial line of code without context. What is the complete statement you are trying to use? (And the ones before and after might be relevant too.)

30 Sep 2007, 8:10 PM
#8
mikeyg avatar

mikeyg

Totally Zenned

Join Date:
May 2005
Posts:
515
Plugin Contributions:
0

Re: Howto: NOT list category on sidebox ?

gjh42

this is in the tpl_product-info-diplay.php file:

current code is:

<div id="giftwrap"><?php if ($_GET['cPath'] != 194 ) echo '<a href ="http://www.funkymoose.co.uk/index.php?main_page=index&cPath=194" ><img src="/includes/templates/template_default/images/icons/giftwrap.gif"> Gift wrapping available </a>'; else echo "";

This hides the gift wrap link if I am in the gift wrap catagory. I would like to also hide the link if I am on the greeting card category ( As I feel it is unlikely that some one wants to gift wrap a greeting card and it looks a bit odd having the link there. Of course if the worst comes to the worst it is not the end of the world but I am certainly curious about getting the code to work as I am sure it would hep with similar options.

I tried:

<div id="giftwrap"><?php if ($_GET['cPath'] != 11_223) echo '<a href ="http://www.funkymoose.co.uk/index.php?main_page=index&cPath=194" ><img src="/includes/templates/template_default/images/icons/giftwrap.gif"> Gift wrapping available </a>'; else echo "";

but I get the following error:

Parse error: syntax error, unexpected T_STRING in \includes\templates\mytemplate\templates\tpl_product_info_display.php on line 122

11_223 is the subcategory.

Ideally I thought I should be able to run it as an if, elseif, else so both the initial category and subcategory can work.

it might be that using if / case would be a better way to go???

Hope this is enough code to help

Sorry if this is a basic php question I am certainly a complete beginner.

thanks

MG

30 Sep 2007, 9:52 PM
#9
gjh42 avatar

gjh42

Black Belt

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

Re: Howto: NOT list category on sidebox ?

I don't know enough advanced PHP to know why the $_GET[] is better or necessary in certain circumstances, but the value of $cPath should be available in tpl_product_info_display.php. Instead of
if ($_GET['cPath'] != 11_223)
try
if ($cPath != '11_223')
and see if that works.

14 Oct 2007, 3:04 AM
#10
mikeyg avatar

mikeyg

Totally Zenned

Join Date:
May 2005
Posts:
515
Plugin Contributions:
0

Re: Howto: NOT list category on sidebox ?

Just some feed back

if ($cPath != '11_223') - does not work.

However I have just re-written this using switch / case statement and it worked first time

Thanks

MG