Jump to content



Photo
- - - - -

Site Search Plus


  • Please log in to reply
151 replies to this topic

#1 ONLINE   Jack_mcs

Jack_mcs
  • Members
  • 26,543 posts
  • Real Name:Jack York
  • Gender:Male
  • Location:Michigan

Posted 09 November 2008 - 13:50

This contribution allows searching of the entire site. It adds the following features:

- Search in product descriptions
- Search in product attributes
- Search in language files
- If a search is performed on a word and no product matches are found, a form appears allowing the customer to email the shop owner asking for information about the product.
- A modified version of the Advanced Search Box is included. The price boxes and category selector can be enabled/disabled via settings in the includes/boxes/search.php file.

Jack

Edited by Jack_mcs, 09 November 2008 - 13:53.


#2   Hotclutch

Hotclutch
  • Members
  • 1,243 posts
  • Real Name:Ashley
  • Gender:Male
  • Location:Cape Town, SA

Posted 09 November 2008 - 17:39

Hi Jack

Thanks for this contribution!

Is the any way I can change the width of the search box to 125?

#3 ONLINE   Jack_mcs

Jack_mcs
  • Members
  • 26,543 posts
  • Real Name:Jack York
  • Gender:Male
  • Location:Michigan

Posted 09 November 2008 - 18:56

The width is set by the width of the column, as in all other boxes. If the box is too wide, it is probaby due to the category dropdown list although it may be due to the keyword box. You can remove that dropdown via a setting in the search box to determine which and then change the size of either to what you want.

Jack

#4   Hotclutch

Hotclutch
  • Members
  • 1,243 posts
  • Real Name:Ashley
  • Gender:Male
  • Location:Cape Town, SA

Posted 09 November 2008 - 19:10

The width is set by the width of the column, as in all other boxes. If the box is too wide, it is probaby due to the category dropdown list although it may be due to the keyword box. You can remove that dropdown via a setting in the search box to determine which and then change the size of either to what you want.

Jack


Thanks...It is the cat box. I have one or two long category names that must be pushing the box out that wide. I turned to false in search.php and the box is normal width. Where would I adjust the width of the category box if I wanted to keep it?

#5 ONLINE   Jack_mcs

Jack_mcs
  • Members
  • 26,543 posts
  • Real Name:Jack York
  • Gender:Male
  • Location:Michigan

Posted 09 November 2008 - 21:15

In the includes/boxes/search.php file, find this section of code
tep_get_categories(array(array('id' => '', 'text' => BOX_ADVSEARCH_ALLCAT)))
and change it to
tep_get_categories(array(array('id' => '', 'text' => BOX_ADVSEARCH_ALLCAT))), '', ' style="width: 100"'
changing the 100 to whatever you want the width to be.

Jack

#6   Hotclutch

Hotclutch
  • Members
  • 1,243 posts
  • Real Name:Ashley
  • Gender:Male
  • Location:Cape Town, SA

Posted 09 November 2008 - 23:36

In the includes/boxes/search.php file, find this section of code

tep_get_categories(array(array('id' => '', 'text' => BOX_ADVSEARCH_ALLCAT)))
and change it to
tep_get_categories(array(array('id' => '', 'text' => BOX_ADVSEARCH_ALLCAT))), '', ' style="width: 100"'
changing the 100 to whatever you want the width to be.

Jack


There seems to be a syntax error somewhere. I've got

tep_get_categories(array(array('id' => '', 'text' => BOX_ADVSEARCH_ALLCAT)))) . '</td></tr>' : ''); in search.php

#7 ONLINE   Jack_mcs

Jack_mcs
  • Members
  • 26,543 posts
  • Real Name:Jack York
  • Gender:Male
  • Location:Michigan

Posted 10 November 2008 - 00:52

That's correct. After the BOX_ADVSEARCH_ALLCAT))), you would add the code as shown.

Jack

#8   Hotclutch

Hotclutch
  • Members
  • 1,243 posts
  • Real Name:Ashley
  • Gender:Male
  • Location:Cape Town, SA

Posted 10 November 2008 - 13:16

