Zen Cart Logo

hideCategories

Views: 104,790

Results 301 to 320 of 487
20 Jun 2011, 9:42 PM
#301
kamelion0927 avatar

kamelion0927

Zen Follower

Join Date:
Dec 2009
Posts:
208
Plugin Contributions:
1

hideCategories

Alrighty, I think I've got it.

MAKE A BACKUP BEFORE YOU MAKE THIS CHANGE BECAUSE THIS ISN'T AN OVERRIDE FILE and it worked for me, but I'm not 100% sure it is correct.

In includes/modules/pages/advanced_search_result/header.php, find

$from_str = "FROM (" . TABLE_PRODUCTS . " p
             LEFT JOIN " . TABLE_MANUFACTURERS . " m
             USING(manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c )
             LEFT JOIN " . TABLE_META_TAGS_PRODUCTS_DESCRIPTION . " mtpd
             ON mtpd.products_id= p2c.products_id
             AND mtpd.language_id = :languagesID";

and change to

$from_str = "FROM (" . TABLE_HIDE_CATEGORIES . " h, " . TABLE_PRODUCTS . " p
             LEFT JOIN " . TABLE_MANUFACTURERS . " m
             USING(manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c )
             LEFT JOIN " . TABLE_META_TAGS_PRODUCTS_DESCRIPTION . " mtpd
             ON mtpd.products_id= p2c.products_id
             AND mtpd.language_id = :languagesID";

Then find

// Notifier Point
$zco_notifier->notify('NOTIFY_SEARCH_FROM_STRING');

$where_str = " WHERE (p.products_quantity > 0
               AND p.products_status = 1
               AND p.products_id = pd.products_id
               AND pd.language_id = :languagesID
               AND p.products_id = p2c.products_id
               AND p2c.categories_id = c.categories_id ";

and change to

// Notifier Point
$zco_notifier->notify('NOTIFY_SEARCH_FROM_STRING');

$where_str = " WHERE (p.products_quantity > 0
               AND p.products_status = 1
               AND p.products_id = pd.products_id
               AND pd.language_id = :languagesID
               AND p.products_id = p2c.products_id
			   and (p.master_categories_id = h.categories_id and h.visibility_status !=2)
               AND p2c.categories_id = c.categories_id ";

All I did was utilize the code from hideCategories/includes/modules/sideboxes/my_template/whats_new.php and adapted it to fit the search code.

Hopefully it will continue to work and not cause issues with any of my other mods but I would appreciate feedback from someone who knows code as to whether it is the appropriate way to handle this situation.

Thanks!

20 Jun 2011, 10:05 PM
#302
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Re: hideCategories

Will test this out and let you know if I get a similar result..

kamelion0927:

Alrighty, I think I've got it.

MAKE A BACKUP BEFORE YOU MAKE THIS CHANGE BECAUSE THIS ISN'T AN OVERRIDE FILE and it worked for me, but I'm not 100% sure it is correct.

In includes/modules/pages/advanced_search_result/header.php, find

$from_str = "FROM (" . TABLE_PRODUCTS . " p
LEFT JOIN " . TABLE_MANUFACTURERS . " m
USING(manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c )
LEFT JOIN " . TABLE_META_TAGS_PRODUCTS_DESCRIPTION . " mtpd
ON mtpd.products_id= p2c.products_id
AND mtpd.language_id = :languagesID";

> ```php
$from_str = "FROM (" . TABLE_HIDE_CATEGORIES . " h, " . TABLE_PRODUCTS . " p
             LEFT JOIN " . TABLE_MANUFACTURERS . " m
             USING(manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c )
             LEFT JOIN " . TABLE_META_TAGS_PRODUCTS_DESCRIPTION . " mtpd
             ON mtpd.products_id= p2c.products_id
             AND mtpd.language_id = :languagesID";
```Then find
> ```php
// Notifier Point
$zco_notifier->notify('NOTIFY_SEARCH_FROM_STRING');

$where_str = " WHERE (p.products_quantity > 0
               AND p.products_status = 1
               AND p.products_id = pd.products_id
               AND pd.language_id = :languagesID
               AND p.products_id = p2c.products_id
               AND p2c.categories_id = c.categories_id ";
```and change to
> ```php
// Notifier Point
$zco_notifier->notify('NOTIFY_SEARCH_FROM_STRING');

$where_str = " WHERE (p.products_quantity > 0
               AND p.products_status = 1
               AND p.products_id = pd.products_id
               AND pd.language_id = :languagesID
               AND p.products_id = p2c.products_id
               and (p.master_categories_id = h.categories_id and h.visibility_status !=2)
               AND p2c.categories_id = c.categories_id ";
```All I did was utilize the code from hideCategories/includes/modules/sideboxes/my_template/whats_new.php and adapted it to fit the search code. 
> 
> Hopefully it will continue to work and not cause issues with any of my other mods but I would appreciate feedback from someone who knows code as to whether it is the appropriate way to handle this situation.
> 
> Thanks!
20 Jun 2011, 10:18 PM
#303
kamelion0927 avatar

