News:

Support the VirtueMart project and become a member

Main Menu

Meta title control ":"

Started by itaym, November 06, 2012, 12:36:32 PM

Previous topic - Next topic

itaym

Hello,
I use VM and SH404SEF.
I have problem with the meta titles VM create.
The problem is that VM put ":" between the category name and product name.
My SEO company doesn't want it!!

I found where i can change it /components/com_virtuemart/views/productdetails/view.html.php BUT I don't want to change the core files.
There is any way to override the file just like the files inside the tmpl folder?

Milbo

I think you mean this line right?
$document->setTitle(strip_tags(($category->category_name ? ($category->category_name . ' : ') : '') . $product->product_name));

It is quite clear that it should be overridable. And hardcoded colons are breaking the used pattern. Maybe with a JText::sprintf construction?
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Nepol

Quote from: Milbo on November 27, 2012, 10:04:25 AM
I think you mean this line right?
$document->setTitle(strip_tags(($category->category_name ? ($category->category_name . ' : ') : '') . $product->product_name));

It is quite clear that it should be overridable. And hardcoded colons are breaking the used pattern. Maybe with a JText::sprintf construction?

Hi Milbo,

I also want to edit this without hacking the core files, I tried overriding by copying the file in /templates/mytemplate/html/com_virtuemart/productdetails/view.html.php with no luck.

What am I doing wrong? Thanks!

jjk

#3
For the file ...\components\com_virtuemart\views\productdetails\view.html.php a normal template override doesn't work.

Explanation by E. Stranz:
In order to override it, you would have to register the class of the view.html.php file after it gets registered automatically by joomla.

Therefore you need a system plugin and the following code line in the "onAfterInitialise" Event
JLoader::register('Class Name', PATH THE NEW VIEW.HTML.PHP FILE, true);

This way you just tell joomla where to find that class instead of the source which joomla automaticlly checks because of it's pattern.
Of course it's not that comfortable like adding a file to a specific folder like you know from template overrides.


There is an explanation in the Joomla documentation available here: http://docs.joomla.org/How_to_override_the_component_mvc_from_the_Joomla!_core



Note, for the search engines like Google it doesn't matter which separator you use. If you would use for example a '|' instead of ':', it has absolutely no effect on your SEO!. The only separator which doesn't work is the underscore.

However, personally I'm using a modified 'view.html' myself. And because it's easier to do than what I described above, I just commented out the original line:
$document->setTitle(strip_tags(($category->category_name ? ($category->category_name . ' : ') : '') . $product->product_name));
and added my modified one directly below. And because I tend to forget what I have changed after a while, I have an unpublished Joomla article, into which I document all my 'hacks' and overrides.

If you just want to change a few titles, you can also use the 'Custom Page Title' field available in every VM product edit view and category edit view.



Just for clarifcation - a 'Title' tag and a 'Meta Title Tag' are not the same.

The Title Tag is expressed as:
<TITLE>Page Title Here</TITLE>
VM2 does that automatically for you. This is the important one for the search engines and for building the SEF url.

The Meta Title Tag is written as:
<META NAME="Title" CONTENT="Page Title Here">
VM2 does not generate that, but it is absolutely dispensable. Google ignores the 'Meta Title Tag' anyway.
See here: ("Google understands the following meta tags:")
http://support.google.com/webmasters/bin/answer.py?hl=en&answer=79812
Non-English Shops: Are your language files up to date?
http://virtuemart.net/community/translations

Nepol

Thank you JJK,

I was using the MVC override plugin for files such as

administrator/components/com_virtuemart/helpers/currencydisplay.php
administrator/components/com_virtuemart/helpers/vmmodel.php
administrator/components/com_virtuemart/models/product.php

But it didn't behave correctly with VM extentions... I read a lot about the plugin and how to make it work but still.

Anyways thank you very much, I'll see what I can do and thanks again for the detailed explanation.