Reputation: 124
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.
Upvotes: 0
Views: 931
Reputation: 1283
Try this may be help someone else.
<?php $_helper = $this->helper('catalog/output');?>
<?php $_category_detail=Mage::registry('current_category');?>
<?php $_category_detail->getName();?>
<?php $_category_detail->getId(); ?>
Upvotes: 1
Reputation: 2233
You can get the category data from your product object: $_product->getCategory()->getName();
. You will have to edit the template at template/catalog/product/view.phtml
. In the template file look for <div class="product-img-box">
and add:
<div class="product-img-box">
<h4><?php echo $_product->getCategory()->getName(); ?></h4>
<?php echo $this->getChildHtml('media') ?>
</div>
Upvotes: 0