tim_ver Posted June 12, 2014 Share Posted June 12, 2014 I have an issue with the search option. I put in scan code numbers for my products, so I can quickly look them up when I scan a product. When I scan them in the catalog the number pops in the search box, and finds the product with no issues. But in the admin panel it does not find it when I do the scan. Why is this how can I fix this issue? Thanks Link to comment Share on other sites More sharing options...
Jack_mcs Posted June 12, 2014 Share Posted June 12, 2014 The search code in admin doesn't search descriptions, assuming that is where you have the numbers. That would have to be added. Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
tim_ver Posted June 12, 2014 Author Share Posted June 12, 2014 Yes, how do I update/add the code so it does this? Link to comment Share on other sites More sharing options...
Jack_mcs Posted June 12, 2014 Share Posted June 12, 2014 Find this in the categories.php file if (isset($HTTP_GET_VARS['search'])) { $products_query = tep_db_query("select p.products_id, pd.products_name, and change it to if (isset($HTTP_GET_VARS['search'])) { $products_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
tim_ver Posted June 12, 2014 Author Share Posted June 12, 2014 Ok, I just got back to test this. I was off and where it was being put in, it is in the Products Model: Here is the code I have for it now: if (isset($HTTP_GET_VARS['search'])) { $products_query = tep_db_query("select p.products_id, pd.products_name, p.products_quantity, p.products_image, p.products_price, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status, p2c.categories_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = p2c.products_id and pd.products_name like '%" . tep_db_input($search) . "%' order by pd.products_name"); } else { $products_query = tep_db_query("select p.products_id, pd.products_name, p.products_quantity, p.products_image, p.products_price, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = '" . (int)$current_category_id . "' order by pd.products_name"); } while ($products = tep_db_fetch_array($products_query)) { $products_count++; $rows++; Link to comment Share on other sites More sharing options...
Jack_mcs Posted June 13, 2014 Share Posted June 13, 2014 Then you need to add p.products_model instead of pd.products_description, though that can stay in if you want to search it too. Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
tim_ver Posted June 13, 2014 Author Share Posted June 13, 2014 Ok, added it and still not working. Here is the updated code below. if (isset($HTTP_GET_VARS['search'])) { $products_query = tep_db_query("select p.products_id, pd.products_name, p.products_quantity, p.products_image, p.products_model, p.products_price, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status, p2c.categories_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = p2c.products_id and pd.products_name like '%" . tep_db_input($search) . "%' order by pd.products_name"); } else { $products_query = tep_db_query("select p.products_id, pd.products_name, p.products_quantity, p.products_image, p.products_model, p.products_price, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = '" . (int)$current_category_id . "' order by pd.products_name"); } while ($products = tep_db_fetch_array($products_query)) { $products_count++; $rows++; Link to comment Share on other sites More sharing options...
multimixer Posted June 13, 2014 Share Posted June 13, 2014 You need to add the model to the "where" clause as well or p.products_model like '%" . tep_db_input($search) . "%' or if you want or p.products_model = '" . tep_db_input($search) . "' Add this after part of the query that is and pd.products_name like '%" . tep_db_input($search) . "%' My community profile | Template system for osCommerce - New: Responsive | Feedback channel Link to comment Share on other sites More sharing options...
Jack_mcs Posted June 13, 2014 Share Posted June 13, 2014 @@Tim_ver You need to change this section of code and pd.products_name like '%" . tep_db_input($search) . "%' to this and ( pd.products_name like '%" . tep_db_input($search) . "%' or p.products_model like '%" . tep_db_input($search) . "%' ) Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
tim_ver Posted June 13, 2014 Author Share Posted June 13, 2014 Jack_mcs: That was it, works now. Thank you! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.