Jump to content
Sign in to follow this  
Bigredman74

[Contribution] - Search Box Anywhere

Recommended Posts

This is what i have been after for ages.

 

like says "DCP" said how can you add Sub Categories to the search

 

Thanks

Craig

Share this post


Link to post
Share on other sites

<?php echo tep_draw_form('search', tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', 'NONSSL', false), 'get') . tep_draw_hidden_field('search_in_description','1') . tep_draw_input_field('keywords', '', 'maxlength="30" style="width:100px"') . ' ' . tep_draw_pull_down_menu('categories_id', tep_get_categories(array(array('id' => '', 'text' => BOX_ALL_CATEGORIES)))) . '' . tep_hide_session_id() . '<input type="submit" name="Submit" value="Go">' . tep_draw_hidden_field('inc_subcat', '1', true) . '</form>'; ?>

 

 

This will search sub categories. i just added a hidden field that acts like the checkbox on the advanced search page.

 

hope this helps someone.

 

=========

 

I have a question.

 

is it posible to just show the main categories on not the sub categories in the drop down menu?

 

Cheers

Craig

Edited by pixelhub

Share this post


Link to post
Share on other sites
<?php echo tep_draw_form('search', tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', 'NONSSL', false), 'get') . tep_draw_hidden_field('search_in_description','1') . tep_draw_input_field('keywords', '', 'maxlength="30" style="width:100px"') . ' ' . tep_draw_pull_down_menu('categories_id', tep_get_categories(array(array('id' => '', 'text' => BOX_ALL_CATEGORIES)))) . '' . tep_hide_session_id() . '<input type="submit" name="Submit" value="Go">' . tep_draw_hidden_field('inc_subcat', '1', true) . '</form>'; ?>

This will search sub categories. i just added a hidden field that acts like the checkbox on the advanced search page.

 

hope this helps someone.

 

=========

 

I have a question.

 

is it posible to just show the main categories on not the sub categories in the drop down menu?

 

Cheers

Craig

 

Thank you very much! It works just perfect at least to me! :D

 

About your question, i'm afraid i can't help you much, but what i can tell you is the following:

The dynamenu contrib. shows only the main categories in first place, and when you put the mouse over the categorie, it shows its subcategories. So, this could be valid for you.

 

I have been looking into this contrib but i don't know exactly the code which may help you, but I think it is in the following file: catalog/includes/functions/dynamenu/lib/treemenu.inc.php

 

Hope this can help you :blush:

 

Thanks again!

Share this post


Link to post
Share on other sites

This looks like the ideal solution for me but....is it possible to search by category without the drop down box. Can you just have a search similar to products with no drop down boxes?


Ah, the world wide web. What a wonderful place.

Share this post


Link to post
Share on other sites

Hi and thank you for this contribution!

 

I have added it to the header navigation, but how matter how I adjust the box_width size, the size does not change. I want a shorter box where they type in their query .... I've even gone negative in the code and it still won't change. Any ideas?

 

Also, how do I adjust the drop down box so that it only shows main categories (and not subcategories) - that will decrease the width of that box also .....

 

http://www.moonlightdelights.com/catalog


26 contributions installed - - And counting ....

 

Just want to take this time to extend my appreciation to everyone who have patiently answered my questions over the months of working on my site. I hope to be able to "pass it forward" and help new folks.

Share this post


Link to post
Share on other sites

Second set of questions:

 

1 - How can adjust the height of the boxes, just want to lower that a tad so the nagivation blue strip on my site isn't so wide height wise.

 

2 - How can I adjust the font for the boxes - they are not matching the font size as the rest of the navigation bar.


26 contributions installed - - And counting ....

 

Just want to take this time to extend my appreciation to everyone who have patiently answered my questions over the months of working on my site. I hope to be able to "pass it forward" and help new folks.

Share this post


Link to post
Share on other sites

Hello to everyone!

 

Search box anywhere is a great contribution.. Thank you Tim!.

 

I have a question.. I have 2 languages and search box anywhere is successfully installed..

It's works perfect in English. When a visitor select the second language (Greek), search still working perfect but the search BUTTON is still in ENGLISH.

Is there any way to change the label of the form button -dynamic- when language changes??

 

Regards,

Yiorgos

Share this post


Link to post
Share on other sites

Hi there,

 

I've installed STS and the newest version of Search Box Anywhere, I found a problem of having BOX_ALL_CATEGORIES showing in the Catagories Drop Down Menu when I clicked on few pages like: the result page came up after choosing a product from the catagory or search a product in the Search Box Anywhere.

 

I've read all messages here got the followng code :

 

In catalog\includes\languages\english\index.php

 

// Search Box Anywhere text

define('BOX_ALL_CATEGORIES', 'All Categories');

 

In catalog\includes\boxes\search.php

 

<?php

echo tep_draw_form('search', tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', 'NONSSL', false), 'get') . tep_draw_hidden_field('search_in_description','1') . tep_draw_input_field('keywords', '', 'maxlength="30" style="width:100px"') . ' ' . tep_draw_pull_down_menu('categories_id', tep_get_categories(array(array('id' => '', 'text' => BOX_ALL_CATEGORIES)))) . '' . tep_hide_session_id() . '<input type="submit" name="Submit" value="Go">' . tep_draw_hidden_field('inc_subcat', '1', true) . '</form>';

?>

 

Could anyone pls. help me out if I've written anyting wrong here? Thanks in advance.

Share this post


Link to post
Share on other sites

hello ive got a few problems

the no logo

the search box doest work

am missing buttons getting red x instead

if any one can help be grateful

 

my site Visit My Website

 

cheers

kewns

 

am new to php

Share this post


Link to post
Share on other sites
hello ive got a few problems

the no logo

the search box doest work

am missing buttons getting red x instead

if any one can help be grateful

 

my site Visit My Website

 

cheers

kewns

 

am new to php

 

You need to edit the file /includes/languages/english.php

 

Just before the ?> at the bottom of the file, add the following:

// Search Box Anywhere text

define('BOX_ALL_CATEGORIES', 'All Categories');

 

You will have to edit the other language files if you run more then English.

 

Also you need to make and/or upload the button image and make sure you call the button button_search.gif

 

One last thing, your site is a very graphical intensive site and loads very slowly.

You may want to consider a hosting company which offers 1000Mbps up link to the internet. Most hosting companies only offer 100Mbps, but the company TopDawg Hosting Inc. within the US offers 1000Mbps up linked servers and has VERY competitive prices too! Just Google Search the company name to find them.

 

 

Also want to say: GREAT OsCommerce MOD!! Works Wonderful.... :thumbsup:

Edited by jakejammin

Share this post


Link to post
Share on other sites

hello and thanks to your reply i have done what you said with english.php

dnt think its made any difference

 

also my images our all there i think as none of my button images are showing it may have something to do with htacess

which a read about on here last nite am still not sure dou

 

it loads qutie well for me here and at work and at my friends

i dnt know why it was loading slow i will check with housting company this week

cheers

kewns

if yourself or any could help i still be graetful i know its proberly something i ve done wrong lol

 

cheers

 

kewns

Share this post


Link to post
Share on other sites

is this the code were its getting the image from

tep_image_submit('button_quick_find.gif', IMAGE_BUTTON_SEARCH, 'align="middle"') . tep_draw_hidden_field('inc_subcat', '1', true) . '</form>'; ?></span></td>

cheers

ste

Share this post


Link to post
Share on other sites

Hello everyone,

 

Here's my question to Tim as he's a developer of this useful contrib. I set it up, but would request for help cuz I'd like to make some changes. Unfortunatelly as I'm completely dummy with PHP'n'so I can just do nothing with this even if it so small piece of code. Anyway.

 

Here is my shop www.detoxtore.com. 'Search Box Anywhere' is installed in the header. If you try to make some 'empty' searching you'll be redirected to /advanced_search_result.php But I'm gonna remove this file from the server at all, so could someone help me and tell what should I do to make redirection for example to the main page, or to some custom /let's say Error Page/ that will warn about empty request? Would be better IMHO to insert some javascript to show a pop-up window with this warning.

 

Wow.. 'twas so difficult to explain :blink: :lol:

 

Thanks you all ppl in advance for help, and sorry for my English.

 

Cheers ;)

Edited by Fabys

Share this post


Link to post
Share on other sites

Quick and dirty:

 

Replace in catalog/advanced_search_result.php

  if ($error == true) {
tep_redirect(tep_href_link(FILENAME_ADVANCED_SEARCH, tep_get_all_get_params(), 'NONSSL', true, false));
 }

 

By:

  if ($error == true) {
tep_redirect(tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, 'keywords=Enter Search String', 'NONSSL', true, false));
 }

Share this post


Link to post
Share on other sites
Quick and dirty:

 

Replace in catalog/advanced_search_result.php

  if ($error == true) {
tep_redirect(tep_href_link(FILENAME_ADVANCED_SEARCH, tep_get_all_get_params(), 'NONSSL', true, false));
 }

 

By:

  if ($error == true) {
tep_redirect(tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, 'keywords=Enter Search String', 'NONSSL', true, false));
 }

