Author Topic: VM seems to ignore the Joomla setting 'jform_sitename_pagetitles'  (Read 1652 times)

gba

  • Jr. Member
  • **
  • Posts: 279
Hi VM team!

VM seems to ignore the Joomla setting 'jform_sitename_pagetitles':
No matter whether I choose to show the site name before or after page title in Joomla config, no site title is rendered into page titles of VM pages.
What do you know about that?

Kind regards,
Gerald

jjk

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 3469
  • using Matomo instead of Google Analytics
Re: VM seems to ignore the Joomla setting 'jform_sitename_pagetitles'
« Reply #1 on: October 11, 2017, 23:25:45 pm »
Don't know much about it. 'jform_sitename_pagetitles' doesn't seem to be used in core Joomla and also not in VirtueMart. So I guess you are using a third party extension for pagetitles. VirtueMart has it's own 'custom page title' form field, which you can set in the product settings for each product.
Non-English Shops: Are your language files up to date?
http://virtuemart.net/community/translations

gba

  • Jr. Member
  • **
  • Posts: 279
Re: VM seems to ignore the Joomla setting 'jform_sitename_pagetitles'
« Reply #2 on: October 12, 2017, 08:33:38 am »
Hi!

Thank you for your reply.
Actually I am not sure, if I understood it ...

I am talking about the Joomla config setting 'Site Name in Page Titles'.
According to this setting the site name is added before, after or not at all to the current page title.
The issue is, that VM pages (i. e. category view, cart view, order view) do not add the site name to the page title - neither before nor after.
This happens with VM pages, only.

Kind regards,
Gerald

p.barg

  • 3rd party VirtueMart Developer
  • Jr. Member
  • *
  • Posts: 162
    • Barg IT
Re: VM seems to ignore the Joomla setting 'jform_sitename_pagetitles'
« Reply #3 on: October 12, 2017, 09:49:14 am »
Hello,

you can add the necessary code into your template override files. For e.g. category view, open your template override file <your-template>/html/com_virtuemart/category/default.php and include the following code:
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;
    }
}

For the other VM pages you can do the same.

Hope that helps,

Petra

gba

  • Jr. Member
  • **
  • Posts: 279
Re: VM seems to ignore the Joomla setting 'jform_sitename_pagetitles'
« Reply #4 on: October 12, 2017, 10:07:32 am »
Hi Petra!

Thank you for your help.
This is very good for my overrides.
But what about VM pages, I have no override for?
Shouldn't VM do exactly this natively on all VM pages?

Kind regards,
Gerald

p.barg

  • 3rd party VirtueMart Developer
  • Jr. Member
  • *
  • Posts: 162
    • Barg IT
Re: VM seems to ignore the Joomla setting 'jform_sitename_pagetitles'
« Reply #5 on: October 12, 2017, 10:22:50 am »
Hi Gerald,

just copy the original files as overrides and add the code snippet.
As far as I know VM doesn't make use of the Joomla! setting.

-- Petra

gba

  • Jr. Member
  • **
  • Posts: 279
Re: VM seems to ignore the Joomla setting 'jform_sitename_pagetitles'
« Reply #6 on: October 12, 2017, 10:55:56 am »
Thank you for the workaround.
I will consider that.

@VM team:
To me this seems to be an issue, that should be considered in the next VM version.
Do you agree?

Kind regards,
Gerald

jjk

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 3469
  • using Matomo instead of Google Analytics
Re: VM seems to ignore the Joomla setting 'jform_sitename_pagetitles'
« Reply #7 on: October 12, 2017, 23:43:06 pm »
I am talking about the Joomla config setting 'Site Name in Page Titles'.
That one works only in VM if you have a Joomla menu item pointing to the VM page. The optional 'Custom Page Title', which is available in the VM category and product views are meant for individual (manually typed) overrides.

This one might also be of interest to you: https://forum.virtuemart.net/index.php?topic=108776.msg371876#msg371876 (The line has changed a bit meanwhile. But if you make a change there, you can't use a template override. (I always change it to include the manufacturer name).

Something to consider - if you add the sitename to all pages, you are limiting the number of characters in the Google serps for the rest. I think Google still cuts it off after approximately 70 characters.
Non-English Shops: Are your language files up to date?
http://virtuemart.net/community/translations

Ventsi Genchev

  • Jr. Member
  • **
  • Posts: 266
    • Audio Store
Re: VM seems to ignore the Joomla setting 'jform_sitename_pagetitles'
« Reply #8 on: October 13, 2017, 08:32:49 am »
On the basis of the topic, I want to ask why the title of the page for the product should be "Category name : Product name"?
For example, it looks like this: "Headphones & Headsets : Headphones Philips RS 3256 - Black". In addition, when a product is stopped by production, I move it to a "not produced" category. (in the URL I do not use the category name).
In my opinion, it would be better: "Product name - Site name".

My question is: Is this important for SEO or for another reason?
Audio Store:
https://vsystem.bg - Bulgarian language
https://vsystem.bg/en - English

