News:

Support the VirtueMart project and become a member

Main Menu

Include Site Name in Page Titles

Started by leFlea, October 14, 2012, 15:55:46 PM

Previous topic - Next topic

leFlea

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."

cmb

It doesn't work in VirtueMart version 2.0.12f either.
Joomla 2.5.7
Charles

CE WebDesign München

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
CE WebDesign München: https://ce-webdesign.de | Websites, eCommerce WebShops | Responsive Design | SEO

dblaze

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 */
2b || !2b; this.question();
http://www.dblaze.eu

CE WebDesign München

hi dblaze, works for me,
thank you very much for sharing this, really helpfull!!!   8)
CE WebDesign München: https://ce-webdesign.de | Websites, eCommerce WebShops | Responsive Design | SEO