Show a contact form when Search results = 0

Many users do a search for a product I don’t carry but that I could get for them if they’re willing to pre-order.

I would like to show a contact form when search result returns 0 products.

Let’s say a customer does a search for product X and the search returns no results, I want the search results page to show the normal search results information : (Products found: 0, No products found matching the search criteria) + a contact us form at the bottom of this box.

Can anybody help me with this?


fully agree and a good suggestion also for retention purposes

Just for sh*ts and giggles, I did this for you, but I need to make it dynamic

(right now I had to hard code the form)

IF you want to try and make it work here’s what I did.

(This is in 1.3.4 sp3, so the names of the templates/locations may be different, but the priniples are similiar)

EDIT this template:


near the bottom find

```php {else}


{/if} ```

You need to alter this code. My "quickie" way of doing this was to make a new contact form with minimal input fields. I uploaded it, copied the Source Code for the form only, (thru View Source) and made a new page which I named no_search_results.html and put in the /forms_pages/ directory.

I then inserted that into the code mentioned above

```php {else}

{include file="[COLOR="Red"]forms_pages/no_search_results.html[/COLOR]"}

{/if} ```

I know this can be done dynamically, but I am out of time right now (its a holiday here in the states, time to party ;) .....)

You can see it in action on my site...just put something nonsensical in the search box and try it
(like htyyprq)

It worked very nicely. Thanks for your help Mike and happy Memorial Day :slight_smile:

I think I spoke too fast, the form shows but the Submit button does not work.

My submit button code (which is commented out because I use the captcha mod (for 1.3.4 sp3) and the captcha,tpl contains the button code.

Make sure your javascript references are there (2 lines up top i think)

Here is the whole html page. The references are specific to my site, but maybe you can use it to troubleshoot


Search Assistance: Send us an email and we'll check for you.

The fields marked with * are mandatory

Name: *

E-Mail: *

Product Inquiry: *

Comments: *


{*include file="forms_pages/captcha.tpl"*}