0

I'm working on a website. Upon clicking the product it shows all the details of it. But my client want me to show parent category of categroy of the product at top, above the image. Please help me about it. I'm a budding developer.

4

2 回答 2

1

试试这个可能会帮助别人。

<?php $_helper = $this->helper('catalog/output');?>
<?php $_category_detail=Mage::registry('current_category');?>
<?php $_category_detail->getName();?>
<?php $_category_detail->getId(); ?>
于 2013-04-17T13:10:20.807 回答
0

您可以从您的产品对象中获取类别数据:$_product->getCategory()->getName();. 您必须在 中编辑模板template/catalog/product/view.phtml。在模板文件中查找 <div class="product-img-box">并添加:

        <div class="product-img-box">
            <h4><?php echo $_product->getCategory()->getName(); ?></h4>
            <?php echo $this->getChildHtml('media') ?>
        </div>
于 2013-02-12T12:39:59.787 回答