如何在 Magento 的产品标题中附加 sku。?

How to append sku in product title in Magento.?

我想使用 php 代码在 Magento 的产品标题中附加 sku。谁能帮我解决这个问题。

<?php 
//set empty title
$title = ''; 
if ($_product = Mage::registry('current_product')) 
{ 
$title = $_product->getName();
$pos = stripos($title);
$title = $this->getTitle();
}
?>
<title><?php echo $title; ?> | test</title>

这是上述问题的工作代码。

<?php 
//set empty title
$title = ''; 
if ($_product = Mage::registry('current_product')) 
{ 
$title = $_product->getName();
$sku = $_product->getSku();
$pos = stripos($title, $sku);
if($pos === false )
{
//no sku already - append now
$title.= ' - ' . $sku;
}
}
else
{ 
$title = $this->getTitle();
}
?>
<title><?php echo $title; ?> | test</title>