Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

tep_get_category_tree but then just for main categorys?


jps001

Recommended Posts

Posted

Hello,

 

Can some help me out.

I use Easy Populate but with the load of categorys i now have EP crashes when i open it.

 

If i out commet the dropdown for categorys it opens in a flash of a second.

 

Now i think it would help is i dont get al the sub,sub,sub,... categorys but just the main categorys instead.

 

can someone help me out to rewrite the function tep_get_category_tree ?

 

I use OSC2.2rc1 and this is the original function

 function tep_get_category_tree($parent_id = '0', $spacing = '', $exclude = '', $category_tree_array = '', $include_itself = false) {
global $languages_id;
if (!is_array($category_tree_array)) $category_tree_array = array();
if ( (sizeof($category_tree_array) < 1) && ($exclude != '0') ) $category_tree_array[] = array('id' => '0', 'text' => TEXT_TOP);
if ($include_itself) {
 	$category_query = tep_db_query("select cd.categories_name from " . TABLE_CATEGORIES_DESCRIPTION . " cd where cd.language_id = '" . (int)$languages_id . "' and cd.categories_id = '" . (int)$parent_id . "'");
 	$category = tep_db_fetch_array($category_query);
 	$category_tree_array[] = array('id' => $parent_id, 'text' => $category['categories_name']);
}
$categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' and c.parent_id = '" . (int)$parent_id . "' order by c.sort_order, cd.categories_name");
while ($categories = tep_db_fetch_array($categories_query)) {
 	if ($exclude != $categories['categories_id']) $category_tree_array[] = array('id' => $categories['categories_id'], 'text' => $spacing . $categories['categories_name']);
 	$category_tree_array = tep_get_category_tree($categories['categories_id'], $spacing . '   ', $exclude, $category_tree_array);
}
return $category_tree_array;
 }

 

Regards,

 

jasper

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...