Buy Now
Sign in

ccv6 Pagintor does not seem to preserve search text beween pages

russelln , April 26 2017
R
russelln
Hi,
really basic page here (just testing so far) and have the search text working fine. Added a paginator and found that when I click to the next page the search text isn't preserved, so the query changes.

New to this so may just be missing something.

Regards,
Russell
R
russelln
Just thought I'd add workaround, I added javascript in a domready to preserve the keywords between pages. Just wanted to check if this should be happening by default?


function insertParam(url, key, value) {
key = escape(key); value = escape(value);

var kvp = url.split('&');
if (kvp == '') {
url = '?' + key + '=' + value;
}
else {

var i = kvp.length; var x; while (i--) {
x = kvp[i].split('=');

if (x[0] == key) {
x[1] = value;
kvp[i] = x.join('=');
break;
}
}

if (i < 0) { kvp[kvp.length] = [key, value].join('='); }

url = kvp.join('&');
}
return( url );
}

<?php if ( isset($this->data['keywords']) ) { ?>
jQuery('.pagination a').each( function() { jQuery(this).attr('href', insertParam( jQuery(this).attr('href'), 'keywords', '<?php echo $this->data["keywords"];?>') ) });
<?php } ?>
S
simelas
Hi Russell,
another alternate way using CCV6 build in functions: Keepsearchterm in thesearchwidget field when moving from page to page withpaginator
:-)