Forums / General Questions / Categories NOT show an ACTIVE link

Categories NOT show an ACTIVE link

Views: 2,310

Results 1 to 14 of 14
19 Nov 2010, 11:10 PM
#1
gloerick avatar

gloerick

Zen Follower

Join Date:
Feb 2006
Location:
Boise, ID
Posts:
330
Plugin Contributions:
0

Categories NOT show an ACTIVE link

Hello All,

Zen v1.3.9h
Site http://efpsupply.com

all is working well.

Just want to seperate out some links for the Categories,

Thier are some links in the Categories I would like to show
in another sidebox, so I used the BLANK_SIDE_BOX addon,
works great and I have the links working fine.

However now that the SAME links are woking in the new side box
is there a way to NOT show the links in the Categories box now ?
as I now have 2 links on the page to the same info.

Thx,
Erick

20 Nov 2010, 1:14 AM
#2
gjh42 avatar

gjh42

Black Belt

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

Re: Categories NOT show an ACTIVE link

You would have to do some custom coding in tpl_categories.php to test for those categories and skip them.

Alternatively, you could install Categories Dressing which will allow you to create the identical look you have with an intermediate heading.

The tpl_categories edit is pretty simple, so if you will not be modifying your categories any more you could just do that.

20 Nov 2010, 1:50 AM
#3
gloerick avatar

gloerick

Zen Follower

Join Date:
Feb 2006
Location:
Boise, ID
Posts:
330
Plugin Contributions:
0

Re: Categories NOT show an ACTIVE link

Yes, blocking is good,

How to test for and remove cats 8,9,10 ?

Thx so much,
Erick

22 Nov 2010, 1:28 PM
#4
gjh42 avatar

gjh42

Black Belt

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

Re: Categories NOT show an ACTIVE link

Find this line in tpl_categories.php```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 {

in_array($box_categories_array[$i]['path'], explode(',', '8,9,10')) or
to get```php
     if (in_array($box_categories_array[$i]['path'], explode(',', '8,9,10')) 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)
      } else {
22 Nov 2010, 4:22 PM
#5
gloerick avatar

gloerick

Zen Follower

Join Date:
Feb 2006
Location:
Boise, ID
Posts:
330
Plugin Contributions:
0

Re: Categories NOT show an ACTIVE link

Thank youf or that, but it did not seem to work, I can still see the links in the cat sidbox.
and yes, I edited the file under my template :-)

Thx,
Erick

22 Nov 2010, 5:45 PM
#6
gjh42 avatar

gjh42

Black Belt

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

Re: Categories NOT show an ACTIVE link

Perhaps try a simpler but longer way of testing the same thing:

