Author Topic: canonical is adding this string to my url results,1-0.html  (Read 13271 times)

macigatto

  • Beginner
  • *
  • Posts: 20
  • A beginner
canonical is adding this string to my url results,1-0.html
« on: January 25, 2023, 17:58:23 PM »
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

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 10882
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 3.8.8
Re: canonical is adding this string to my url results,1-0.html
« Reply #1 on: January 25, 2023, 18:04:38 PM »
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 ;

      }

Quote
the 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
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 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

  • Beginner
  • *
  • Posts: 20
  • A beginner
Re: canonical is adding this string to my url results,1-0.html
« Reply #2 on: January 25, 2023, 19:24:27 PM »
sorry can you explain it please? thanks

macigatto

  • Beginner
  • *
  • Posts: 20
  • A beginner
Re: canonical is adding this string to my url results,1-0.html
« Reply #3 on: January 25, 2023, 21:50:31 PM »
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

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 4728
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: canonical is adding this string to my url results,1-0.html
« Reply #4 on: January 26, 2023, 12:13:05 PM »
If you remove this
if ( $limitstart>0 ) {
Then pagination is not working anymore

macigatto

  • Beginner
  • *
  • Posts: 20
  • A beginner
Re: canonical is adding this string to my url results,1-0.html
« Reply #5 on: January 27, 2023, 11:23:55 AM »
yes, my pagination is not working now.
please help me, how to resolved this problem of the canonical.

macigatto

  • Beginner
  • *
  • Posts: 20
  • A beginner
Re: VM 4 is adding to canonical this string pagination: results,1-0.html
« Reply #6 on: January 27, 2023, 13:50:57 PM »
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

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 10663
  • VM4.0.232 Eagle Owl
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 4 on joomla 3
Re: canonical is adding this string to my url results,1-0.html
« Reply #7 on: January 27, 2023, 20:32:31 PM »
my idea was to use instead
Code: [Select]
else if ($limit !== null &&
just
Code: [Select]
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

  • Beginner
  • *
  • Posts: 20
  • A beginner
Re: canonical is adding this string to my url results,1-0.html
« Reply #8 on: January 30, 2023, 10:39:48 AM »
I have implemented with your code, and it is working fine.
Will this be a bug fixed in next VM realease?

thanks

jenkinhill

  • UK Web Developer & Consultant
  • Global Moderator
  • Super Hero
  • *
  • Posts: 28746
  • Always on vacation
    • Jenkin Hill Internet
Re: canonical is adding this string to my url results,1-0.html
« Reply #9 on: March 15, 2023, 11:49:34 AM »
The topic is locked as it has become a target for Russian spambots.
Kelvyn

Jenkin Hill Internet,
Lowestoft, Suffolk, UK

Unsolicited PMs/emails will be ignored.

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

Currently using VirtueMart 4.2.5 10924 J! 3.10.11 PHP 8.2.7