Magento产品查看页修改页面标题

作者:Jeen 发布于:2013-4-21 18:39 Sunday 分类:工作笔记

这边以在产品查看页修改标题   添加价格为例

修改文件 app\code\core\Mage\Catalog\Block\Product\View.php

找到 _prepareLayout() 函数

修改代码如下

//if ($title) {
//    $headBlock->setTitle($title);
//}
$s_price = $product->getPrice();
if(!$title) $title = $headBlock->getTitle();
if($s_price) {
$s_price = strip_tags(Mage::app()->getStore()->formatPrice($s_price));
$title .= ‘ -  Price ‘.$s_price;
}
$headBlock->setTitle($title);

测试版本 Magento 1.5.0.1  1.6.1.0,至于个中需求,可参考自行调整 :-)

标签: magento

发表评论:

©2010-2024 Jeen All Rights Reserved.Powered by emlog 京ICP备15058100号-1