Skip to main content

Author Topic: How do you create a search box to search all your products

d
  • **
  • Jr. Member
  • Posts: 11
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?
  • IP logged

  • *****
  • Administrator
  • Full Member
  • Posts: 233
    • XT CMS
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.
  • IP logged

d
  • **
  • Jr. Member
  • Posts: 11
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
  • IP logged

  • *****
  • Administrator
  • Full Member
  • Posts: 233
    • XT CMS
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.
  • IP logged

  • *****
  • Administrator
  • Full Member
  • Posts: 233
    • XT CMS
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.
  • IP logged

d
  • **
  • Jr. Member
  • Posts: 11
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
  • IP logged

  • *****
  • Administrator
  • Full Member
  • Posts: 233
    • XT CMS
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.
  • IP logged

d
  • **
  • Jr. Member
  • Posts: 11
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
  • IP logged

  • *****
  • Administrator
  • Full Member
  • Posts: 233
    • XT CMS
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.
  • IP logged