splittingred / SimpleSearch

A simple search component for MODx Revolution
http://docs.modxcms.com/display/ADDON/SimpleSearch
36 stars 36 forks source link

1.4 Pagination Links are broken #51

Closed jeremyshearer closed 13 years ago

jeremyshearer commented 13 years ago

The href attribute on the anchor tag is blank. It's as if [[+link]] is returning nothing in the default template. sample output: 2 |

seekdiver commented 13 years ago

Hi, I've encounter the issue of pagination links redirect to our website main page instead of the search links. Was using 1.3, upgraded to 1.4.0 also same issue. Please help. Before upgrading to 1.3 when using 1.1.1, everything was fine.

jeremyshearer commented 13 years ago

If it helps, I'm using Modx Revo 2.1, with version 1.4 of SimpleSearch.

jeremyshearer commented 13 years ago

still trying to figure this out. I found this post (http://modxcms.com/forums/index.php?topic=63467.0) where makeUrl was returning an empty string because the anonymous user didn't have sufficient permissions in the context they were using. My example is also in a context other than web, however I tried adding the permissions and then flushing permissions and settings but I'm still not getting any output for the href attribute of the pagination link.

jeremyshearer commented 13 years ago

Looks like it's definitely a context issue for me. I added a simple search form to my main 'web' context and the pagination links were returned correctly. I check my secondary context's settings against the page here: http://rtfm.modx.com/display/revolution20/Creating+a+Subdomain+from+a+Folder+using+Virtual+Hosts and didn't see any issues. I've tried manually setting the context in my simplesearch snippet call, but to no effect.

seekdiver commented 13 years ago

i just change the [[_id]] to [[_alias]] and the pagination links are back to norm.

jeremyshearer commented 13 years ago

@seekdiver where did you make the chang efrom [[_id]] to [[_alias]]? are you using a custom template for the pagination links?

seekdiver commented 13 years ago

do you know the SearchFormTpl chunks? the form action="[[*id]]" , yes we are using custom template.

Pavuk commented 13 years ago

Here is my solution:

Our web is using multiple contexts. Pagination failed with using custom contexts.

API tells: http://api.modxcms.com/modx/modX.html#makeUrl string makeUrl (integer $id, [string $context = ''], [string $args = ''], [mixed $scheme = -1])

but there are swapped and shifted parameters at simplesearch.class.php at line 206:

$pageArray['link'] = $this->modx->makeUrl($id, $urlScheme, $parameters);

where $context missing. $urlScheme and $parameters are swifted. So $urlScheme belongs to $context, $parameters is at right position and the last parameter (urlScheme) is missing.

So corrected line is: $pageArray['link'] = $this->modx->makeUrl($id, $this->modx->context->get('key'), $parameters, $urlScheme);

jeremyshearer commented 13 years ago

Perfect! Big thanks to Pavuk for the solution, I made the change proposed and my pagination links are now being built correctly.