Posted By

nico65 on 04/27/11


Tagged

button back magento


Versions (?)

Magento get parent category


 / Published in: PHP
 

works in produktdetail magento 1.4.2 & 1.5.0.1

  1. <div class="backtocat">
  2. <?php
  3. if ($this->getProduct()->getCategory() != NULL) {
  4. $cat = $this->getProduct()->getCategory();
  5. $parent_cat = $cat->getName();
  6. $cat_url = $cat->getUrl()
  7. ?>
  8.  
  9. <a href="javascript:history.go(-1)" title="<?php echo $parent_cat;?>"><?php echo $this->__('back to category');?> <?php echo $parent_cat;?></a>
  10. <?php } else { ?>
  11.  
  12. <a href="javascript:history.go(-1)" title="back"><?php echo $this->__('Back');?></a>
  13. <?php } ?>
  14.  
  15. </div>

Report this snippet  

You need to login to post a comment.