That's correct. After the BOX_ADVSEARCH_ALLCAT))), you would add the code as shown.

Jack


Ahh...Thank you very much. I got confused with the brackets. All working now.

#9 ONLINE   Jack_mcs

Jack_mcs
  • Members
  • 26,543 posts
  • Real Name:Jack York
  • Gender:Male
  • Location:Michigan

Posted 12 November 2008 - 03:06

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

- Added code on the email form to check for valid input
- Added an option in the search box to allow setting of the dropdown width

Jack

#10   ricardodacosta

ricardodacosta
  • Members
  • 132 posts
  • Real Name:ricardo

Posted 21 November 2008 - 15:04

Hi Jack,

I have a store where I don't have any price on any products following the oscommerce default price set up. I added prices to each product as attributes depending on size. Ex 2oz=$6.

Will your contribution help my customers find a product price range from my attributes?

If not, would it be possible to add that function to this contribution? Is there a contribution that would do that?

Thanks!

Ricardo

#11 ONLINE   Jack_mcs

Jack_mcs
  • Members
  • 26,543 posts
  • Real Name:Jack York
  • Gender:Male
  • Location:Michigan

Posted 21 November 2008 - 16:25

It depends on how you have it setup. Normal an attribute will appear as 2oz ($6), where the $6 is added dynamically by the code so it is not part of the attribute. In that case, the contribution won't find it. But if your attribute is actually named 2oz=$6, then it will find it.

Jack

#12   Black Jack 21

Black Jack 21
  • Members
  • 81 posts
  • Real Name:Andreas
  • Gender:Male
  • Location:Germany

Posted 25 November 2008 - 08:41

Hi Jack,

thank you for the contribution - a very good one.

Questions

In product_listing.php, i want to alter the submit button to the style used in contact_us.php. I've added the following:

'<tr><td height="5"></td></tr><tr><td colspan="2" align="right" class="productListing-data">' . tep_image_submit('button_continue.gif', IMAGE_BUTTON_CONTINUE, 'name="request_submit"') . '</a></td></tr>' .
'</table>');

But it doesn't work. Can you point me in right direction? Thank you in advance!
I can't also understand the closing </a>...

BJ

#13 ONLINE   Jack_mcs

Jack_mcs
  • Members
  • 26,543 posts
  • Real Name:Jack York
  • Gender:Male
  • Location:Michigan

Posted 25 November 2008 - 12:03

The </a> is a mistake and should be removed. I don't see a problem with the rest of it so maybe the </a> is the problem.

Jack

#14   Black Jack 21

Black Jack 21
  • Members
  • 81 posts
  • Real Name:Andreas
  • Gender:Male
  • Location:Germany

Posted 25 November 2008 - 12:19

The </a> is a mistake and should be removed. I don't see a problem with the rest of it so maybe the </a> is the problem.

Jack


Thank you for your help. Unfortunately it doesn't work. I will be redirected to advanced_search.php with the warning, that one field must be filled as a minimum. Also no e-mail will be processed. Any suggestion?

Thank you!

#15 ONLINE   Jack_mcs

Jack_mcs
  • Members
  • 26,543 posts
  • Real Name:Jack York
  • Gender:Male
  • Location:Michigan

Posted 26 November 2008 - 04:01

I checked the button code here and it works fine so there muct be a problem in your installation or something on the server that is preventing it, assuming that you are actually filling in the form, of course.

Jack

#16   Black Jack 21

Black Jack 21
  • Members
  • 81 posts
  • Real Name:Andreas
  • Gender:Male
  • Location:Germany

Posted 26 November 2008 - 09:56

I checked the button code here and it works fine so there muct be a problem in your installation or something on the server that is preventing it, assuming that you are actually filling in the form, of course.

Jack


Mysterious. Because it works fine with your provided submit button code, but not with the tep_image_submit.

Perhaps you can help me with another modification. I have main categories with no products in, but with sub categories storing the products. The search did not find anything if a main category is selected in the search box. I want to force the search box to search also in the sub categories of the selected main cat. Is this possible?

Thank you in advance!

#17   Black Jack 21

