Jump to content
Jack_mcs

Site Search Plus

Recommended Posts

A new version has been uploaded. It contains the following changes:

 

- Removed unnecessay </a> in includes/modules/product_listing.php

- Changed search in files to only search the current language

- Added search inside sub-directories option to includes/boxes/search.php

- Added search in articles (articles manager contribution)

- Added search in pages (page editor contribution)

 

Jack

Share this post


Link to post
Share on other sites

Jack-

 

Thank you for sharing yet another wonderful contribution (I also appreciate your work on HeaderTags_SEO_V_3.1.0)! V1.2 is searching great on my v2.2 RC2 site.. Maybe too well because I noticed something strange that occurs (perhaps because I do not have the page editor contribution). When testing Site Search Plus, I searched for short terms like the letter 'a', the number '1', or even terms like 'payment' or 'navbar'. Then my site's files are listed to the customer. How can I prevent that from happening? I'm a novice and tried ways to just comment out the results, but I was not successful. Is this a good idea, or will I be better suited adding the page editor contribution? If so, which exact contribution is it (I have yet to find what I believe to be the correct file in the contributions)?

 

 

Also, the email can be sent without a valid customer email address or even completely empty. Is there a way to make it mandatory for a valid email to be typed in the customer email field? If so, could you describe it?

 

Thanks again for all your great work and help.

Share this post


Link to post
Share on other sites

To limit the search of the files to a minimum word length, find this in advanced_search_result.php

  if (tep_not_null($keywords)) //only check for words

and change it to

  if (tep_not_null($keywords) && strlen($keywords) > 1) //only check for words

, where 1 can be any minimum you want.

 

Here is the page editor contribution. But it won't make any difference for your problem. It just allows a way of adding pages to your site (there are others), so you shouldn't install it unless you need that option.

 

The code does check for a valid email. Either you didn't install that code or it is because javascript is turned off, as was mentioned previously.

 

Jack

Share this post


Link to post
Share on other sites

Hi Jack,

 

Thanks for the advice. Limiting the search length still allows files to be displayed to the customer. In your expert opinion, what is the best way to just comment out the file search results so that my site's files are NOT listed to the customer?

 

Thanks again for all your help!

Share this post


Link to post
Share on other sites

In advanced_search_result.php, change this line

CheckAllPages($dir, $searchTerm, $fileList, $articlesList, $pagesList, $languages_id);

to this

//CheckAllPages($dir, $searchTerm, $fileList, $articlesList, $pagesList, $languages_id);

 

Jack

Share this post


Link to post
Share on other sites

Hi Jack,

 

I'm having problems installing this. When i do the following i get an error on the site for the intsrtuctions where it says:

 

FIND (around line 232)

 

$from_str = "from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m using(manufacturers_id) left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id";

 

REPLACE WITH

 

/************** BEGIN SITESEARCH CHANGE ******************/

$from_str = "from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m using(manufacturers_id) left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id left join " . TABLE_PRODUCTS_ATTRIBUTES . " pa on p.products_id = pa.products_id left join " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov on pa.options_values_id = pov.products_options_values_id ";

/************** END SITESEARCH CHANGE ******************/

 

 

my code is:

 

$from_str = "from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m using(manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c";

$from_str .= "," . TABLE_PRODUCTS_ATTRIBUTES . ' pa';

 

Any help will be appreciated...I want to be able to search by product attributes as well

Share this post


Link to post
Share on other sites
Hi Jack,

 

I'm having problems installing this. When i do the following i get an error on the site for the intsrtuctions where it says:

 

FIND (around line 232)

 

$from_str = "from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m using(manufacturers_id) left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id";

 

REPLACE WITH

 

/************** BEGIN SITESEARCH CHANGE ******************/

$from_str = "from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m using(manufacturers_id) left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id left join " . TABLE_PRODUCTS_ATTRIBUTES . " pa on p.products_id = pa.products_id left join " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov on pa.options_values_id = pov.products_options_values_id ";

/************** END SITESEARCH CHANGE ******************/

 

 

my code is:

 

$from_str = "from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m using(manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c";

$from_str .= "," . TABLE_PRODUCTS_ATTRIBUTES . ' pa';

 

Any help will be appreciated...I want to be able to search by product attributes as well

The change assumes you have the mysql 5 compatibility patch installed in that file. It consitst of two parts so I can't just provide the above change without looking up the other and testing, which I don't have time to do. You would need to download the oscommerce package and find the change in the extras/update-20060817.txt file. It's a quick change and will be needed at some point.

 

Jack

Share this post


Link to post
Share on other sites
Also,

 

How do i get it to search by product attributes?

 

do i have to add something here?

 

$showCatBox = true;

$showPrice = true;

The advanced search file changes have to be made in order for that search to work.

 

Jack

Share this post


Link to post
Share on other sites
Question:

It's necessary to handle language specific characters like äöüÄÖÜß (i'm german). Product names and descriptions stored as ISO. Is it possible to cast the special chars to e.g. ä a.s.o. before posting the keywords to the search? Otherwise the search will find nothing...

 

Thank you in advance!

 

 

Hello,

I have a similar problem as the member above from Germany.

I posted here http://forums.oscommerce.com/index.php?sho...p;#entry1351994 before I found this forum.

Does this contribution handle special characters or apostrophes?

Can anyone help me find a solution?

 

Thank you in advance.

Share this post


Link to post
Share on other sites

For the most part, this contribution uses the same code that oscommerce uses. So if you go to the advanced_search page of your site and try the search fomr there, if it fails, it will probably fail with this one. In that case, you may want to make sure that characters like that can be displayed by your shop at all. If they can't, then you have a basic problem and the seach code will never work with it. You may want to try switching the encoding in your shop to utf8 in the includes/languages/english.php (or whatever language file you use).

 

