Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

change search to search model # only


jwiskema

Recommended Posts

Hello,

 

I need to change the search to only search certain fields and have it only match the begining the the text, not any text with the search string in it. For example say I was searching for 100 it would only display product that start with 100 not any that have 100 in it like 499100 or 4100438.

 

I also need to change the product model color on the results pages when you do a search to a blue, but when I played around with the style sheet and changed the text it either didn't apply it to didn't acted like the style did not exsist. I did this in the includes/models/products_listings.php (could that be the wrong spot)? I was able to change the product dicription color, but not the model, even when I change the attributes of productListing-data in the styles.

 

Any help would be apprciated,

 

~ J ~

Link to comment
Share on other sites

I found the code to limit the search, but it doesn't seem to be getting the correct return results. Anyone have an ideas?

 

 

I changed:

      /*    $where_str .= "(pd.products_name like '%" . tep_db_input($keyword) . "%' or p.products_model like '%" . tep_db_input($keyword) . "%' or m.manufacturers_name like '%" . tep_db_input($keyword) . "%'";
         if (isset($HTTP_GET_VARS['search_in_description']) && ($HTTP_GET_VARS['search_in_description'] == '1')) $where_str .= " or pd.products_description like '%" . tep_db_input($keyword) . "%'";
         $where_str .= ')';
         break; */

 

To this:

      
                 $where_str .= "(p.products_model like '" . tep_db_input($keyword) . "%'";
            if (isset($HTTP_GET_VARS['search_in_description']) && ($HTTP_GET_VARS['search_in_description'] == '1')) $where_str .= " or pd.products_description like '%" . tep_db_input($keyword) . "%'";
            $where_str .= ')';
         break;

Link to comment
Share on other sites

I figured it out, instead of using the product_model as the product_model the database is setup to use product_name as product_model so it was not searching in the right area.

 

Thank you for looking anyway,

~ J ~ :thumbsup:

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...