Author Topic: small addition to router.php to stop error message with Search range  (Read 2724 times)

derek webster

  • Jr. Member
  • **
  • Posts: 84
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...

Code: [Select]
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

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 10283
  • VM3.9 Eagle Owl
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: small addition to router.php to stop error message with Search range
« Reply #1 on: June 17, 2022, 11:28:30 am »
I just wonder if vm4 works for you as expected. The if check is now very different to before
Code: [Select]
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/