Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Changing this piece of code to retrieve manufactur


Applied

Recommended Posts

Posted

This code retrieves a product from the same category and I'd like it to instead show a product from the same manufacturer. Can someone tell me what I need to change in the code below?

 

 

 

// Find the id # of the category that the current product is in
   $category_query = tep_db_query("select categories_id 
                                from " . TABLE_PRODUCTS_TO_CATEGORIES . " 
      	 where products_id = '" . (int)$_GET['products_id'] . "'"
                                 );
   $category = tep_db_fetch_array($category_query);
   $category_id = $category['categories_id'];

// Select the other products in the same category
   $products_query = tep_db_query("select p.products_id, 
                                          p.products_image,
                                          p.products_price,
                                          p.products_model,
                                          pd.products_name
                                   from " . TABLE_PRODUCTS . " p,  
                                        " . TABLE_PRODUCTS_DESCRIPTION . " pd,  
                                        " . TABLE_PRODUCTS_TO_CATEGORIES . " pc  
                                   where p.products_id = pc.products_id
                                     and p.products_id = pd.products_id
                                     and p.products_id != '" . (int)$_GET['products_id'] . "'
                                     and p.products_status = '1'
                                     and pc.categories_id = '" . (int)$category_id . "'
                                     and pd.language_id = '" . (int)$languages_id . "'
                                   order by " . $sort_order . " 
                                   limit " . MAX_SIMILAR_PRODUCTS
                                 );

Posted

anyone? I can't figure it out, but I don't think it'd be difficult for someone experienced in this.

  • 2 months later...
Posted

I don't know why when I remove category with manufacturer id's it doesn't work. can anyone help me here?

Archived

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

×
×
  • Create New...