How to get only the TAGS of a PRODUCT in view.phtml in Magento 1.7.0.2?

徘徊边缘 提交于 2019-12-25 05:27:07

问题


I need to get only the TAGS of the product that I am viewing in the product page meaning view.phtml

If I use this command

<?php echo $this->getChildHtml('product_additional_data') ?>

I get NOT only the tags but the whole information related of the product.

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?


回答1:


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>


来源:https://stackoverflow.com/questions/18742046/how-to-get-only-the-tags-of-a-product-in-view-phtml-in-magento-1-7-0-2

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!