Author Topic: Page titles do not append the site name, if defined so in J global configuration  (Read 1068 times)

arcturus

  • Jr. Member
  • **
  • Posts: 99
  • VirtueMart Version: 3.6.10 10211
Hello everyone,

I see that VM page titles do not take into consideration the settings made in global configuration in Joomla (append site name before or after the current page title).
Cheers,
George
https://www.proxima-mundi.ro

Now I'm using Joomla! 3.9.13 and VM 3.6.10 10211 on PHP 7.3.9

Ventsi Genchev

  • Jr. Member
  • **
  • Posts: 294
    • Audio Store
Somewhere in the forum described what should be done. I don't remember which post exactly, but I did it according to my needs.
Audio Store:
https://vsystem.bg - Bulgarian language
https://vsystem.bg/en - English

AH

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 3025
  • VirtueMart Version: 3.6.3
Correct it does not do this - you need a page override

In category default.php

Code: [Select]
//Overrides the meta page title set int the view.html
$Jconfig = JFactory::getConfig();
$qsitename = $Jconfig->get('sitename');
$document = JFactory::getDocument ();

//adds title of category name with sitename
$document->setTitle($this->category->category_name . ' - '. $qsitename);

//could use existing title and append sitename - which would cater for manual entry
//$document->setTitle($document->title . ' - '. $qsitename);

regards
A

Joomla 3.9.12
php 7.2

arcturus

  • Jr. Member
  • **
  • Posts: 99
  • VirtueMart Version: 3.6.10 10211
I use that, but it is something that should be modified in the core, for all pages involved (not only categories and products, but also checkout, my orders etc.)
Cheers,
George
https://www.proxima-mundi.ro

Now I'm using Joomla! 3.9.13 and VM 3.6.10 10211 on PHP 7.3.9

AH

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 3025
  • VirtueMart Version: 3.6.3
Quote
but it is something that should be modified in the core, for all pages involved (not only categories and products, but also checkout, my orders etc.)

But for some - this is not what would be wanted as it would reduce the readability of product name

There is no need to add to checkout or my orders - they are never referenced anywhere so the click through advantage is meaningless

regards
A

Joomla 3.9.12
php 7.2

arcturus

  • Jr. Member
  • **
  • Posts: 99
  • VirtueMart Version: 3.6.10 10211
It's good for SEO though. Product title would go first, and site name in the end, so it would be easily readable in Google results.
Cheers,
George
https://www.proxima-mundi.ro

Now I'm using Joomla! 3.9.13 and VM 3.6.10 10211 on PHP 7.3.9

AH

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 3025
  • VirtueMart Version: 3.6.3
Then apply the override to the template I showed earlier :-)
regards
A

Joomla 3.9.12
php 7.2

arcturus

  • Jr. Member
  • **
  • Posts: 99
  • VirtueMart Version: 3.6.10 10211
I said I'm already using that [template override]. I simply pointed out that that option should be somewhere in the core, so to not be necessary to modify the templates.
Cheers,
George
https://www.proxima-mundi.ro

Now I'm using Joomla! 3.9.13 and VM 3.6.10 10211 on PHP 7.3.9

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 9997
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
I agree with you. When you can write an override, ...

check the category view, the file view.html.php line 479 (in the new core vm3.6) and then just add it and write the code here.
I should fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

arcturus

  • Jr. Member
  • **
  • Posts: 99
  • VirtueMart Version: 3.6.10 10211
The file view.html.php is not overrideable.
The disadvantages of having to make modifications in the core is that they must be done every time the core changes.
I did them in the template.
Cheers,
George
https://www.proxima-mundi.ro

Now I'm using Joomla! 3.9.13 and VM 3.6.10 10211 on PHP 7.3.9

GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 9223
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 3.6.8
Max is saying write it for the view.html.php , post it here and he will add it to the core
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

AH

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 3025
  • VirtueMart Version: 3.6.3
And make it a optional VM configuration so it does not screw up everyone elses overrides!!
regards
A

Joomla 3.9.12
php 7.2

arcturus

  • Jr. Member
  • **
  • Posts: 99
  • VirtueMart Version: 3.6.10 10211
For category, it could be
Code: [Select]
$includeSiteName = (int) JFactory::getApplication()->getCfg('sitename_pagetitles');
$category_id  = vRequest::getInt ('virtuemart_category_id', 0);
if ($includeSiteName && $category_id != 0){
$document = JFactory::getDocument();
$siteName = JFactory::getApplication()->getCfg('sitename');
$docTitle = $document->getTitle();
switch ($includeSiteName){
case 1;
$document->setTitle($siteName . ' - ' . $docTitle);
break;
case 2;
$document->setTitle($docTitle . ' - ' . $siteName);
break;
}
}

For product page:
Code: [Select]
$includeSiteName = (int) JFactory::getApplication()->getCfg('sitename_pagetitles');
if ($includeSiteName){
$document = JFactory::getDocument();
$siteName = JFactory::getApplication()->getCfg('sitename');
$docTitle = $document->getTitle();
switch ($includeSiteName){
case 1;
$document->setTitle($siteName . ' - ' . $docTitle);
break;
case 2;
$document->setTitle($docTitle . ' - ' . $siteName);
break;
}
}

(I'm actually using these pieces of code.)

If both snippets are used, the title on a product page will be
Product Name - Category - Site name for Site title set to "after" in global configuration (which looks good and it's comprehensible by humans and search engines :) )

I was wondering if that kind of code can be added more into the core, so it could be used more simply for all the pages (including checkout, my orders etc.). In this case, the two snippets could be combined somehow, to select automatically if it's a category or some other VM page.
Cheers,
George
https://www.proxima-mundi.ro

Now I'm using Joomla! 3.9.13 and VM 3.6.10 10211 on PHP 7.3.9

AH

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 3025
  • VirtueMart Version: 3.6.3
The modifications needs to go into the relevant view.html

It should to be a VM config that is not switched on by default

Consider using a parameter e.g.:
Code: [Select]
VmConfig::get('appendsitename',0),
Doing an override is simple, as you are doing it for yourself

If you want things into core - you have to give an option of configuration so that this does not impact sites already in production

If you look at this will give you an idea of where metadata is set by VM - that would require adjustment to cater for your specific instance and move into core

\components\com_virtuemart\views\category\view.html.php
regards
A

Joomla 3.9.12
php 7.2

arcturus

  • Jr. Member
  • **
  • Posts: 99
  • VirtueMart Version: 3.6.10 10211
The snippets above use the setting from the global configuration, and they obviously do not automatically turn on the "append site name in the title option" (so if it's turned on, it's on for the entire website, including VM).
In case these snippets (or a combination of them) cannot be added more into the core, the second one above could be used for all VM views, either in the view.html.php files, or in the default.php files for each view.
Cheers,
George
https://www.proxima-mundi.ro

Now I'm using Joomla! 3.9.13 and VM 3.6.10 10211 on PHP 7.3.9