Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

May be Value Adding for your store ?


yesudo

Recommended Posts

I have amended the basic customer search option to also search through the product description for keyword/s entered by a customer:

 

File: advanced_search_result.php

 

Change:

 

default:
? ? ? ? ?$keyword = tep_db_prepare_input($search_keywords[$i]);
? ? ? ? ?$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:

 

default:
? ? ? ? ?$keyword = tep_db_prepare_input($search_keywords[$i]);
? ? ? ? ?$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) . "%' ?or pd.products_description 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;

 

*edit* - URL

Your online success is Paramount.

Link to comment
Share on other sites

  • 2 months later...
  • 2 months later...

The code for searching through product description already existed in the statement before you changed it:

 

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

 

So you could have done this (in /includes/boxes/search.php):

 

tep_draw_hidden_field('search_in_description', '1')

 

so the code looks like:

 

$info_box_contents = array();
 $info_box_contents[] = array('form' => tep_draw_form('quick_find', tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', 'NONSSL', false), 'get'),
                              'align' => 'center',
                              'text' => tep_draw_input_field('keywords', '', 'size="10" maxlength="30" style="width: ' . (BOX_WIDTH-30) . 'px"') . ' ' . tep_draw_hidden_field('search_in_description', '1') . tep_hide_session_id() . tep_image_submit('button_quick_find.gif', BOX_HEADING_SEARCH) . '<br>' . BOX_SEARCH_TEXT . '<br><a href="' . tep_href_link(FILENAME_ADVANCED_SEARCH) . '"><b>' . BOX_SEARCH_ADVANCED_SEARCH . '</b></a>');

 

to get the same effect...

Link to comment
Share on other sites

how do i change the php im lost. i log into sit and find php file to edit but i cant change it.. am i going to the wrong place?

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...