Black Jack 21
  • Members
  • 81 posts
  • Real Name:Andreas
  • Gender:Male
  • Location:Germany

Posted 26 November 2008 - 10:40

I checked the button code here and it works fine so there muct be a problem in your installation or something on the server that is preventing it, assuming that you are actually filling in the form, of course.

Jack


Just a note: I've found that it is necessary to add tep_hide_session_id to the search box form for browsers with secure configuration.

#18 ONLINE   Jack_mcs

Jack_mcs
  • Members
  • 26,543 posts
  • Real Name:Jack York
  • Gender:Male
  • Location:Michigan

Posted 26 November 2008 - 18:23

Mysterious. Because it works fine with your provided submit button code, but not with the tep_image_submit.

Perhaps you can help me with another modification. I have main categories with no products in, but with sub categories storing the products. The search did not find anything if a main category is selected in the search box. I want to force the search box to search also in the sub categories of the selected main cat. Is this possible?

Thank you in advance!

I'll add this to the next version but for now, in includes/boxes/search.php, find
'text' => '<table border="0" width="100%" cellspacing="0" cellpadding="1"><tr><td class="infoBoxContents" valign="top" colspan="3">' . BOX_ADVSEARCH_KW . '</td></tr><tr><td class="infoBoxContents" valign="top" colspan="3">' . tep_draw_hidden_field('search_in_description','1') . tep_draw_input_field('keywords', '', 'size="15" maxlength="30" style="width: ' . (BOX_WIDTH) . 'px" onFocus="form.keywords.value=\'\'"') . '</td></tr>' .
and replace it with
'text' => '<table border="0" width="100%" cellspacing="0" cellpadding="1"><tr><td class="infoBoxContents" valign="top" colspan="3">' . BOX_ADVSEARCH_KW . '</td></tr><tr><td class="infoBoxContents" valign="top" colspan="3">' . tep_draw_hidden_field('search_in_description','1') . tep_draw_hidden_field('inc_subcat','1') . tep_draw_input_field('keywords', '', 'size="15" maxlength="30" style="width: ' . (BOX_WIDTH) . 'px" onFocus="form.keywords.value=\'\'"') . '</td></tr>' .

Jack

#19   Black Jack 21

Black Jack 21
  • Members
  • 81 posts
  • Real Name:Andreas
  • Gender:Male
  • Location:Germany

Posted 26 November 2008 - 19:35

'text' => '<table border="0" width="100%" cellspacing="0" cellpadding="1"><tr><td class="infoBoxContents" valign="top" colspan="3">' . BOX_ADVSEARCH_KW . '</td></tr><tr><td class="infoBoxContents" valign="top" colspan="3">' . tep_draw_hidden_field('search_in_description','1') . tep_draw_hidden_field('inc_subcat','1') . tep_draw_input_field('keywords', '', 'size="15" maxlength="30" style="width: ' . (BOX_WIDTH) . 'px" onFocus="form.keywords.value=\'\'"') . '</td></tr>' .

Jack


Thanks a lot, works like a charm! :-)

I know, i'm a pain in the neck, but i have another issue. The code tests valid entries of the e-mail form by javascript, maybe disabled by some customers. What's the reason for to do so instead of using the validation functions, e.g. as in contact_us?

Hopefully you don't misunderstand me, i don't want to grouch. I'm very appreciated to benefit from your work, coding and tips.

Thank you in advance

BJ

#20 ONLINE   Jack_mcs

Jack_mcs
  • Members
  • 26,543 posts
  • Real Name:Jack York
  • Gender:Male
  • Location:Michigan

Posted 26 November 2008 - 23:13

No offense taken, at all. /smile.gif' class='bbc_emoticon' alt=':)' />

As to why, it was just easier to do it that way. If there is a large enough request for it, I will change the code but I think the likelihood of it causing a problem is small. Javascript is, after all, used elsewhere in the shop (create account, checkout) and that isn't a problem, at least that I've ever seen. Although, such javascript code should be backed up with php code but I didn't see a great need for it. I could be mistaken though.

Jack

Edited by Jack_mcs, 26 November 2008 - 23:14.