Hey guys.
I am trying to get the search module to produce Pretty URLs instead of this (index.php?mact=Products,cntnt01,details,0&cntnt01productid=27&cntnt01returnid=17) for the products module. Has anyone done this before, and if so, how.
Also, how can I include hierarchy/category names in the search?
Thanks in advance.
[SOLVED] Search module and Products pretty URLs
[SOLVED] Search module and Products pretty URLs
Last edited by geeves on Tue Jul 07, 2009 5:47 am, edited 1 time in total.
Re: Search module and Products pretty URLs
Hey guys.
Thought I would share what I found out. I should always remember never to be too quick and skim over module documentation.
The search tag which gives SEF results url is as follows: (in my case, searching the products module)
Then, I modified the search results template as follows:
In my case, I had to use a code for the product name (because that was the only unique information in my client's product catalogue. So I had to write a UDT to retrieve the product description from its ID.
Hope this helps someone else. As always, improvements or suggestions are always welcome.
Cheers
Thought I would share what I found out. I should always remember never to be too quick and skim over module documentation.
The search tag which gives SEF results url is as follows: (in my case, searching the products module)
Code: Select all
{search modules='Products' searchtext='Search' submit='go' resultpage='page-alias' search_method='post'}
Code: Select all
<h3>{$searchresultsfor} "{$phrase}"</h3>
{if $itemcount > 0}
<ul>
{foreach from=$results item=entry}
<li><a href="{root_url}/products/{$entry->modulerecord}/17/{$entry->urltxt}">{$entry->urltxt}</a> - {get_product_desc productid=$entry->modulerecord} ({$entry->weight}%)</li>
{/foreach}
</ul>
{else}
<p><strong>{$noresultsfound}</strong></p>
{/if}
Hope this helps someone else. As always, improvements or suggestions are always welcome.
Cheers
Last edited by geeves on Tue Jul 07, 2009 5:47 am, edited 1 time in total.
-
- Forum Members
- Posts: 21
- Joined: Tue Apr 14, 2009 3:02 pm
Re: [SOLVED] Search module and Products pretty URLs
Hi,
For me, the simply {search} tag does not work with Products : always no results !
Any idea please ?
THX
For me, the simply {search} tag does not work with Products : always no results !
Any idea please ?
THX
Re: [SOLVED] Search module and Products pretty URLs
How are you using the search tag? Please post it here so we can see what is wrong with it.
-
- Forum Members
- Posts: 21
- Joined: Tue Apr 14, 2009 3:02 pm
Re: [SOLVED] Search module and Products pretty URLs
yes i'm just using the tag : {search} in my page.
All the others pages and news appear in the results, but never elements of Products.
All the others pages and news appear in the results, but never elements of Products.
Re: [SOLVED] Search module and Products pretty URLs
@Geeves : with {search modules='Products'} have you some results out of the module Products (ie : content, news... ) ?
Re: [SOLVED] Search module and Products pretty URLs
Here are some results from the site I am currently working on (see attached image) using the code posted above.
I am still looking for a solution to my problem about no search results for custom attributes/fields or product hierarchy posted here:
http://forum.cmsmadesimple.org/index.php/topic,35391.0.html
I am still looking for a solution to my problem about no search results for custom attributes/fields or product hierarchy posted here:
http://forum.cmsmadesimple.org/index.php/topic,35391.0.html