Function $document->setTitle($title) is called from “administrator/components/com_virtuemart/classes/mainframe.class.php”:
function setPageTitle( $title ) { global $mainframe; $title = strip_tags(str_replace(' ',' ', $title)); $title = trim($title); if( defined( '_VM_IS_BACKEND')) { echo vmCommonHTML::scriptTag('', "//<![CDATA[ var vm_page_title=\"".str_replace('"', '\"', $title )."\"; try{ parent.document.title = vm_page_title; } catch(e) { document.title =vm_page_title; } //]]> "); } elseif( vmIsJoomla('1.5') ) { $document=& JFactory::getDocument(); $document->setTitle($title); } else { $mainframe->setPageTitle( $title ); } }
To change product fly-page title we can simply modify $page_title variable used in “administrator/components/com_virtuemart/html/shop.product_details.php”:
// Set Dynamic Page Title if( function_exists('mb_substr')) { $page_title = mb_substr($product_name . " add something here", 0, 64, vmGetCharset() ); } else { $page_title = substr($product_name, 0, 64 ); } $vm_mainframe->setPageTitle( @html_entity_decode( $page_title, ENT_QUOTES, vmGetCharset() ));
Personally, I did the following changes:
//$page_title = $product_name; require_once (JPATH_LIBRARIES.DS.'user'.DS.'product_parser.php'); $page_title = GetProductTitle($product_id); //}dmitriano // Set Dynamic Page Title if( function_exists('mb_substr')) { $page_title = mb_substr($page_title, 0, 64, vmGetCharset() ); } else { $page_title = substr($page_title, 0, 64 ); } $vm_mainframe->setPageTitle( @html_entity_decode( $page_title, ENT_QUOTES, vmGetCharset() ));
where GetProductTitle($product_id) is some function that returns specific product title by given $product_id.
Also I think that the size of 64 symbols is too small for page title, I decided to increase it to 128:
if( function_exists('mb_substr')) { $page_title = mb_substr($page_title, 0, 128, vmGetCharset() ); } else { $page_title = substr($page_title, 0, 128 );
Thank you very much!!!!