Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Archived

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

tim_ver

Search issue (catalog vs admin)

Recommended Posts

 

 

 

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

 

 

 

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++;

Share this post


Link to post
Share on other sites

 

 

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++;

Share this post


Link to post
Share on other sites

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) . "%'

Share this post


Link to post
Share on other sites

@@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

Share this post


Link to post
Share on other sites

×