Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Site Search Plus


Jack_mcs

Recommended Posts

You're welcome. I'm glad they are useful. To fix these errors, in includes/functions/site_search.php, find this code

		   if ($languageDir === end(explode("/", $filePath))) {
			  CheckFileContents($filePath, $searchTerm, $fileList, $languageDir);
		   }
	    } else {
		   $fileName = end(explode("/", $filePath));
		   if (end(explode(".", $fileName)) == 'php') { //NOTE: fails if there's an extenstion such file.php.old

and replace it with

		   $tmp = explode('/', $filePath);
		   if ($languageDir === end($tmp)) {
			  CheckFileContents($filePath, $searchTerm, $fileList, $languageDir);
		   }
	    } else {
		   $tmp = explode('/', $filePath);
		   $fileName = end($tmp);
		   $tmp = explode(".", $fileName);
		   if (end($tmp) == 'php') { //NOTE: fails if there's an extension such file.php.old

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

  • 8 months later...

Hi, Thanks for this contribution- I am using Site Search Plus and smart suggest it seems to work perfectly;

Just one small issue -
That if someone searches for example 'dresses' and i have products listed by name of 'dress' , the results appear as 0;

Could you please help me sort it that even if a part of the word that is 'dress' from 'dresses' is included in product name then the search results are displayed for the customers.
Awaiting your earliest help and response....

Link to comment
Share on other sites

I haven't ran the two addons together so I can't say what the problem might be. But on my site, where just this addon is installed, a search for partial words returns all results that contain them. So it seems there is either a conflict with the two addons running together or the other addon has a problem. 

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

No, I'm sorry but I can't support edited code due to the vast number of possibilities. You can install this addon by itself into a clean shop to see if the problem goes away. If not, then I should be able to help with that.

 

But I just reread your original post and I think I misunderstood it. The search code can only find full or partial words, not words longer than full. So, for example, if you have a product named "my dress" the search will find things like

 

my

dress

dre

ss

 

But it won't find something like "dressing" because that word does not exist in "my dress".

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

  • 4 months later...

Yes, it will. Though there aren't instructions for that version but if you use a compare program like WinMerge you should be able to figure it out. Don't upload the files as is though. 

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

  • 6 months later...

A new version has been uploaded with these changes:

 

  • Added autocomplete code to store and check words searched for.
  • Added an exclude list for files that shouldn't show in the results, like checkout_process.
  • Added code to handle pages from the Information Pages addon.
  • Created code for the bootstrap version.
  • Changed name used for Article Manager search so articles are found.
  • Changed css code for the display so the links are more uniform.
  • Changed code in includes/functions/site_search.php to remove strict warnings (found by member mhsuffolk).

I did not have time to update the install file so you will need to use a compare program, like WinMerge, to make the changes. They are clearly marked so it should not be difficult. Please post here if you run into any problems.

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

I got this error in my error log. Everything is working fine, but this strange (to me) error appears. What does this mean?

 

[sun Dec 27 08:56:40 2015] [error] [client 84.241.194.246] PHP Strict Standards:  Only variables should be passed by reference in /storage/web/public/sites/www.muisjesensitief.nl/includes/functions/site_search.php on line 65, referer: http://www.muisjesensitief.nl/

Link to comment
Share on other sites

In includes/functions/site_search.php, find

foreach ($matches as $filePath) {

and change it to

 $tmp = $matches;                     
 foreach ($tmp as $filePath) { 

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

  • 3 weeks later...

@@Jack_mcs

 

thank you for your answer, but it doesn't solved the problem. the error log is still being written with some 40 lines of errors like these (lines 65 and 66 are repeated almost 40 times):

 

[Fri Jan 15 20:03:58 2016] [error] [client ##.###.###.###] PHP Strict Standards:  Only variables should be passed by reference in /storage/web/public/sites/www.muisjesensitief.nl/includes/functions/site_search.php on line 61, referer: https://www.muisjesensitief.nl/index.php

[Fri Jan 15 20:03:58 2016] [error] [client ##.###.###.###] PHP Strict Standards:  Only variables should be passed by reference in /storage/web/public/sites/www.muisjesensitief.nl/includes/functions/site_search.php on line 65, referer: https://www.muisjesensitief.nl/index.php
[Fri Jan 15 20:03:58 2016] [error] [client ##.###.###.###] PHP Strict Standards:  Only variables should be passed by reference in /storage/web/public/sites/www.muisjesensitief.nl/includes/functions/site_search.php on line 66, referer: https://www.muisjesensitief.nl/index.php
Link to comment
Share on other sites

@@Jack_mcs
 
Solved the problem. The problem is, that 'end' requires a reference, because it modifies the internal representation of the array.
 
To solve this, find:
 
if ($languageDir === end(explode("/", $filePath))) {
 
and replace this with:
 
$temp = explode("/", $filePath);
if ($languageDir === end($temp)) {
 
and find:
 
$fileName = end(explode("/", $filePath));
if (end(explode(".", $fileName)) == 'php') {
 
and replace this with:
 
$temp = explode("/", $filePath);
$fileName = end($temp);
if (end($temp) == 'php') {

Link to comment
Share on other sites

Thanks for posting the fix but it was already mentioned on the previous page.

 

Anywhere in the code, of any addon, where a reference is part of the function being called will cause a warning under strict standards. I don't know why the php developers decided to make strict standards the default but that's the way it is. Until everyone, including myself, gets in the habit of using a temp variable for such functions, the warnings will continue to show up. But, in my code at least, if I need the variable altered by the function I always make sure it exists first. In the case sited here, it doesn't make any difference. I don't see it in my local setup since I don't code with strict standards set. Maybe I will start doing that.

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

  • 4 months later...

I have added this but have a problem. I have gone back a few times and started over to make sure I did all the changes. The error I get is:

 

1054 - Unknown column 'p.pages_name' in 'field list'

select pd.pages_id, p.pages_name from pages p left join pages_description pd on p.pages_id = pd.pages_id where ( pages_title like '%-s%' or pages_body like '%-s%' ) and language_id = 1

[TEP STOP]

 

It appears to be related to the second set of code in advanced_search_result.php file  If that code is not added the error goes away although then I am guessing I am really missing some functionality? 

 

FIND (around line 136)

  $breadcrumb->add(NAVBAR_TITLE_1, tep_href_link(FILENAME_ADVANCED_SEARCH));

ADD ABOVE
 
  /************** BEGIN SITESEARCH CHANGE ****************/
  require(DIR_WS_FUNCTIONS . FILENAME_SITE_SEARCH);
  $dir = DIR_WS_LANGUAGES;
  $searchTerm = $keywords;
 
  $articlesList = array();
  $fileList = array();
  $pagesList = array();
  if (tep_not_null($keywords)) //only check for words
  {
    CheckAllPages($dir, $searchTerm, $fileList, $articlesList, $pagesList, $languages_id);
  }   

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

Link to comment
Share on other sites

The code that is causing that is looking for the Page Manager table.  That is an addon that uses a defined name of TABLE_PAGES. I'm not aware of any other addon that uses a table named pages but it is possible. If your site uses that table but it is not from Page Manager, then in the includes/functions/site_search.php file, find this line

if (defined('TABLE_PAGES')) {

and change it to

if (false && defined('TABLE_PAGES')) {

If you do have Page Manager installed, then it is a different version than what this addon will work with so you would need to change the name being loaded in. Or you can make the above change and just disable it.

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

That addon, I think, is an earlier or later version of Page Manager. I think the difference was something like page_name being used instead of page_title, or vice-versa. If you want to get the code to work for that addon, you just need to change the MySQL statement in the code I mentioned.

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...