0

Alright, trying to get SuperSearch with Keywords working with pagination. Having a bit of trouble, as the "autopath" variable isn't turning in to a useful URL.

{exp:super_search:results channel="products" limit="12" sort="desc" paginate="bottom"}
...
{paginate}
{if next_page}<a href="{auto_path}">Next</a>{/if}
{/paginate}
{/exp:super_search:results}

This works fine without search terms:

<a href="http://example.com/index.php/search/P12">Next</a>

However, a soon as I search:

<a href="http://example.com/index.php/search&keywords=searchthing/P12">Next</a>

Which doesn't work as a URL, or to get the next page of keyword limited things.

1 Answer 1

0

Found a work around.

With a template route of:

/search/{search:regex[(search\&.+)]}/{page:pagination}

And PHP-Output turned on, this solved my problem:

<?php
function FixPath($toFix)
{
    if (strpos($toFix, 'search/search') === FALSE && strpos($toFix, '&') !== FALSE) { $toFix = str_replace('search', 'search/search', $toFix); }
    return $toFix;
}
?>
{if previous_page}<a href="<?php echo FixPath('{auto_path}'); ?>">Previous</a>{/if}
{if next_page}<a href="<?php echo FixPath('{auto_path}'); ?>">Next</a>{/if}

Essentially, this simply looks for the undesired state, and fixes it. I had a combination of links sharing templates, so had to be careful how I fixed it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.