Search passthru parameter not working

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
gocreative
Power Poster
Power Poster
Posts: 265
Joined: Mon Mar 14, 2011 1:16 am

Search passthru parameter not working

Post by gocreative »

I'm using ListIt2 to show a list of useful links. I'm also using the Search module to search the website, however when clicking on any of the Useful Links in the search results, the item detail is displayed in the Search page template, not the page it's supposed to (a page called Useful Links which has an alias of "useful-links").

Reading the Search module help, I've come across the passthru parameter and I'm calling it as follows, without any luck:

{search resultpage="search" passthru_ListIt2UsefulLinks_detailpage='useful-links'}

No matter what module parameters I pass through, it’s still loading the search results page when it displays the details of any Useful Links items. It is using the correct detail template though (the default).

Am I doing something wrong here?
User avatar
paulbaker
Dev Team Member
Dev Team Member
Posts: 1465
Joined: Sat Apr 18, 2009 10:09 pm
Contact:

Re: Search passthru parameter not working

Post by paulbaker »

Hmmm, I can't get it to work either. Or perhaps I am trying to do something slightly different.

My ListIt2 instance is called "ListIt2GovernorTeam". I use it on a page called "governors".

When a search matches an item in ListIt2GovernorTeam, the search module links to e.g. [root]/governorteam/dawn-smith/75/default and shows the ListIt2 info using the default ListIt2 detail template.

What I actually want the search module to do when it matches an item in ListIt2GovernorTeam is just link to the page called "governors".

I use this to call the search module:

Code: Select all

{search passthru_ListIt2GovernorTeam_detailpage="governors"}
The search module seems to ignore this passthru parameter.

In my ListIt2 instance options I have Module defaults set - both Detail page and Summary page are set to the "governors" page.

Perhaps we're both misunderstanding something?

[steds]
JohnnyB
Dev Team Member
Dev Team Member
Posts: 731
Joined: Tue Nov 21, 2006 5:05 pm

Re: Search passthru parameter not working

Post by JohnnyB »

gocreative, paulbaker,

I think you still need to modify the search results template so it can handle the request properly.

In your template, you'll need to grab results belonging to the module:

For example,

Code: Select all

{if $entry->module == 'ListIt2YourInstance'}
... then do stuff for it
{/if}
Also, you may need to capture the ListIt2YourInstance template being wanted for search results.

For example, a blog's custom search result page:

Code: Select all

{capture assign="results"}{CGBlog action=detail articleid=$entry->modulerecord detailpage="blog-articles" detailtemplate=''search_template''}{/capture}

One more detail.... In older versions of CMSMS 1.8, 1.9, I had to do regex to change the URL to the article because Search will still try to send it to your default search results page. I don't know if this is the case still.

But, you might need something like
{$articleURL|regex_replace:"/18/":"22"}
Where $articleURL is a var set for the full article link inside of the CGBlog detail template, 18 is the search results page id, and 22 is the desired page id.
"The art of life lies in a constant readjustment to our surroundings." -Okakura Kakuzo

--
LinkedIn profile
--
I only speak/write in English so I may not translate well on International posts.
--
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: Search passthru parameter not working

Post by calguy1000 »

This is not an issue with the search module. but with the Listit2 module (or other module).

Search, when it finds a result for a module, calls the module so that the module can generate the URL, retrieve and format a title etc.

If the module is not using the passed in parameters, then it's the module's fault.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
gocreative
Power Poster
Power Poster
Posts: 265
Joined: Mon Mar 14, 2011 1:16 am

Re: Search passthru parameter not working

Post by gocreative »

Thanks everyone for the input. That being the case, will JohnnyB's workaround do the trick, or is there something else that can be done?
JohnnyB
Dev Team Member
Dev Team Member
Posts: 731
Joined: Tue Nov 21, 2006 5:05 pm

Re: Search passthru parameter not working

Post by JohnnyB »

Try setting this into the template and see if there is an entry for the Listit2 instance for module or modulerecord

