Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Need to find the category name that goes with the id!!


demon2lima

Recommended Posts

I am trying to modify the osCommerce.XML contrib so it will actually work on new items. I need help comming up with the code to link the category id to the category name.

 

This grabs the category id to populate a drop down menu for the export feature. What I need to do is tie the id to the name so I can insert it in to the output XML file.

 

Any ideas?

 

function get_categories_ids($parent_id=0) {
$categories=tep_db_query("select categories_id from ".TABLE_CATEGORIES." where parent_id='".$parent_id."'");
while ($category=tep_db_fetch_array($categories)) {
  $categories_ids[]=$category['categories_id'];
  $categories_ids=array_merge($categories_ids, get_categories_ids($category['categories_id']));
}
return $categories_ids;
 }

 $categories_ids[]=$categories_id;
 $categories_ids=array_merge($categories_ids, get_categories_ids($_POST['categories_id']));

 $categories_ids = array_filter($categories_ids);

 $products=tep_db_query("select * from ".TABLE_PRODUCTS." left join ".TABLE_PRODUCTS_DESCRIPTION." using(products_id) left join ".TABLE_PRODUCTS_TO_CATEGORIES." using(products_id) where language_id='".$languages_id."' and categories_id in (".implode($categories_ids, ', ').")");

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...