Is there a hack or fix for including site name in page titles?
Joomla 2.5 has a new global setting for "Include Site Name in Page Titles". Can be set to Before or After or No. This doesn't work in VM2.0.12b.
e.g. When viewing category page instead of just showing category name on page title: "Furniture" would like it to be "Furniture - Hacienda Crafts Co."
It doesn't work in VirtueMart version 2.0.12f either.
Joomla 2.5.7
hi, for VM 2.0.14:)
FOR CATEGORY:
\components\com_virtuemart\views\category\view.html.php (LINE 188)
REPLACE:
$document->setTitle( $title );
WITH:
$document->setTitle(JFactory::getApplication()->getCfg('sitename').' -> '.$title);
FOR PRODUCTS:
\components\com_virtuemart\views\productdetails\view.html.php (LINE 213)
REPLACE:
$document->setTitle( strip_tags(($category->category_name?($category->category_name.' - '):'').$product->product_name));
WITH:
$document->setTitle(JFactory::getApplication()->getCfg('sitename').' -> '.strip_tags(($category->category_name ? ($category->category_name . ' -> '): '') . $product->product_name));
if you want to do it without hack, edit:
Category->Product Category Form->Meta Information->Custom Page Title
Product->Product Description->Meta Information->Custom Page Title
Or more fancyer way, u mkae template overrides and include all options.... just put this in every default.php template ur using (category, productdetails, etc.)
/* BEGIN Virtuemart Title Fix */
$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;
}
}
/* END Virtuemart Title Fix */
hi dblaze, works for me,
thank you very much for sharing this, really helpfull!!! 8)