How to get only the TAGS of a PRODUCT in view.phtm

2019-08-25 04:32发布

问题:

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>


标签: php magento tags