如何在Magento 1.7.0.2的view.phtml中仅获取产品的标签? [英] How to get only the TAGS of a PRODUCT in view.phtml in Magento 1.7.0.2?
本文介绍了如何在Magento 1.7.0.2的view.phtml中仅获取产品的标签?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我只需要仅获得我在产品页面中查看的产品的标记,即view.phtml
I need to get only the TAGS of the product that I am viewing in the product page meaning view.phtml
如果我使用此命令
<?php echo $this->getChildHtml('product_additional_data') ?>
我不仅获得了标签,而且还获得了与产品相关的全部信息.
I get NOT only the tags but the whole information related of the product.
如何将 product_additional_data 破坏为标签,评论等? 与仅获取标签或仅获取评论相关的命令是什么?
How can I break the product_additional_data to tags,reviews etc ??? What are the related commands for getting ONLY the tags or gettings ONLY the reviews?
推荐答案
您好,请在view.phtml中添加以下代码
Hello add below code in view.phtml
<?php
// instantiate the tags class for products
$_tags = new Mage_Tag_Block_Product_List();
?>
<ul class="product-tags">
<?php foreach($_tags->getTags() as $tag):?>
<li><a href="<?php echo $tag->getTaggedProductsUrl()?>"><?php echo $tag->getName()?></a></li>
<?php endforeach;?>
</ul>
这篇关于如何在Magento 1.7.0.2的view.phtml中仅获取产品的标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文