Return to Snippet

Revision: 45235
at May 11, 2011 19:39 by nico65


Updated Code
<div class="backtocat">
    <?php
    if ($this->getProduct()->getCategory() != NULL) {
    $cat         = $this->getProduct()->getCategory();
    $parent_cat  = $cat->getName();
    $cat_url    = $cat->getUrl()
    ?>
                     
    <a href="javascript:history.go(-1)" title="<?php echo $parent_cat;?>"><?php echo $this->__('back to category');?> <?php echo $parent_cat;?></a>
 	<?php } else { ?>

    <a href="javascript:history.go(-1)" title="back"><?php echo $this->__('Back');?></a>
    <?php } ?>
                        
</div>

Revision: 45234
at April 27, 2011 20:06 by nico65


Initial Code
<div class="backtocat">
<?php
$categorypath = Mage::registry('current_category')->getUrl();
$categoryname = Mage::registry('current_category')->getName();
?>

<a href="<?php echo $categorypath;?>" title="<?php echo $categoryname;?>"><?php echo $this->__('back to category');?> <?php echo $categoryname;?></a>




</div>

Initial URL

                                

Initial Description
works in produktdetail magento 1.4.2 & 1.5.0.1

Initial Title
Magento get parent category

Initial Tags
button, magento

Initial Language
PHP