News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

small addition to router.php to stop error message with Search range

Started by derek webster, September 03, 2020, 15:06:38 PM

Previous topic - Next topic

derek webster

VirtueMart 3.8.4 10335

Hi Ive had a little bit of development work done and I'd like to submit this for inclusion into future VM builds.
We wnted our sef results to be cleaner - so changed /results,1-100?keyword=searchterm to this /results?keyword=searchterm

in Router.php we were getting an error when searching when there was no limit defined.

the following fixes the error...

if(isset($splitted[1])) { // This is the IF clause that fixes the error
$results = explode('-',$splitted[1],2);
//Pagination has changed, removed the -1 note by Max Milbers NOTE: Works on j1.5, but NOT j1.7
// limitstart is swapped by joomla to start ! See includes/route.php
if ($start = $results[0]-1) $vars['limitstart'] = $start;
else $vars['limitstart'] = 0 ;
$vars['limit'] = (int)$results[1]-$results[0]+1;
} // end of If caluse


Milbo

I just wonder if vm4 works for you as expected. The if check is now very different to before

if ( self::compareKey($splitted[0] ,'results')){
array_pop($segments);
$results = explode('-',$splitted[1],2);
//Pagination has changed, removed the -1 note by Max Milbers NOTE: Works on j1.5, but NOT j1.7
// limitstart is swapped by joomla to start ! See includes/route.php
if ($start = $results[0]-1) $vars['limitstart'] = $start;
else $vars['limitstart'] = 0 ;
$vars['limit'] = (int)$results[1]-$results[0]+1;

} else {
$vars['limitstart'] = 0 ;

}
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/