Try the Demo

Magento Forum

   
Add SKU to title [SOLVED]
 
jsch
Jr. Member
 
Total Posts:  25
Joined:  2011-08-28
 

Hi,

How can I add the SKU to the title tag when viewing a product?

My title tag looks like this for a product
Domain - productname - subcategory- subcategory- main category

Would like it to be something like this:
Domain - SKU - productname - subcategory- subcategory- main category

 
Magento Community Magento Community
Magento Community
Magento Community
 
Siggi_Schmitz
Guru
 
Avatar
Total Posts:  620
Joined:  2011-07-03
 

Sure,

File:

app/code/core/Mage/Page/Block/Html/Head.php

Change the function setTitle from this:

public function setTitle($title)
    
{
        $this
->_data['title'Mage::getStoreConfig('design/head/title_prefix') . ' ' $title
            
' ' Mage::getStoreConfig('design/head/title_suffix');
        return 
$this;
    
}

to this:

public function setTitle($title)
    
{
        $sku 
'';
        if (
$product Mage::registry('current_product')) {
            $sku 
$product->getSku() . ' - ';
        
}
        $this
->_data['title'$sku Mage::getStoreConfig('design/head/title_prefix') . ' ' $title
            
' ' Mage::getStoreConfig('design/head/title_suffix');
        return 
$this;
    
}

Of course, it`s better to overwrite this function with an own module instead of hacking the core code!

 Signature 

Magento Freelancer.

Need an extension? Feel free to contact me!

Web: http://www.sig-tec.de
E-Mail:
Skype: sig-tec
Xing: https://www.xing.com/profile/Siegfried_Schmitz2
Profil auf freelance.de
Profil auf freelancermap.de

 
Magento Community Magento Community
Magento Community
Magento Community
 
jsch
Jr. Member
 
Total Posts:  25
Joined:  2011-08-28
 

Thanks alot.

I will see if I can figure out how to do this by creating a module.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top