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

Future Request - Meta String in Pagination Results

Started by Digi-web, August 24, 2018, 13:22:46 PM

Previous topic - Next topic

Digi-web

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

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

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

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

Quote from: Studio 42 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.
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

is it still not in

$jinput = JFactory::getApplication()->input;
$limit = $jinput->get('limit');
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

Digi-web

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

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

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