问题
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