kamelion0927

Zen Follower

Join Date:
Dec 2009
Posts:
208
Plugin Contributions:
1

Re: hideCategories

DivaVocals:

Will test this out and let you know if I get a similar result..

Much appreciated.

21 Jun 2011, 2:18 PM
#304
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Re: hideCategories

What version of Zen Cart are you running?? The code in my files looks slightly different than what you posted.. In particular that second code block. This is what my original file looks like:

// Notifier Point
$zco_notifier->notify('NOTIFY_SEARCH_FROM_STRING');

$where_str = " WHERE (p.products_status = 1
               AND p.products_id = pd.products_id
               AND pd.language_id = :languagesID
               AND p.products_id = p2c.products_id
               AND p2c.categories_id = c.categories_id ";
```BUT...

This is what you posted as part of your original file:
```php
// Notifier Point
$zco_notifier->notify('NOTIFY_SEARCH_FROM_STRING');

$where_str = " WHERE (p.products_quantity > 0
               AND p.products_status = 1
               AND p.products_id = pd.products_id
               AND pd.language_id = :languagesID
               AND p.products_id = p2c.products_id
               AND p2c.categories_id = c.categories_id ";
```> **kamelion0927:**
>
> Alrighty, I think I've got it.
> 
> MAKE A BACKUP BEFORE YOU MAKE THIS CHANGE BECAUSE THIS ISN'T AN OVERRIDE FILE and it worked for me, but I'm not 100% sure it is correct.
> 
> In includes/modules/pages/advanced_search_result/header.php, find
> ```php
$from_str = "FROM (" . TABLE_PRODUCTS . " p
             LEFT JOIN " . TABLE_MANUFACTURERS . " m
             USING(manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c )
             LEFT JOIN " . TABLE_META_TAGS_PRODUCTS_DESCRIPTION . " mtpd
             ON mtpd.products_id= p2c.products_id
             AND mtpd.language_id = :languagesID";
```and change to
> ```php
$from_str = "FROM (" . TABLE_HIDE_CATEGORIES . " h, " . TABLE_PRODUCTS . " p
             LEFT JOIN " . TABLE_MANUFACTURERS . " m
             USING(manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c )
             LEFT JOIN " . TABLE_META_TAGS_PRODUCTS_DESCRIPTION . " mtpd
             ON mtpd.products_id= p2c.products_id
             AND mtpd.language_id = :languagesID";
```Then find
> ```php
// Notifier Point
$zco_notifier->notify('NOTIFY_SEARCH_FROM_STRING');

$where_str = " WHERE (p.products_quantity > 0
               AND p.products_status = 1
               AND p.products_id = pd.products_id
               AND pd.language_id = :languagesID
               AND p.products_id = p2c.products_id
               AND p2c.categories_id = c.categories_id ";
```and change to
> ```php
// Notifier Point
$zco_notifier->notify('NOTIFY_SEARCH_FROM_STRING');

$where_str = " WHERE (p.products_quantity > 0
               AND p.products_status = 1
               AND p.products_id = pd.products_id
               AND pd.language_id = :languagesID
               AND p.products_id = p2c.products_id
               and (p.master_categories_id = h.categories_id and h.visibility_status !=2)
               AND p2c.categories_id = c.categories_id ";
