Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

CoolMenu shows Inactive categories


badjuju

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.

Link to comment
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.

Link to comment
Share on other sites

  • 1 month later...

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

Link to comment
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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...