canonical is adding this string to my url results,1-0.html

Started by macigatto, January 25, 2023, 17:58:23 PM

Previous topic - Next topic

macigatto

hello, please help me.
I have joomla 3 last version and virtuemart 4

from the last upgrade to virtuemart 4, my canonical is not correct, to the homepage shop and to the category page it is added this /results,1-0.html

https://www.mysite.com/results,1-0.html

please help me, where to look at

thanks

GJC Web Design

Milbo told me is comes from around the router.php ~ 753

      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 = intval($results[0])-1) $vars['limitstart'] = $start;
         else $vars['limitstart'] = 0 ;
         $vars['limit'] = (int)$results[1]-$results[0]+1;

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

      }

Quotethe side effect of the fix "unsupported operand types ... " in router.

Haven't had time to look at any of this ....
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

macigatto


macigatto

I resolved commenting this code in file:
router.php

moreover i have not idea what this code is for, and if it is good what I did, anyway it resolved the canonical problem with results,1-0.html

at line 482

/****   
            $limitstart = intval($limitstart);
            $limit = intval($limit);

            if ( $limitstart>0 ) {
               //For the urls leading to the paginated pages
               // using general limit if $limit is not set
               if ($limit === null) $limit= vmrouterHelper::$limit ;
               $segments[] = self::lang('results') .','. ($limitstart+1).'-'.($limitstart+$limit);
            } else if ($limit !== null && $limit != vmrouterHelper::$limit ) {
               //for the urls of the list where the user sets the pagination size/limit
               $segments[] = self::lang('results') .',1-'.$limit ;
            } else if(!empty($query['search']) or !empty($query['keyword'])){
               $segments[] = self::lang('results') .',1-'.vmrouterHelper::$limit ;
            }
            if(self::$debug)vmdebug('category link segments',$query, $segments); 
           
          ****/

Studio 42

If you remove this
if ( $limitstart>0 ) {
Then pagination is not working anymore

macigatto

yes, my pagination is not working now.
please help me, how to resolved this problem of the canonical.

macigatto

I have resolved adding this line of code testing
if limit is != 0
this is preventing to have in url this results,1-0.html


else if ($limit !== null && $limit != vmrouterHelper::$limit ) {
               //for the urls of the list where the user sets the pagination size/limit
                   
                    if( $limit != 0)    //I HAVE ADDED THIS LINE
                    $segments[] = self::lang('results') .',1-'.$limit ;



please let me know if this is ok and if this is a VM bug resolved.

I have another question:
why some of my category page are paginated in URL by

?start=44

and others by

/results,45-44.html

??????

thanks

Milbo

my idea was to use instead
else if ($limit !== null &&

just
if (!empty($limit) &&
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

macigatto

I have implemented with your code, and it is working fine.
Will this be a bug fixed in next VM realease?

thanks

jenkinhill

The topic is locked as it has become a target for Russian spambots.
Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum