I have 2 custom attributes I\'d like to add to the
tags on product pages. They are \'brand\' and \'subtitle\'.
My page title would end up
this is addition to Drew Hunter's answer
magento includes category name into title so the proper solution would be:
class Yourcompany_Yourmodule_Model_Observer
{
/**
* Change product meta title on product view
*
* @pram Varien_Event_Observer $observer
* @return Yourcompany_Yourmodule_Model_Observer
*/
public function catalog_controller_product_view(Varien_Event_Observer $observer)
{
if ($product = $observer->getEvent()->getProduct()) {
if ($category) {
$title = $brand . ' ' . $product->getData('name') . ' - ' . $product->getData('category')->getData('name');
} else {
$title = $brand . ' ' . $product->getData('name');
}
$product->setMetaTitle($title);
}
return $this;
}
}