0

I use search boxes throughout my site with this code-

<form action="/catalogsearch/result/" method="get">

And everything works great. I am now trying to use this same method with advanced search. The purpose is to only search within a single attribute. In my case this url works great- /catalogsearch/advanced/result/?manufacturer=26&name=single+phase

The problem I am running into is if I try to use this code-

<form action="/catalogsearch/advanced/result/?manufacturer=26"  method="get">

It doesn't work. It seems like it strips ?manufacturer=26, but even if it didn't strip off the ? I don't think a url would work with two separate ? anyway. Anyone have any idea to fix this? Or a different idea to create a search by an attribute?

2

If you have manufacturer as a product attribute, you can put a hidden field with name manufacturer in your advanced search form like below.

<input type="hidden" name="manufacturer" id="manufacturer" value="26" />

When you submit your form, the parameter will pass automatically to your url.

| improve this answer | |
  • I thought it worked but it didn't. It just returns all things under the manufacturer. It doesn't include the search term. – Tyler Jensen Feb 13 '17 at 17:09
  • Can you please add your form code to your question ? – Jaimin Sutariya Feb 13 '17 at 17:11
  • I got it. I needed to change name="q" to name="name" – Tyler Jensen Feb 13 '17 at 17:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.