Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

HOW TO? Query for a Product's Parent and SubCategory Location


screenprintdude

Recommended Posts

Posted

Okay, here is what I am working with and then I'll explain

  
$attributes = tep_db_query($attributes);
 while ($attributes_values = tep_db_fetch_array($attributes)) {
// select pa.*, pd.products_name from " . TABLE_PRODUCTS_ATTRIBUTES . " pa left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on pa.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by pd.products_name  
//	$products_name_only = tep_get_products_name($attributes_values['products_id']);
//********************************************************************************
*******
	$products_model_only = tep_db_fetch_array(tep_db_query ("select p.products_model from " . TABLE_PRODUCTS . " p where p.products_id = " . $attributes_values[products_id] ." ")); 
//********************************************************************************
*******
	// added ability to display the preceding Product Model Instead of Just the name since you can have multiple product Models with the Same Name or Brand identifier within the product
	$products_category_location_only = tep_db_fetch_array(tep_db_query ("select cd.categories_name from " . TABLE_CATEGORIES_DESCRIPTION . " cd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c
where cd.categories_id = (select p2c.categories_id from " . TABLE_PRODUCTS_TO_CATEGORIES .
					" p2c where p2c.products_id=" . $attributes_values['products_id'] ." limit 1)"));

$products_name_only = '<b>' . $products_model_only['products_model'] . '</b>    ' .$attributes_values['products_name'] . '   <b>=>  ' . $products_category_location_only[categories_name] ."</b>";

 

In the item >> $products_category_location_only I have attempted to call the products' resident category. Of course this only provides the last most category the items resides in. I need to query and ECHO the whole location of a product's category tree.

 

I need to see the location in the echoed list of products attributes at the bottom of the page and in the selection/option box in the Products Attributes section. My trouble is that as we build a product list in the store, I may have two products with identical product model numbers in different categories for different customers. Once I set the product up, I want to be able to insure that I am editing attributes and pricing specific to the correct product in its correct category.

 

I know that my SQL code is not right, but it currently does echo the correct location of the list, but not in the <option> list.

 

I have wracked my brains and am trying to be as specific and descriptive as possible. Can some one help me with this?

 

Thanks a lot. :blink:

Archived

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

×
×
  • Create New...