Hello Guest

How do you create a search box to search all your products

  • 8 Replies
  • 3888 Views
How do you create a search box to search all your products
« on: August 27, 2014, 01:29:31 PM »
I have created the following search box on my website

<form action="http://websitename/?products" method="post">
<b>Search Products:</b>
<input name="search[phrase]" type="text" value=""></input>
<input type="submit" value="Search"></input>
</form>

but it always returns no items found under search

how do I get it to search all products and return list under search results category?

*

xtom

  • *****
  • 184
    • View Profile
    • XT CMS
Re: How do you create a search box to search all your products
« Reply #1 on: August 27, 2014, 02:45:46 PM »
To add a search box just put the special tag {search} in your page template where you want the search box to go. The cms should then generate the form and any other needed code automatically. I see this tag isn't in the docs so I'll get it added.

Re: How do you create a search box to search all your products
« Reply #2 on: August 27, 2014, 04:48:58 PM »
have altered templates as you have suggested but still cant seem to get any results.

eg if I search for tablet I just get one result, but if I search for android I get nothing

fault can be seen at www.scl-direct.co.uk

*

xtom

  • *****
  • 184
    • View Profile
    • XT CMS
Re: How do you create a search box to search all your products
« Reply #3 on: August 27, 2014, 05:30:09 PM »
I think this could be due to what categories are selected for the products. It looks like a bug but I'm not sure yet. I'll do some tests and post back when I know for sure what the problem is.

*

xtom

  • *****
  • 184
    • View Profile
    • XT CMS
Re: How do you create a search box to search all your products
« Reply #4 on: August 27, 2014, 08:04:33 PM »
Can you download and try the updated functions.php file below.

https://www.dropbox.com/s/vre103ce2zfx41v/functions_1_7_hotfix.zip?dl=0 (for xt-cms verison 1.7)
 
Just extract the file and replace the old one scripts/functions.php

If this works for you I'll include the fix in the next release.

Re: How do you create a search box to search all your products
« Reply #5 on: August 28, 2014, 03:55:42 PM »
I have tried this and it still does not work.

however I have noticed that if you add products to the home root category as well as the category you want then the search does work even with the old version of the file.

also wanted to ask seem to have problem with accordion menu not collapsing when sub categories are used.

ie +category1
        test1
        test2
        +category2
           test3
           test4

ie in above category1 will expand and collapse but category2 will only expand and not collapse

*

xtom

  • *****
  • 184
    • View Profile
    • XT CMS
Re: How do you create a search box to search all your products
« Reply #6 on: August 28, 2014, 04:45:24 PM »
Looks like I accidentally uploaded the old version instead of the fixed version. Can you try downloading the file again from same link. With the fix it should by default search all products regardless of category.

The accordion menu is a third party jquery plugin so I'm not sure off hand how to fix that. I will look into it and perhaps look for a more up-to-date accordion menu but for now I can't offer a quick fix.

Re: How do you create a search box to search all your products
« Reply #7 on: August 28, 2014, 06:54:44 PM »
many thanks this works ok now.

just another thought on future development having just had to edit every product to remove them now from the home category it would be nice to be able to select a category and add product to them from some kind of tick selection ie the other way round

with regards to the accordion menu can the latest version from the js query website be used by just overwriting the plugin or will this affect the special {accordion,0,0} tag

*

xtom

  • *****
  • 184
    • View Profile
    • XT CMS
Re: How do you create a search box to search all your products
« Reply #8 on: August 29, 2014, 11:30:52 AM »
I'm not sure, you can try replacing the accordion menu jquery code but I think it is unlikely to work. The cms will probably need to output different html/css that works with a different/newer accordion menu. If you know php and are feeling adventurous you can also edit includes\plugins\nav_menu_accordian.php and it might be possible to get it working with a different jquey menu but it's not the easiest thing to do.