Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Sign in to follow this  
badjuju

CoolMenu shows Inactive categories

Recommended Posts

Hi,

I've installed CoolMenu and also Enable/Disable categories contribution.

The problem is I have some sub-categories disabled and they do not show up when I click the main category. But the category name still shows up in the pop-up menu.

 

In the coolmenu.php file, I noticed this line: $categories = tep_get_categories('');

I don't know much about OSC or PHP, but it seems that it's getting all categories. I added a new field to the categories table called 'categories_status' which sets the category as active/inactive.

 

How do I only pull the categories with a status code of '1'.

I've searched around for any function similar to tep_get_categories(''), but cannot find this anywhere.

 

Thanks.

Share this post


Link to post
Share on other sites
Guest

badjuju

 

Can you post your solution to this.

 

Cheers Lee

Share this post


Link to post
Share on other sites

Hi. To fix this, I modified general.php so that the queries include the categories_status.

 

Here's an example:

TABLE_CATEGORIES . " where categories_status = '1' and categories_id = '" . $current_category_id . "'");

 

Also verify default.php and all files with similar code.

Share this post


Link to post
Share on other sites
Guest

Thanks badjuju

 

Works Great! :)

Share this post


Link to post
Share on other sites

Hi, can you give some more info about the changes, because I can't get it to work properly. I hope you can give me all the lines you've changed so I can see what I've overlooked.

 

regards,

 

Tom

Share this post


Link to post
Share on other sites

Hi,

 

I fixed it myself, I forgot one in general.php near line 864:

 

////

// Recursively go through the categories and retreive all parent categories IDs

// TABLES: categories

function tep_get_parent_categories(&$categories, $categories_id) {

$parent_categories_query = tep_db_query("select parent_id from " . TABLE_CATEGORIES . " where categories_status = '1' and categories_id = '" . $categories_id . "'");

while ($parent_categories = tep_db_fetch_array($parent_categories_query)) {

if ($parent_categories['parent_id'] == 0) return true;

$categories[sizeof($categories)] = $parent_categories['parent_id'];

if ($parent_categories['parent_id'] != $categories_id) {

tep_get_parent_categories($categories, $parent_categories['parent_id']);

}

}

}

 

 

Thanks,

 

Tom

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×