```All I did was utilize the code from hideCategories/includes/modules/sideboxes/my_template/whats_new.php and adapted it to fit the search code. 
> 
> Hopefully it will continue to work and not cause issues with any of my other mods but I would appreciate feedback from someone who knows code as to whether it is the appropriate way to handle this situation.
> 
> Thanks!
21 Jun 2011, 5:20 PM
#305
kamelion0927 avatar

kamelion0927

Zen Follower

Join Date:
Dec 2009
Posts:
208
Plugin Contributions:
1

Re: hideCategories

DivaVocals:

What version of Zen Cart are you running?? The code in my files looks slightly different than what you posted.. In particular that second code block. This is what my original file looks like:

// Notifier Point
$zco_notifier->notify('NOTIFY_SEARCH_FROM_STRING');

$where_str = " WHERE (p.products_status = 1
AND p.products_id = pd.products_id
AND pd.language_id = :languagesID
AND p.products_id = p2c.products_id
AND p2c.categories_id = c.categories_id ";

> 
> This is what you posted as part of your original file:
> ```php
// Notifier Point
$zco_notifier->notify('NOTIFY_SEARCH_FROM_STRING');

$where_str = " WHERE (p.products_quantity > 0
               AND p.products_status = 1
               AND p.products_id = pd.products_id
               AND pd.language_id = :languagesID
               AND p.products_id = p2c.products_id
               AND p2c.categories_id = c.categories_id ";

I am running 1.39h. My apologies - I modified that block of code prior to tackling the hideCategories search issue (if I look the files for one issue for too long, I get cross-eyed so I jump around from issue to issue). If anyone is interested, the modified code that I used is for hiding sold out items from the search (a lot of my stock are one-of-a-kinds so there isn't any use for them to be in the search after they're sold).

The unmodified code would be as you stated.

// Notifier Point
$zco_notifier->notify('NOTIFY_SEARCH_FROM_STRING');

$where_str = " WHERE (p.products_status = 1
               AND p.products_id = pd.products_id
               AND pd.language_id = :languagesID
               AND p.products_id = p2c.products_id
               AND p2c.categories_id = c.categories_id ";
21 Jun 2011, 5:23 PM
#306
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Re: hideCategories

Got it.. I knew the code you posted was meant to exclude sold out items.. Just wasn't sure where it came from..:laugh::laugh: Will let you know what my test results reveal..

kamelion0927:

I am running 1.39h. My apologies - I modified that block of code prior to tackling the hideCategories search issue (if I look the files for one issue for too long, I get cross-eyed so I jump around from issue to issue). If anyone is interested, the modified code that I used is for hiding sold out items from the search (a lot of my stock are one-of-a-kinds so there isn't any use for them to be in the search after they're sold).

The unmodified code would be as you stated.

// Notifier Point
$zco_notifier->notify('NOTIFY_SEARCH_FROM_STRING');

$where_str = " WHERE (p.products_status = 1
AND p.products_id = pd.products_id
AND pd.language_id = :languagesID
AND p.products_id = p2c.products_id
AND p2c.categories_id = c.categories_id ";

21 Jun 2011, 5:36 PM
#307
kamelion0927 avatar

kamelion0927

Zen Follower

Join Date:
Dec 2009
Posts:
208
Plugin Contributions:
1

Re: hideCategories

DivaVocals:

Got it.. I knew the code you posted was meant to exclude sold out items.. Just wasn't sure where it came from..:laugh::laugh: Will let you know what my test results reveal..

Thanks for calling me on it - I forget when I change stuff and you know someone else will be looking at my post and thinking, "What the?!? My code doesn't match hers..." Been there, done that and it's frustrating when your code doesn't match what you're supposed to change.

Thanks for testing it! :clap:

21 Jun 2011, 5:53 PM
#308
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Re: hideCategories

kamelion0927:

Thanks for calling me on it - I forget when I change stuff and you know someone else will be looking at my post and thinking, "What the?!? My code doesn't match hers..." Been there, done that and it's frustrating when your code doesn't match what you're supposed to change.

Thanks for testing it! :clap:No problem.. Thank YOU for plugging away at this.. I did a little digging, and realized that Advanced Search stopped working in this version due to a change I made to hideCategories to resolve an issue with a duplicated join. The code I removed was meant to keep hidden products out of the searches, but it caused other issues when run under SQL5..

So I am hoping my testing confirms/backs up yours.. :smile:

21 Jun 2011, 8:43 PM
#309
kamelion0927 avatar

kamelion0927

Zen Follower

Join Date:
Dec 2009
Posts:
208
Plugin Contributions:
1

Re: hideCategories

DivaVocals:

No problem.. Thank YOU for plugging away at this.. I did a little digging, and realized that Advanced Search stopped working in this version due to a change I made to hideCategories to resolve an issue with a duplicated join. The code I removed was meant to keep hidden products out of the searches, but it caused other issues when run under SQL5..

