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

VM seems to ignore the Joomla setting 'jform_sitename_pagetitles'

Started by gba, October 11, 2017, 16:38:53 PM

Previous topic - Next topic

gba

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

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

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

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:
$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

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

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

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

Quote from: gba on October 12, 2017, 08:33:38 AM
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

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

You can do all of this using an override in the product template

//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 4.4.5
php 8.1

Ventsi Genchev

#10
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:
$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

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:
$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

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

AH

Venci

As I said :-
QuoteYou can modify to fit your requirements

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

Joomla 4.4.5
php 8.1

Ventsi Genchev

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:
<?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