Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Search Help. It does not search all categories.


spasmos

Recommended Posts

Posted

Good,

 

I have problems finding a Oscommerce, particularly in the quick search. The product table has uan kind of attribute "code" and when I do an advanced search through this code is the product sometimes and sometimes not even the attribute is there. I think the error is in the sql but can not find the problem or understand pq sometimes works and sometimes not. The SQL is this:

 

if (!tep_session_is_registered('customer_id')) {
   $listing_sql = "select distinct p.products_weight, p.products_image, m.manufacturers_id, p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from ((products p) left join manufacturers m using(manufacturers_id), products_description pd) left join specials s on p.products_id = s.products_id, categories c, products_to_categories p2c where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and c.groups_id='1' and p2c.categories_id = c.categories_id and p.products_id = p2c.products_id and ((p.products_code like '%" . $search_p_code[0] . "%') ) order by pd.products_name";
 }
 else {
   $listing_sql = "select distinct p.products_weight, p.products_image, m.manufacturers_id, p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from ((products p) left join manufacturers m using(manufacturers_id), products_description pd) left join specials s on p.products_id = s.products_id, categories c, products_to_categories p2c, " . TABLE_CUSTOMERS_TO_GROUPS . " c2g where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and c2g.customers_id='" . $customer_id . "' and c.groups_id=c2g.groups_id and p2c.categories_id = c.categories_id and p.products_id = p2c.products_id and ((p.products_code like '%" . $search_p_code[0] . "%') ) order by pd.products_name";
 }

 

I you can lend a hand please?.

 

Thank you.

Archived

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

×
×
  • Create New...