AH

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 2915
  • VirtueMart Version: 3.6.0
Re: VM seems to ignore the Joomla setting 'jform_sitename_pagetitles'
« Reply #9 on: October 13, 2017, 09:22:21 am »
You can do all of this using an override in the product template

Code: [Select]
//override the meta set in the view.html
$document = JFactory::getDocument ();
$document->setTitle(strip_tags(html_entity_decode($this->product->product_name . ' : ' . ($this->category->category_name ? (vmText::_($this->category->category_name)) : '') ,ENT_QUOTES)));

(You have to find the variable for site name and remove the category variable)

You can modify to fit your requirements and you can also modify other Joomla document settings as required
regards
A

Joomla 3.9.8
php 7.1

Ventsi Genchev

  • Jr. Member
  • **
  • Posts: 266
    • Audio Store
Re: VM seems to ignore the Joomla setting 'jform_sitename_pagetitles'
« Reply #10 on: October 13, 2017, 09:45:55 am »
Yes, that's great. Thank you, AH.
Unfortunately, this situation loses the ability to have a custom page title for a specific product.
For example, in this option:
Code: [Select]
$document = JFactory::getDocument ();
if ($product->customtitle) {
$document->setTitle(strip_tags(html_entity_decode($product->customtitle,ENT_QUOTES)));
} else {
$document->setTitle(strip_tags(html_entity_decode($this->product->product_name . ' : ' . ($this->category->category_name ? (vmText::_($this->category->category_name)) : '') ,ENT_QUOTES)));
}
Audio Store:
https://vsystem.bg - Bulgarian language
https://vsystem.bg/en - English

Ventsi Genchev

  • Jr. Member
  • **
  • Posts: 266
    • Audio Store
Re: VM seems to ignore the Joomla setting 'jform_sitename_pagetitles'
« Reply #11 on: October 13, 2017, 10:02:00 am »
So if we want to be able to set up a custom page title for a specific product page in the administration, the following is required:
Code: [Select]
$document = JFactory::getDocument ();
$product = $this->get('product');
if ($product->customtitle) {
$document->setTitle(strip_tags(html_entity_decode($product->customtitle,ENT_QUOTES)));
} else {
$document->setTitle(strip_tags(html_entity_decode($this->product->product_name . ' : ' . ($this->category->category_name ? (vmText::_($this->category->category_name)) : '') ,ENT_QUOTES)));
}

But I do not know if all this will cause some delay when loading the page.
What do you think?
Audio Store:
https://vsystem.bg - Bulgarian language
https://vsystem.bg/en - English

GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 8891
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 3.4.2
Re: VM seems to ignore the Joomla setting 'jform_sitename_pagetitles'
« Reply #12 on: October 13, 2017, 10:39:05 am »
will not affect loading time in any measurable way
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: 2915
  • VirtueMart Version: 3.6.0
Re: VM seems to ignore the Joomla setting 'jform_sitename_pagetitles'
« Reply #13 on: October 13, 2017, 10:54:13 am »
Venci

As I said :-
Quote
You can modify to fit your requirements

Thanks for the update and good to see you now have what you need  :)
regards
A

Joomla 3.9.8
php 7.1

Ventsi Genchev

  • Jr. Member
  • **
  • Posts: 266
    • Audio Store
Re: VM seems to ignore the Joomla setting 'jform_sitename_pagetitles'
« Reply #14 on: October 13, 2017, 11:06:04 am »
Thank you, GJC and AH.

I apologize to gba for my intervention in his question.

And to unify everything from this topic if we want the product page name to look like this: Product Name : Category Name - Site Name
The code we need to add to the templates/template_name/html/com_virtuemart/productdetails/default.php looks like this:
Code: [Select]
<?php //override the meta set in the view.html - AH
$document JFactory::getDocument ();
$product $this->get('product');
if (
$product->customtitle) {
$document->setTitle(strip_tags(html_entity_decode($product->customtitle,ENT_QUOTES)));
} else {
$document->setTitle(strip_tags(html_entity_decode($this->product->product_name ' : ' . ($this->category->category_name ? (vmText::_($this->category->category_name)) : '') ,ENT_QUOTES)));
}
/* BEGIN Virtuemart Title Fix */
$includeSiteName = (int) JFactory::getApplication()->getCfg('sitename_pagetitles');
if (
$includeSiteName) {
    
$siteName JFactory::getApplication()->getCfg('sitename');
    
$docTitle $document->getTitle();
    switch (
$includeSiteName) {
        case 
1;
            
$document->setTitle($siteName ' - ' $docTitle);
            break;
        case 
2;
            
$document->setTitle($docTitle ' - ' $siteName);
            break;
    }
}
/* END Virtuemart Title Fix */ ?>

Thanks to jjk, p.barg, AH, GJC Web Design and dblaze (in the order of the comments).
Audio Store:
https://vsystem.bg - Bulgarian language
https://vsystem.bg/en - English