Yeah man! :thumbsup:

 

I didn't even expect such a rapid reply! B)

 

Thank you very much that's what I exactly wanted to do.

 

PS: By the way, what about a couple of beers? Just call if you still keep my number man ;)

Share this post


Link to post
Share on other sites

Categories without sub-categories?

 

Is there a way to show categories without the subcategories?


I never miss...

Share this post


Link to post
Share on other sites

Many questions about this contribution in STS but no good answers... :huh:

 

I run STS 4.5.8 but have failed to get this to work. All i see on my page is the frey search box with the code inside of it:

 

<?php echo tep_draw_form('search', tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', 'NONSSL', false), 'get') . tep_draw_hidden_field('search_in_description','1') . tep_draw_input_field('keywords', '', 'size="10" maxlength="30" style="width: ' . (BOX_WIDTH+10) . 'px"') . ' ' . tep_hide_session_id() .'<input type="submit" name="Submit" value="Search">' . '</form>'; ?>

 

Any ideas?

Share this post


Link to post
Share on other sites

Hi,

I am trying the contribution, and I am not able to combine it in the top of the header with a header pic that has full width, eg my site is 800 px, my header pic is 800 px, and when I implement the contribution, aligned to the right in a separate table cell, it is shown "outside" the site, to the right of the header. Is it a way to make it shown "on top" of the header pic, with the pic behind the search box?

 

Thank you,

 

Lollo

Share this post


Link to post
Share on other sites

Is there a way to prefill the search box with text? (Like 'Search') And possibly have the text cleared when a user clicks in the search box?

 

Thank you!

Share this post


Link to post
Share on other sites

I want to do the following, click on a category in the left column - then have a drop down box for sub-categories which will limit the number of products displayed to the sub-category selected - I think I might be able to do this with your contribution but I'm not sure how. I'd really appreciate any help.

 

Thanks

Share this post


Link to post
Share on other sites

Hi

 

I know this is a really old post but maybe someone can help me?

 

I'm currently working on a website, Computer Warehouse. I am designing some of the category pages in html and css for usability and accessibility purposes, see for example the Components Page.. Although I have a customised search box in the header on these html pages, it is stopping the pages from being valid html transitional:-(

 

As a result, I thought about replacing this search box with the 'Search Box Anywhere' Contribution because its really good and simple. Having made the changes to the .htacces file to allow php on html documents, I pasted the Search Box code on a html page. Although the page validates now, I'm getting an error "Fatal error: Call to undefined function tep_draw_form() in ...public_html/test.html on line 5".

 

The Cont. I have used is Optopn 2:

 

<?php echo tep_draw_form('search', tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', 'NONSSL', false), 'get') . tep_draw_hidden_field('search_in_description','1') . tep_draw_input_field('keywords', '', 'size="10" maxlength="30" style="width: ' . (BOX_WIDTH+10) . 'px"') . ' ' . tep_hide_session_id() .tep_image_submit('button_search.gif', BOX_HEADING_ADVSEARCH, 'align="middle"') . '</form>'; ?>

 

I Really need the pages to validate so I would be really greatful if someone could find the solution for me. Or if possible, can anyone validate my old search form? I have pasted the code for it below:

 

<form name="quick_find"

action="http://www.pc-warehouseuk.com/advanced_search_result.php"

method="get"/>

 

<input maxLength="30"

size="10" name="keywords"/>

<input name="image"

type="image" title="Quick Find"

src="images/index/quick_find_ball.jpg" alt="Quick Find"

/>

</form>

 

Any help would be much appreciated.

Share this post


Link to post
Share on other sites
Quick and dirty:

 

Replace in catalog/advanced_search_result.php

  if ($error == true) {
tep_redirect(tep_href_link(FILENAME_ADVANCED_SEARCH, tep_get_all_get_params(), 'NONSSL', true, false));
 }

 

By:

  if ($error == true) {
tep_redirect(tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, 'keywords=Enter Search String', 'NONSSL', true, false));
 }

 

 

Thank you for this code. Is there a way to replace "Enter Search String" with a reference to language file? Then it would show the note in the chosen language.

Share this post


Link to post
Share on other sites

Hi Guys, I thought it would be a good idea to add a custon search by category like "Option 6",

that instead of having a dropbox to select a category,

we can insert the specific category_id we would like to search within.

 

Example, currenly this is our search category dropbox code,

 

<?php echo tep_draw_form('search', tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', 'NONSSL', false), 'get') . tep_draw_hidden_field('search_in_description','1') . tep_draw_input_field('keywords', '', 'size="10" maxlength="30" style="width: ' . (BOX_WIDTH+10) . 'px"') . ' ' . tep_draw_pull_down_menu('categories_id', tep_get_categories(array(array('id' => '', 'text' => BOX_ALL_CATEGORIES)))) . tep_hide_session_id() .'</form>'; ?>

 

(((If we can only replace pull_down_menu line with a hidden code that we can define the specific "cPath=/category that we want to search in )))

 

Guys, please help me with this, I'm sure many others are waiting for something like this...

 

Thanks,

Ronnie

Share this post


Link to post
Share on other sites

GETTING AN ERROR INSTEAD OF SEARCH RESULTS.

 

I have installed this contrib (an apparently easy process) on my site, www.spog.bz, but when I submit a search I get the following error:

 

1066 - Not unique table/alias: 'pd'

 

select count(distinct p.products_id) as total from (products p left join products_to_products_extra_fields p2pef on p.products_id=p2pef.products_id) left join manufacturers m on m.manufacturers_id=p.manufacturers_id, products_description pd left join specials s on p.products_id = s.products_id, categories c, products_to_categories p2c, products_description pd, 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 '%huggies%' or p.products_model like '%huggies%' or m.manufacturers_name like '%huggies%' or p2pef.products_extra_fields_value like '%huggies%' or pd.products_description like '%huggies%') )

 

[TEP STOP]

 

Now I don't know enough about PHP and MySQL to decipher this. My guess is that there is something it is looking for that it is not finding in the DB. however I am oblivious to how to determine what or where (aside from something 'pd') and how to fix it.

 

any help would be greatly appreciated.

 

Thanks

 

Rob

 

SIDE NOTE... It appears I am getting this error on any search submission, not just from this contribution. Any ideas?

Edited by roback

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
Sign in to follow this  

×