All extensions are free now. Because it was coded by Russians.

[Articles Good Search module] Pagination not working

Please Log in or Create an account to join the conversation.

#
Hi there! Back on this issue for those who'd want to use these two great extensions, AGS and sh404SEF:

Actually, using the J! router for the "com_content" in sh404SEF kills more or less the whole thing, because you bypass all the sh404 settings you intended to change the J! normal treatment and, even using the "modern" SEF setting in J! (to get rid of IDs in the URL) won't do it.

But one line in your response caught my eye: "Are you using a filter module on articles page (com_content)?"

Since AGS is a module, I can put it anywhere I want, not just on a "com_content-generated" page. So this is what I did:
1. I created a "Search" tag in the Joomla! tag component. I called it "Search" just to remember what it is, but you can call anything.
2. I created a menu link to a page pointing to "Tags > Tagged items", and assigned my AGS module to it
3. In sh404SEF configuration, in the "by extension" tab, I put "Use Joomla! router" and "Use Joomla! router.php" for the Tags extension, instead of the "use default handler" ans "use sh404 plugin if available"
4. After saving that config, now the pagination on search results works as expected on my search page, and my articles URLs are still the way I set them up.

Notes:
1. To have a cleaner result, I got rid of the tag component output at the bellow the search results. There is one because, although the tags are not used in this site, you still have a minimum of output displayed. You can get rid of the search box, the pagination, ... in the tag extensions options, but you'll still have "something" displayed.

What you do to get rid of this will depend greatly on the template system you use and/or your understanding of Joomla! override. In this case, as it was a Warp7 template (from Yootheme), it was easy: I created a new "layout" in the template where I can choose to hide the "system output" (that's the terminology to designate the content generated by the component on the page), and assigned this layout to menu item I created in #2 above. That way, on that page, I have only the modules output, not the component, so no trace of the "Tags" output.

2. I chose "Tags" because there are not used on that site. If you do use them, this *may* affect some of your URLS. I assume I can achieve the same result using the "News feed" component instead (I've build J! site for 13 years and never used it once).

So in any case, all is working fine now. It's a great way to search articles when you use custom fields.

Please Log in or Create an account to join the conversation.

#
Hello, Jean-Francois.

Thanks for your post and explanation.

Yes, it is good way to fix it.

Actually, sh404sef problem happened because this module can used on any page and also uses own pagination parameters. sh404sef operates only with component with known routers, so it can be an issue with not standard extensions and urls.

But, I have an idea how to fix it programmatically on AGS module side.

Please, try to apply this fix here - plugins\system\plg_articles_good_search\template\com_content\gsearch_blog.php
At the bottom, before echo $PagesLinks;
if(strpos($PagesLinks, "page-start") === false) { // sh404sef fix
	$PagesLinks = preg_replace_callback(
		'/(title="([^"]*)"[^>]*gsearch=1)/smix', 
		function($matches) use($model) {
			if((int)$matches[2] != 0) { // is page number
				return $matches[1] . '&page-start=' . ($matches[2] - 1) * $model->limit;
			}
			else if($matches[2] == "Prev") {
				return $matches[1] . '&page-start=' . ($model->input->get("page-start") - $model->limit);
			}
			else if($matches[2] == "Next") {
				return $matches[1] . '&page-start=' . ($model->input->get("page-start") + $model->limit);
			}
			else if($matches[2] == "End") {
				return $matches[1] . '&page-start=' . ($model->total_items - 1);
			}
			else {
				return $matches[0];
			}
		}, 
		$PagesLinks
	);
}

Please Log in or Create an account to join the conversation.

#
Well, I tried this but it did not work. I stil have the same URLs.

Please Log in or Create an account to join the conversation.

#
Hello, Jean-Francois.

If you still need to fix it, I can try to debug it on your site. Please, send me access rights via email.

Please Log in or Create an account to join the conversation.

#
Well, thanks, but I've spend already too much time on this site and it is now in production, so I guess if you tested it and it worked, there may be something special in my setting but it's not worth to waste time on this. My solution works, so for the moment, I'll let it the way it is.

Kind regards,
Jean-François

Please Log in or Create an account to join the conversation.

#
Hello, Jean-François.

Ok, thank you and all the best!