如何在Magento的元描述中附加sku?

我想使用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"/>


拉风的咖菲猫
浏览 79回答 1
1回答

千万里不及你

经过大量深入研究,我找到了解决方案,并且工作正常。<?php&nbsp;//set empty title$title = '';&nbsp;if ($_product = Mage::registry('current_product'))&nbsp;{&nbsp;$title = $_product->getName();$sku = $_product->getSku();$pos = stripos($title, $sku);if($pos === false ){//no sku already - append now$title.= ' - ' . $sku;}}else{&nbsp;$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"/>
打开App,查看更多内容
随时随地看视频慕课网APP