[SOLVED] Search module and Products pretty URLs

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
geeves
Forum Members
Forum Members
Posts: 114
Joined: Wed Dec 03, 2008 4:56 am

[SOLVED] Search module and Products pretty URLs

Post by geeves »

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.
Last edited by geeves on Tue Jul 07, 2009 5:47 am, edited 1 time in total.
Ara Garabedian
Multimedia Designer / Developer
http://ara.ifky.com.au
geeves
Forum Members
Forum Members
Posts: 114
Joined: Wed Dec 03, 2008 4:56 am

Re: Search module and Products pretty URLs

Post by geeves »

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)

Code: Select all

{search modules='Products' searchtext='Search' submit='go' resultpage='page-alias' search_method='post'}
Then, I modified the search results template as follows:

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}
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
Last edited by geeves on Tue Jul 07, 2009 5:47 am, edited 1 time in total.
Ara Garabedian
Multimedia Designer / Developer
http://ara.ifky.com.au
sudestmanceau
Forum Members
Forum Members
Posts: 21
Joined: Tue Apr 14, 2009 3:02 pm

Re: [SOLVED] Search module and Products pretty URLs

Post by sudestmanceau »

Hi,

For me, the simply {search} tag does not work with Products : always no results !
Any idea please ?
THX
geeves
Forum Members
Forum Members
Posts: 114
Joined: Wed Dec 03, 2008 4:56 am

Re: [SOLVED] Search module and Products pretty URLs

Post by geeves »

How are you using the search tag? Please post it here so we can see what is wrong with it.
Ara Garabedian
Multimedia Designer / Developer
http://ara.ifky.com.au
sudestmanceau
Forum Members
Forum Members
Posts: 21
Joined: Tue Apr 14, 2009 3:02 pm

Re: [SOLVED] Search module and Products pretty URLs

Post by sudestmanceau »

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.
Jean le Chauve

Re: [SOLVED] Search module and Products pretty URLs

Post by Jean le Chauve »

@Geeves : with {search modules='Products'} have you some results out of the module Products (ie : content, news... ) ?
geeves
Forum Members
Forum Members
Posts: 114
Joined: Wed Dec 03, 2008 4:56 am

Re: [SOLVED] Search module and Products pretty URLs

Post by geeves »

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
Attachments
test.png
Ara Garabedian
Multimedia Designer / Developer
http://ara.ifky.com.au
Post Reply

Return to “Modules/Add-Ons”