Jack

Share this post


Link to post
Share on other sites
For the most part, this contribution uses the same code that oscommerce uses. So if you go to the advanced_search page of your site and try the search fomr there, if it fails, it will probably fail with this one. In that case, you may want to make sure that characters like that can be displayed by your shop at all. If they can't, then you have a basic problem and the seach code will never work with it. You may want to try switching the encoding in your shop to utf8 in the includes/languages/english.php (or whatever language file you use).

 

Jack

Hi Jack,

Thank you for your reply. I tried changing the includes/languages/english.php and greek php files (both catalog and admin) but there is no change.

I changed to

// charset for web pages and emails

define('CHARSET', 'UTF8');

 

from

// charset for web pages and emails

define('CHARSET', 'iso-8859-7');

 

I'm wondering, in a standard Oscommerce shop, if someone is searching for a product for example St John's if they search for St Johns without the apostrophe then the search result will be product not found. Is there a way to get the search result to show the product with the apostrophe? I see when someone searches for a product like cat it will show the result if a product has the word cat or even in its plural form ie: cats. Is there a way to do this for the apostrophe as well?

 

Thanks again,

Alexandra

Share this post


Link to post
Share on other sites

Does this contribution work for the admin page catalog searching? On the main store page, I use the default search function to search by model number, however on the admin page I can not. Does this add allow that? If so, what part of it exactly allows that? This is the only feature I would like out of this contribution and do not wish to modify things I do not need.

 

Thanks.

Share this post


Link to post
Share on other sites
I'm wondering, in a standard Oscommerce shop, if someone is searching for a product for example St John's if they search for St Johns without the apostrophe then the search result will be product not found. Is there a way to get the search result to show the product with the apostrophe? I see when someone searches for a product like cat it will show the result if a product has the word cat or even in its plural form ie: cats. Is there a way to do this for the apostrophe as well?

The code doesn't know if an apotrophe should be in a word or not so there wouldn't be any way to get a result for St Johns unless an apostrophe was added to each word searched. I suppose that could be done but it would probably return false matches too. There is a contribution that keeps track of searches done and provides alternatives if a word can't be found. That isn't fool proof but may help in your situation. I had already planned on adding that option to this contribution but there's no completion date so you may want to look at it for now. I don't recall the name of it but "complete search" or somthing similar may find it.

 

Jack

Share this post


Link to post
Share on other sites
Does this contribution work for the admin page catalog searching? On the main store page, I use the default search function to search by model number, however on the admin page I can not. Does this add allow that? If so, what part of it exactly allows that? This is the only feature I would like out of this contribution and do not wish to modify things I do not need.

 

Thanks.

No, it doesn't do anything on the admin side. What part of admin would you want to search?

 

Jack

Share this post


Link to post
Share on other sites

Hi Jack,

 

very nice contrib that works like a charm but I had a little problem with W3C specifications.

After looking for a while, it appears to be caused by the search box and more especifically by $catBoxWidth.

W3C needs to know if the width is % or px and the solution I found is to modify the includes/boxes/search.php file and change line 28 from

 

$catBox = ($showCatBox ? '<tr><td height="3"></td></tr><tr><td class="infoBoxContents" valign="top" colspan="3">' . BOX_ADVSEARCH_CAT . '</td></tr><tr><td class="infoBoxContents" valign="top" colspan="3">' . tep_draw_pull_down_menu('categories_id', tep_get_categories(array(array('id' => '', 'text' => BOX_ADVSEARCH_ALLCAT))), '', 'style="width:' . $catBoxWidth . ';"') . '</td></tr>' : '');

 

to:

 

$catBox = ($showCatBox ? '<tr><td height="3"></td></tr><tr><td class="infoBoxContents" valign="top" colspan="3">' . BOX_ADVSEARCH_CAT . '</td></tr><tr><td class="infoBoxContents" valign="top" colspan="3">' . tep_draw_pull_down_menu('categories_id', tep_get_categories(array(array('id' => '', 'text' => BOX_ADVSEARCH_ALLCAT))), '', 'style="width:' . $catBoxWidth . 'px' . ';"') . '</td></tr>' : '');

 

and it seems to work.

 

Is it correct ?

 

Sébastien

Edited by scartier

Share this post


Link to post
Share on other sites
No, it doesn't do anything on the admin side. What part of admin would you want to search?

 

Jack

 

I just want the search box on the top of the Manage Categories page to search within model numbers along with name/description.

Share this post


Link to post
Share on other sites

The search there now search for entries in categories. You are wanting it to search within products. That is possible but not a quick change. I'll put it on the list for the next version, whenever that will be.

 

Jack

Share this post


Link to post
Share on other sites
The code doesn't know if an apotrophe should be in a word or not so there wouldn't be any way to get a result for St Johns unless an apostrophe was added to each word searched. I suppose that could be done but it would probably return false matches too. There is a contribution that keeps track of searches done and provides alternatives if a word can't be found. That isn't fool proof but may help in your situation. I had already planned on adding that option to this contribution but there's no completion date so you may want to look at it for now. I don't recall the name of it but "complete search" or somthing similar may find it.

 

Jack

Thanks for your reply. I will have a look.

Alexandra

Share this post


Link to post
Share on other sites

I did all the steps now I get this error

 

1054 - Unknown column 'pov.products_options_values_name' in 'where clause'

 

select count(distinct p.products_id) as total 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 = '1' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and ((((pd.products_name like '%ran%' or p.products_model like '%ran%' or m.manufacturers_name like '%ran%' )) or ( pov.products_options_values_name like '%ran%' ) or pd.products_description like '%ran%') )

 

[TEP STOP]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×