Direct link to searchresults Products module
Previous article Next articleAt my no salt diet website I use the CMS Made Simple Products module for a Nutrient Database. When you want to know the nutritional values of in example an apple, you type "apple" in the searchbox, hit the submit button and you will get a list of all items containing the word "apple".
So far, so good. But what I missed is a direct link to the search resultspage in case people ask me questions about some product.
I created a work around to achieve this.
How to use
Add to the top of your CMSMS Products Search Template:
Searchbox
Change in the content of the template:
<p class="row_prompt">{$mod->Lang('search_name')}:</p>
<p class="row_input"><input type="text" name="{$actionid}cd_prodname" size="40" maxlength="255" /></p>
</div>
<p class="row_prompt">{$mod->Lang('search_name')}:</p>
<p class="row_input"><input type="text" name="{$actionid}cd_prodname" value="{$keyword}" size="40" maxlength="255" /></p>
</div>
Submit button
Change on the bottom of the template the submit button code:
Into:
{if $keyword != ''}<script language="javascript">document.getElementById("ProdSearchSubmit").click();</script>{/if}
Show direct pagelink
At the bottom of your summary template you can add something like:
http://www.website.com/your-page-alias?keyword={$actionparams.cd_prodname}</p>
When you open the searchpage with the direct link the search template reads the keyword string in the url. The keyword is automaticly filled in into the search field. And the javascript "clicks" at the submit button.
Working example
Comment Form
ReviewManager
ReviewManager
1 Comment
Super!