Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Site Search Plus


Jack_mcs

Recommended Posts

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

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

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

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

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?

Link to comment
Share on other sites

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

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

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

Link to comment
Share on other sites

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

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

  • 2 weeks later...

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

Link to comment
Share on other sites

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

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

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

Link to comment
Share on other sites

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

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

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!

Link to comment
Share on other sites

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

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 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!

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

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

							   '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

Link to comment
Share on other sites

No offense taken, at all. :)

 

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

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 offense taken, at all. :)

 

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

 

Ok, hopefully you push this contrib forward.

 

I have another 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!

Link to comment
Share on other sites

I have another 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...

 

Forget the last, i'm blind.

Link to comment
Share on other sites

No offense taken, at all. :)

 

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

 

Once again. FWR told me a way to pass special language chars through SecurityPro. Now i have the problem described in my former post.

 

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!

Link to comment
Share on other sites

I tried doing a search on a nonexistent item and then sent an email with the form with äöüÄÖÜß in it and it was received successfully so it would appear to be a problem with your setup.

 

Jack

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 tried doing a search on a nonexistent item and then sent an email with the form with äöüÄÖÜß in it and it was received successfully so it would appear to be a problem with your setup.

 

Jack

 

Oh, sorry, my explanation was not clear enough. It's not a problem with the e-mail form. I cannot find items/descriptions with the search if such a char is in the keyword.

 

BJ

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...