<pre>{$entry|@print_r}</pre>
"The art of life lies in a constant readjustment to our surroundings." -Okakura Kakuzo

--
LinkedIn profile
--
I only speak/write in English so I may not translate well on International posts.
--
gocreative
Power Poster
Power Poster
Posts: 265
Joined: Mon Mar 14, 2011 1:16 am

Re: Search passthru parameter not working

Post by gocreative »

Into the search results template, you mean?
JohnnyB
Dev Team Member
Dev Team Member
Posts: 731
Joined: Tue Nov 21, 2006 5:05 pm

Re: Search passthru parameter not working

Post by JohnnyB »

gocreative wrote:Into the search results template, you mean?
yep. That way if the module is passing what is needed, as per Calguy, they it should show up with a print_r
"The art of life lies in a constant readjustment to our surroundings." -Okakura Kakuzo

--
LinkedIn profile
--
I only speak/write in English so I may not translate well on International posts.
--
gocreative
Power Poster
Power Poster
Posts: 265
Joined: Mon Mar 14, 2011 1:16 am

Re: Search passthru parameter not working

Post by gocreative »

JohnnyB wrote:Try setting this into the template and see if there is an entry for the Listit2 instance for module or modulerecord

<pre>{$entry|@print_r}</pre>
There's this:

Code: Select all

[url] => http://mysite.com/item-alias/29
[urltxt] => Item Title
[title] => Module Friendly Name
[intweight] => 3
[module] => ListIt2ModuleName
[modulerecord] => 24
[weight] => 100
Obviously I've replaced some of the above, but hopefully this gives you what you need to know.
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am

Re: Search passthru parameter not working

Post by velden »

In your case a UseFulLink item actually has a detail view?

Or do you just want the search result link point to the page with all the links.
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am

Re: Search passthru parameter not working

Post by velden »

Intrigued by this question I've been testing some things.

This seems to work in my test environment.

NOTE: Needs CGSimpleSmarty module!

Code: Select all

{if $entry->module == 'ListIt2UsefulLinks'}
  <li>{$entry->title} - <a href="{module_action_link page='useful-links' urlonly=1 module='ListIt2UsefulLinks' action='detail' item=$entry->modulerecord}
">{$entry->urltxt}</a> ({$entry->weight}%)</li>
 {/if}
I started with a more complicated approach to get the ALIAS of the item which is needed for the 'item' parameter of LI2. Although the help explicitly states it must be alias I tested it later with the item ID which seems to work... That makes it a lot easier because item id is already available in the search entry.
gocreative
Power Poster
Power Poster
Posts: 265
Joined: Mon Mar 14, 2011 1:16 am

Re: Search passthru parameter not working

Post by gocreative »

Thanks velden! I had completely forgotten about {module_action_link}. This code helped solve my problem for a range of modules, so I really appreciate your help on this :)
Cerulean
Forum Members
Forum Members
Posts: 172
Joined: Mon Nov 01, 2010 8:56 am

Re: Search passthru parameter not working

Post by Cerulean »

The {module_action_link} method works but doesn't give you a pretty URL in the link.

Another option is to create a ListIt2 summary template to use in the site search results, e.g.

Code: Select all

{foreach from=$items item=item}
<a href="{$item->url}">{$item->title|cms_escape}</a>
{/foreach}
And then in your search template:

Code: Select all

{if $entry->module == "ListIt2MyInstance"}
<li>{$entry->title} - {ListIt2MyInstance summarytemplate="sitesearch" include_items=$entry->modulerecord} ({$entry->weight}%)</li>
{/if}
Stikki

Re: Search passthru parameter not working

Post by Stikki »

You guise are nuts, seriously. Nuts.
gocreative
Power Poster
Power Poster
Posts: 265
Joined: Mon Mar 14, 2011 1:16 am

Re: Search passthru parameter not working

Post by gocreative »

Nuts? Maybe. Solving problems for ourselves and others? Definitely!
Post Reply

Return to “Modules/Add-Ons”