($box_categories_array[$i]['path'] == '8' or $box_categories_array[$i]['path'] == '9' or $box_categories_array[$i]['path'] == '10') or

     if (($box_categories_array[$i]['path'] == '8' or $box_categories_array[$i]['path'] == '9' or $box_categories_array[$i]['path'] == '10') 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)
      } else {  

If it still doesn't work, post the exact content of that part of your tpl_categories.php.

22 Nov 2010, 6:10 PM
#7
gloerick avatar

gloerick

Zen Follower

Join Date:
Feb 2006
Location:
Boise, ID
Posts:
330
Plugin Contributions:
0

Re: Categories NOT show an ACTIVE link

I am sorry, and do appriciate the help, but still a no go,

I but in both \efpsupply\includes\templates\theme226\sideboxes "MY TEMPLATE"
AND \efpsupply\includes\templates\template_default\sideboxes "THE DEFAULT TEMPLATE"

But the page changes in no way.

I know I am in the right spot under my template as I can remove ALL the code you show and it screws
the page up, but with both your changes the cats still show in the categories sidebox.

any thoughts ?

22 Nov 2010, 6:47 PM
#8
gjh42 avatar

gjh42

Black Belt

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

Re: Categories NOT show an ACTIVE link

Either of those will work in stock Zen Cart, so your Template Monster template may have changed something about the way the sidebox works. I can't advise further without seeing your template copy of the file.

22 Nov 2010, 6:51 PM
#9
gloerick avatar

gloerick

Zen Follower

Join Date:
Feb 2006
Location:
Boise, ID
Posts:
330
Plugin Contributions:
0

Re: Categories NOT show an ACTIVE link

I can not see another way of transfering the file so here is ALL the code of the tpl_categories.php

<?php /** * Side Box Template * * @package templateSystem * @copyright Copyright 2003-2006 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: tpl_categories.php 4162 2006-08-17 03:55:02Z ajeh $ */ $content = ""; $content .= '<div id="' . str_replace('_', '-', $box_id . 'Content') . '" class="sideBoxContent">' . "\n"; $content .= '<ul>' . "\n"; $li_class=""; for ($i=0;$i<sizeof($box_categories_array);$i++) { switch(true) { // to make a specific category stand out define a new class in the stylesheet example: A.category-holiday // uncomment the select below and set the cPath=3 to the cPath= your_categories_id // many variations of this can be done // case ($box_categories_array[$i]['path'] == 'cPath=3'): // $new_style = 'category-holiday'; // break; case ($box_categories_array[$i]['top'] == 'true'): if($i == 0) { $new_style = 'category-top_un'; $li_class='<li class="category-top_un"><span class="top-span">'; break; } else{ $new_style = 'category-top'; $li_class='<li class="category-top"><span class="top-span">'; break; } case ($box_categories_array[$i]['has_sub_cat']): $new_style = 'category-subs'; $li_class='<li class="category-subs"><span class="top-span">'; break; default: $new_style = 'category-products'; $li_class='<li class="category-products"><span class="top-span">'; break; } if (($box_categories_array[$i]['path'] == '8' or $box_categories_array[$i]['path'] == '9' or $box_categories_array[$i]['path'] == '10') 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) } else { $content .= $li_class; $content .= '<a class="' . $new_style . '" href="' . zen_href_link(FILENAME_DEFAULT, $box_categories_array[$i]['path']) . '">'; if ($box_categories_array[$i]['current']) { if ($box_categories_array[$i]['has_sub_cat']) { $content .= '<span class="category-subs-parent">' . $box_categories_array[$i]['name'] . '</span>'; } else { $content .= '<span class="category-subs-selected">' . $box_categories_array[$i]['name'] . '</span>'; } } else { $content .= $box_categories_array[$i]['name']; } if ($box_categories_array[$i]['has_sub_cat']) { $content .= CATEGORIES_SEPARATOR; } $content .= '</a>'; if (SHOW_COUNTS == 'true') { if ((CATEGORIES_COUNT_ZERO == '1' and $box_categories_array[$i]['count'] == 0) or $box_categories_array[$i]['count'] >= 1) { $content .= CATEGORIES_COUNT_PREFIX . $box_categories_array[$i]['count'] . CATEGORIES_COUNT_SUFFIX; } } $content .= '</span></li>'; } } $content .= '</ul>' . "\n"; if (SHOW_CATEGORIES_BOX_SPECIALS == 'true' or SHOW_CATEGORIES_BOX_PRODUCTS_NEW == 'true' or SHOW_CATEGORIES_BOX_FEATURED_PRODUCTS == 'true' or SHOW_CATEGORIES_BOX_PRODUCTS_ALL == 'true') { // display a separator between categories and links if (SHOW_CATEGORIES_SEPARATOR_LINK == '1') { $content .= '<div id="catBoxDivider"></div>' . "\n"; } $content .= '<div class="box_body_2"><ul>'; if (SHOW_CATEGORIES_BOX_SPECIALS == 'true') { $show_this = $db->Execute("select s.products_id from " . TABLE_SPECIALS . " s where s.status= 1 limit 1"); if ($show_this->RecordCount() > 0) { $content .= '<li><a class="category-links" href="' . zen_href_link(FILENAME_SPECIALS) . '">' . CATEGORIES_BOX_HEADING_SPECIALS . '</a></li>' . "\n"; } } if (SHOW_CATEGORIES_BOX_PRODUCTS_NEW == 'true') { // display limits // $display_limit = zen_get_products_new_timelimit(); $display_limit = zen_get_new_date_range(); $show_this = $db->Execute("select p.products_id from " . TABLE_PRODUCTS . " p where p.products_status = 1 " . $display_limit . " limit 1"); if ($show_this->RecordCount() > 0) { $content .= '<li><a class="category-links" href="' . zen_href_link(FILENAME_PRODUCTS_NEW) . '">' . CATEGORIES_BOX_HEADING_WHATS_NEW . '</a></li>' . "\n"; } } if (SHOW_CATEGORIES_BOX_FEATURED_PRODUCTS == 'true') { $show_this = $db->Execute("select products_id from " . TABLE_FEATURED . " where status= 1 limit 1"); if ($show_this->RecordCount() > 0) { $content .= '<li><a class="category-links" href="' . zen_href_link(FILENAME_FEATURED_PRODUCTS) . '">' . CATEGORIES_BOX_HEADING_FEATURED_PRODUCTS . '</a></li>' . "\n"; } } if (SHOW_CATEGORIES_BOX_PRODUCTS_ALL == 'true') { $content .= '<li><a class="category-links" href="' . zen_href_link(FILENAME_PRODUCTS_ALL) . '">' . CATEGORIES_BOX_HEADING_PRODUCTS_ALL . '</a></li>' . "\n"; } $content .= '</ul></div>'; } $content .= '</div>'; ?>
22 Nov 2010, 7:22 PM
#10
gjh42 avatar

gjh42

Black Belt

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

Re: Categories NOT show an ACTIVE link

I had forgotten that $box_categories_array[$i]['path'] looks like 'cPath=8' and not just '8'. My mods strip that out before using the relevant content.
Use
in_array(str_replace('cPath=','',$box_categories_array[$i]['path']), explode(',', '8,9,10')) or
in the test:

if (in_array(str_replace('cPath=','',$box_categories_array[$i]['path']), explode(',', '2,3,10')) 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)
} else {
22 Nov 2010, 7:48 PM
#11
gloerick avatar

gloerick

Zen Follower

Join Date:
Feb 2006
Location:
Boise, ID
Posts:
330
Plugin Contributions:
0

Re: Categories NOT show an ACTIVE link

THAT WAS IT !!! THANK YOU SO MUCH.

I just changes the cat#s to the 8,9,10 and they are gone. Thank you so much now I do not have
double links on the site.

I hope this helps for others !!!

Thx,
Erick

5 Mar 2011, 9:28 PM
#12
gloerick avatar

gloerick

Zen Follower

Join Date:
Feb 2006
Location:
Boise, ID
Posts:
330
Plugin Contributions:
0

Re: Categories NOT show an ACTIVE link

Hay Black Belt,

This change to get some categories out of the main menu is working great
but dones not seem to work for SUB categories..

if (in_array(str_replace('cPath=','',$box_categories_array[$i]['path']), explode(',', '2,5,8,9,10,11,12,13,17,18,19')) 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)
} else {

IDs 18 & 19 still show in the MAIN menu..
how to get it to exclude the sub cats as well ?

Thx
Erick

6 Mar 2011, 3:30 PM
#14
gloerick avatar

gloerick

Zen Follower

Join Date:
Feb 2006
Location:
Boise, ID
Posts:
330
Plugin Contributions:
0

Re: Categories NOT show an ACTIVE link

That was it!,, you sure do know your stuff !!
Thank you so much, hope this thread can help others.

Thank you
Erick