Author Topic: Future Request - Meta String in Pagination Results  (Read 1082 times)

Digi-web

  • Beginner
  • *
  • Posts: 36
    • Digi Web
Future Request - Meta String in Pagination Results
« on: August 24, 2018, 13:22:46 pm »
Hello,

Due to google robot reporting duplicate meta description in multiple pages such as the following:
https://demo.virtuemart.net/product-attributes?limit=60
https://demo.virtuemart.net/product-attributes

Is it possible to create a string in the meta Description and Title So it will also include some string like "page name - Category title - STRING_NAME" Where STRING_NAME could be something like "Products from page 60"
I am aware that these pages do have a canonical ref to the main category pages and should not pose a problem but google keeps reporting these page urls in Webmaster tools as problematic and it takes time to identify them...

PS. The only relative topic i found is this:
https://forum.virtuemart.net/index.php?topic=113166.msg380712#msg380712

Edit:
Possible code in views/category/view.html.php

      // check if pagination is set - code from virtuemart router check
      if (is_int(vmrouterHelper::$limit) === false) {
         
         //check if page no from pagination exists  eg: results,25-48 (page 2)
         if( $pageNo !== "" ){
            
            $limitConst = $pageNo;
            //update meta title end description
            $metadesc .=' - '.vmText::_('COM_VIRTUEMART_SEF_PAGE').': '.$limitConst;
            $document->setMetaData('description',$metadesc);
            //will be set bellow
            $title .=' - '.vmText::_('COM_VIRTUEMART_SEF_PAGE').': '.$limitConst;
         }else{
            //should check somehow how the product view number changes eg from 24 to 48 eg: results,1-48
            $limitConst = vmrouterHelper::$limit;
            $limitConstclean = str_replace(",","",$limitConst); // may be like 24,48 if multiple values are inserted
            
            $jinput = JFactory::getApplication()->input;
            $limitget = $jinput->get('limit');
            
            if( ($limitget !== null) && ($limitConstclean !== $limitget) ){
               //ADD a CUSTOM COM_VIRTUEMART_SEF_PAGINATION IN JOOMLA OVERIDES something like pagination (should show Title - pagination: 12)
               
               //update meta title end description
               $metadesc .=' - '.vmText::_('COM_VIRTUEMART_SEF_PAGINATION').': '.$limitget;
               $document->setMetaData('description',$metadesc);
               //will be set bellow
               $title .=' - '.vmText::_('COM_VIRTUEMART_SEF_PAGINATION').': '.$limitget;
            }
         }         
         
      }
      //edit end

Best regards,
Alexander
Custom Joomla - Virtuemart Development and Templates
Website: http://www.digi-web.gr

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 4387
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: Future Request - Meta String in Pagination Results
« Reply #1 on: August 24, 2018, 19:31:47 pm »
In query parameters :
first result index exist it's set to 'limitstart'(if empty then you are in page 0)
'limit' is the number of result and should exist to.
So you can use this 2 values to change the title and metadesc

Digi-web

  • Beginner
  • *
  • Posts: 36
    • Digi Web
Re: Future Request - Meta String in Pagination Results
« Reply #2 on: August 27, 2018, 08:42:04 am »
Hi, thank you the info i have figured it out regarding pagination and it is working ok. I have edited the initial post for the code as well.

What i was also trying to achieve is :

We do have pagination so in case of lets say a category has 30 products and we have a limit to 24 i press the page 2 and the url becomes /results,25-48 (page 2) so we are OK here i can detect that.
What i cannot detect is in case a page has 30 products and i press the button to see not 24 products but eg 48 so no pagination is set but the actual URL changes and becomes /results,1-48.
In my tests there is no variable to detect that as vmrouterHelper::$limit is always set from config and the get variables are unset. Any ideas?

BR,
Alexander
Custom Joomla - Virtuemart Development and Templates
Website: http://www.digi-web.gr

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 4387
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: Future Request - Meta String in Pagination Results
« Reply #3 on: August 27, 2018, 13:07:50 pm »
If you want set it when this are unknow, you have to use same code as in the router.
Or perhaps in the category model getpaginationlimit, i never checked if VIrtuemart return the right limit in all case.

Digi-web

  • Beginner
  • *
  • Posts: 36
    • Digi Web
Re: Future Request - Meta String in Pagination Results
« Reply #4 on: August 27, 2018, 13:23:42 pm »
If you want set it when this are unknow, you have to use same code as in the router.
Or perhaps in the category model getpaginationlimit, i never checked if VIrtuemart return the right limit in all case.
Yes but the router after it sees the GET requests then it unsets them so i cannot access them afterwards... all pagination vars are not set from my var_dumps or there is no useful info in order to step on it and create a certain rule... Anyway i am glad i took this so far as most of duplicate issues will be gone :)

I will give it a try when i have more time perhaps.
Custom Joomla - Virtuemart Development and Templates
Website: http://www.digi-web.gr

GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 9909
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 3.6.8
Re: Future Request - Meta String in Pagination Results
« Reply #5 on: August 27, 2018, 16:28:53 pm »
is it still not in

$jinput = JFactory::getApplication()->input;
$limit = $jinput->get('limit');
GJC Web Design
VirtueMart and Joomla Developers - php developers http://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
http://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

Digi-web

  • Beginner
  • *
  • Posts: 36
    • Digi Web
Re: Future Request - Meta String in Pagination Results
« Reply #6 on: August 27, 2018, 18:13:29 pm »
Yes indeed this is the first i checked ... limit is a get request and it is unset in the virtuemart main router.php so it does not exist afterwards... o thing in oir case it is zero and this is why it is unset but we have nothing to work on...  i am not sure if theee is anu way to check it before router i think not .
Custom Joomla - Virtuemart Development and Templates
Website: http://www.digi-web.gr

Digi-web

  • Beginner
  • *
  • Posts: 36
    • Digi Web
Re: Future Request - Meta String in Pagination Results
« Reply #7 on: August 28, 2018, 15:32:51 pm »
Code updated, tested locally and seems to work OK, what do you think?
The SEO text has to change of course...
Custom Joomla - Virtuemart Development and Templates
Website: http://www.digi-web.gr

Digi-web

  • Beginner
  • *
  • Posts: 36
    • Digi Web
Re: Future Request - Meta String in Pagination Results
« Reply #8 on: August 29, 2018, 12:05:35 pm »
I found some issues in the last edit so i fixed them today, tested successfully in both local and live server.
Custom Joomla - Virtuemart Development and Templates
Website: http://www.digi-web.gr