So I am hoping my testing confirms/backs up yours.. :smile:

Thanks for acknowledging - I'm just happy to be able to give just a little bit back.

I thought the modifications to product_listing.php were for hiding products from the search (being so crappy with coding, it's nice to know I've been picking some things up :D).

The changes in product_listing.php may have made it so the products show in the search, but at least thanks to you, the mod is working - I'm hoping to do Custom Orders which would be a lot more difficult without this mod. And figuring out how to hide hidden products from the search query was the easy part of updating the mod.

In fact, I think 3/4 of my site was built with your help (not only the mods that you've worked on, but a lot of your posts have kept me from having to ask a ton of questions as well as giving me a laugh once in a while) so thanks for all your hard work!

22 Jun 2011, 3:06 AM
#310
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Re: hideCategories

Oh yes.. I'm glad you found an alternate solution (still need to test to confirm your results).. The duplicate join caused quite an issue for a few of my clients.. (I documented the issue) I REALLY didn't want to have to restore that code..

kamelion0927:

Thanks for acknowledging - I'm just happy to be able to give just a little bit back.

I thought the modifications to product_listing.php were for hiding products from the search (being so crappy with coding, it's nice to know I've been picking some things up :D).

The changes in product_listing.php may have made it so the products show in the search, but at least thanks to you, the mod is working - I'm hoping to do Custom Orders which would be a lot more difficult without this mod. And figuring out how to hide hidden products from the search query was the easy part of updating the mod.

Well I'm glad I could be of some small amount of help.. :laugh: Would love to know what I said that was funny though..:laugh::laugh:

kamelion0927:

In fact, I think 3/4 of my site was built with your help (not only the mods that you've worked on, but a lot of your posts have kept me from having to ask a ton of questions as well as giving me a laugh once in a while) so thanks for all your hard work!

24 Jun 2011, 7:18 AM
#311
kamelion0927 avatar

kamelion0927

Zen Follower

Join Date:
Dec 2009
Posts:
208
Plugin Contributions:
1

Re: hideCategories

DivaVocals:

Oh yes.. I'm glad you found an alternate solution (still need to test to confirm your results).. The duplicate join caused quite an issue for a few of my clients.. (I documented the issue) I REALLY didn't want to have to restore that code..

We're all glad you didn't have to restore that code - it would have been really messy. Hopefully the code I borrowed from the sidebox code in the mod will hold up in the search function. (fingers crossed)

DivaVocals:

Well I'm glad I could be of some small amount of help.. :laugh: Would love to know what I said that was funny though..:laugh::laugh:

Sorry - can't recall specific posts. Although a couple of them were your responses to when you took the time to help someone and they just posted "fixed it"; even with your rather prominent signature. People just crack me up. :laugh:

24 Jun 2011, 2:01 PM
#312
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Re: hideCategories

kamelion0927:

We're all glad you didn't have to restore that code - it would have been really messy. Hopefully the code I borrowed from the sidebox code in the mod will hold up in the search function. (fingers crossed)Me too.. I think your code will be just fine.. My apologies for the delay in testing.. Hoping to do it and a lot of other stuff I need to do this weekend..

kamelion0927:

Sorry - can't recall specific posts. Although a couple of them were your responses to when you took the time to help someone and they just posted "fixed it"; even with your rather prominent signature. People just crack me up. :laugh:People are indeed funny!!:laugh:

24 Jun 2011, 6:21 PM
#313
kamelion0927 avatar

kamelion0927

Zen Follower

Join Date:
Dec 2009
Posts:
208
Plugin Contributions:
1

Re: hideCategories

DivaVocals:

Me too.. I think your code will be just fine.. My apologies for the delay in testing.. Hoping to do it and a lot of other stuff I need to do this weekend..

It's all good - not an imperative issue. Take your time, I know you'll get to it when you can. :smile:

27 Jun 2011, 12:43 PM
#314
ardhill avatar

ardhill

New Zenner

Join Date:
Dec 2007
Location:
Belfast, N.Ireland
Posts:
99
Plugin Contributions:
0

Re: hideCategories

I may have messed up merging the files on my already modified site, or it could be the fact that I have put this mod onto a earlier version of ZenCart but, has anyone else noticed the following issue?

I installed the mod, and all is well, except I have lost the ability to give my categories a 'sort order'.

When I went into each category after installing, to save it as visible or hidden, I had no way of stating a sort order, and it saved each category sort order as '0'.

I have it on V139d instead of the latest as I am working on the latest version with a few other changes, but haven't got it in a place for going live as yet.

I was just wondering it I have messed up, or has anyone else noticed this?

Thanks,

Paul

27 Jun 2011, 3:03 PM
#315
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Re: hideCategories

If you took a look through this support thread you would have seen that that this issue has never been reported. Leads me to conclude that you have done something incorrect in your merging..

ardhill:

I may have messed up merging the files on my already modified site, or it could be the fact that I have put this mod onto a earlier version of ZenCart but, has anyone else noticed the following issue?

I installed the mod, and all is well, except I have lost the ability to give my categories a 'sort order'.

When I went into each category after installing, to save it as visible or hidden, I had no way of stating a sort order, and it saved each category sort order as '0'.

I have it on V139d instead of the latest as I am working on the latest version with a few other changes, but haven't got it in a place for going live as yet.

I was just wondering it I have messed up, or has anyone else noticed this?

Thanks,

Paul

27 Jun 2011, 4:08 PM
#316
ardhill avatar

ardhill

New Zenner

Join Date:
Dec 2007
Location:
Belfast, N.Ireland
Posts:
99
Plugin Contributions:
0

Re: hideCategories

I don't doubt that it was my doing as I had my 6mth old at the same time as reading install instruction and merging files. Bouncing baby and reading instructions, feeding baby and opening win merge, playing with baby and finding differences in code etc...

Never a great combination, but needs must when you are a Daddy of a young baby.

I remember the day when I used to have spare time to concentrate on stuff like this :smile:

But, I thought I would ask as it is possible that something hadn't been noticed in the mod. You can't be expected to see all the issues yourself.

28 Jun 2011, 8:23 PM
#317
crkone avatar

crkone

New Zenner

Join Date:
Jun 2011
Posts:
2
Plugin Contributions:
0

Re: hideCategories

i have a noob problem, i installed and its working great, my problem is that this changed the style of the box on my site (mycrystale.com)

if you look at the "Choose Your Color" page, you will see what it used to look like... i would like the new box with the hidden categories to look the same as this page..... any thoughts?

28 Jun 2011, 8:41 PM
#318
crkone avatar

crkone

New Zenner

Join Date:
Jun 2011
Posts:
2
Plugin Contributions:
0

Re: hideCategories

Here is my current php files..... help please

crkone:

i have a noob problem, i installed and its working great, my problem is that this changed the style of the box on my site (mycrystale.com)

if you look at the "Choose Your Color" page, you will see what it used to look like... i would like the new box with the hidden categories to look the same as this page..... any thoughts?

old tpl_categories.php

<?php 
/** 
 * Side Box Template 
 * 
 * @package templateSystem 
 * @copyright Copyright 2003-2006 Zen Cart Development Team 
 * @copyright Portions Copyright 2003 osCommerce 
 * @license [url]http://www.zen-cart.com/license/2_0.txt[/url] 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=""; 
  $levels = array(); 
   
  $j = 0; 
  foreach($main_category_tree->tree as $key => $value){ 
      for ($i=0;$i<sizeof($box_categories_array);$i++){ 
        if($box_categories_array[$i]['path'] == 'cPath=' . $value['path']){ 
            $levels[$i] = $value['level']; 
        } 
    } 
    $j++; 
  } 
  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" style="padding-left:' . 15 * ($levels[$i]) . 'px"><span class="top-span">'; 
        break; 
      default: 
        $new_style = 'category-products'; 
        $li_class='<li class="category-products" style="padding-left:' . 15 * ($levels[$i]) . 'px"><span class="top-span">'; 
        break; 
         
      } 
       
     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 { 
      $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-selected">' . $box_categories_array[$i]['name'] . CATEGORIES_SEPARATOR . '</span>'; 
        } else { 
          $content .= '<span class="category-subs-selected">' . $box_categories_array[$i]['name'] . '</span>'; 
        } 
      } else { 
	  	if ($box_categories_array[$i]['has_sub_cat']) { 
          $content .= '<span class="category-subs-parent">' . $box_categories_array[$i]['name'] . CATEGORIES_SEPARATOR .'</span>'; 
        } else
        $content .= $box_categories_array[$i]['name']; 
      } 

      
      $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>'; 
?>

new tpl_categories.pho

<?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";
  for ($i=0;$i<sizeof($box_categories_array);$i++) {
//  Begin hideCategories code
    list($nada, $mycpath)= split('=', $box_categories_array[$i]['path']);
    $mycid = split('_', $mycpath);
    $categories_id = array_pop($mycid);
    $hide_status = $db->Execute("select visibility_status 
    				FROM " . TABLE_HIDE_CATEGORIES . "
    				WHERE categories_id = " . $categories_id . "
    				LIMIT 1");
    if ($hide_status->fields['visibility_status'] < 1) {
//  End hideCategories code
    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'):
        $new_style = 'category-top';
        break;
      case ($box_categories_array[$i]['has_sub_cat']):
        $new_style = 'category-subs';
        break;
      default:
        $new_style = 'category-products';
      }
     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 {
      $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 .= '<br />' . "\n";
    }
  }
  } //  hideCategories code
  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 == '0') {
      $content .= '<hr id="catBoxDivider" />' . "\n";
    }
    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 .= '<a class="category-links" href="' . zen_href_link(FILENAME_SPECIALS) . '">' . CATEGORIES_BOX_HEADING_SPECIALS . '</a>' . '<br />' . "\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 .= '<a class="category-links" href="' . zen_href_link(FILENAME_PRODUCTS_NEW) . '">' . CATEGORIES_BOX_HEADING_WHATS_NEW . '</a>' . '<br />' . "\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 .= '<a class="category-links" href="' . zen_href_link(FILENAME_FEATURED_PRODUCTS) . '">' . CATEGORIES_BOX_HEADING_FEATURED_PRODUCTS . '</a>' . '<br />' . "\n";
      }
    }
    if (SHOW_CATEGORIES_BOX_PRODUCTS_ALL == 'true') {
      $content .= '<a class="category-links" href="' . zen_href_link(FILENAME_PRODUCTS_ALL) . '">' . CATEGORIES_BOX_HEADING_PRODUCTS_ALL . '</a>' . "\n";
    }
  }
  $content .= '</div>';
?>
29 Jun 2011, 11:05 AM
#319
ardhill avatar

ardhill

New Zenner

Join Date:
Dec 2007
Location:
Belfast, N.Ireland
Posts:
99
Plugin Contributions:
0

Re: hideCategories

Hi crkone

Did you just copy all the files from the Hide Categories mod into your site?

It looks like you did, in which case you will have overwritten your existing files with the ones supplied in this mod.

The problem with that is that you will loose all you custom code - the stuff that mades your site look and operate as it does.

With any mod, unless they are extra files that do not exist already in your site, you need to compare the code in each file with the ones you already have in your site. When you find the bits that the mod author has modified/added then you copy these 'parts' into your existing files. You either just copy and add the bits to the appropraite place, or sometimes use them to replace existing code.

Personally I use a programme called WinMerge to help me find the differences in the code. You can download it free for a windows pc.

Because you already had a file with the same name in your custom folder, you should have found the changed code in the mod, then added that to your existing php page.

For instance, in the file that you mention, the following code needed to be found in the mod, then copied to the appropriate place in your existing page (I put some line breaks round it to stand out on here for you):

<?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";
  for ($i=0;$i<sizeof($box_categories_array);$i++) {




//  Begin hideCategories code
    list($nada, $mycpath)= split('=', $box_categories_array[$i]['path']);
    $mycid = split('_', $mycpath);
    $categories_id = array_pop($mycid);
    $hide_status = $db->Execute("select visibility_status 
    				FROM " . TABLE_HIDE_CATEGORIES . "
    				WHERE categories_id = " . $categories_id . "
    				LIMIT 1");
    if ($hide_status->fields['visibility_status'] < 1) {
//  End hideCategories code




    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';
//

There is some details on how customisation of zen cart works here:
http://www.zen-cart.com/wiki/index.php/Customisation

I hope this helps,

Paul

9 Jul 2011, 2:55 AM
#320
triple_moon_ranch avatar

triple_moon_ranch

New Zenner

Join Date:
Feb 2008
Posts:
15
Plugin Contributions:
0

Re: hideCategories

I just installed this mod and checked everything twice. All the files are in the places they are supossed to be I have loaded the sql through admin, by copying it and pasting it in. I have opened and resaved my catagorys, and even created a new one to try that. But I get nothing different than what was there before I installed the mod. No icons, no choice to make hidden nothing new??

I did not however install the optional files in folder 2 because it did say they were optional and I do not need what they would do.

I am using zen 1.3.9h

Thanks so much for any help in advance