我想使用php代码在Magento的元描述中附加sku。任何人都可以帮我。<?php //set empty title$title = ''; if ($_product = Mage::registry('current_product')) { $title = $_product->getName();$pos = stripos($title);if($pos === false ){$title = $this->getTitle();}?><meta name="description" content="<?php echo $title?>.Wide range of shipping destinations. Call us now for more info about our products: 01202 600596. Contact us to discuss our returns policy"/>
1 回答
千万里不及你
TA贡献1784条经验 获得超9个赞
经过大量深入研究,我找到了解决方案,并且工作正常。
<?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();
}
?>
<meta name="description" content="<?php echo $title?>.Wide range of shipping destinations. Call us now for more info about our products: 01202 600596. Contact us to discuss our returns policy"/>
- 1 回答
- 0 关注
- 78 浏览
添加回答
举报
0/150
提交
取消