Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Back to category
 
WeeJames
Jr. Member
 
Total Posts:  12
Joined:  2008-03-27
 

On my product pages i’d like to include a ‘back to category’ link that will take users to the category containing the product theyve just gone to.

Is there a simple way to achieve this?

Cheers

James

 
Magento Community Magento Community
Magento Community
Magento Community
 
glaDiator
Member
 
Avatar
Total Posts:  65
Joined:  2008-03-17
 

sure ... here is the simplest way..........

<?php         
    
if ($category Mage::registry('current_category')) {
            
echo $category->getUrl();
        
}
?>
 
Magento Community Magento Community
Magento Community
Magento Community
 
glaDiator
Member
 
Avatar
Total Posts:  65
Joined:  2008-03-17
 

uhh........ if u don’t like the checking then it is rather simple for u ..............

<?php
Mage
::registry('current_category')->getUrl();
?>

Enjoy......... wink

 
Magento Community Magento Community
Magento Community
Magento Community
 
saliko
Jr. Member
 
Total Posts:  1
Joined:  2012-02-03
 

The above work fine but i get only a nonclicable url. How to convert that to custom text mean like this:
<a href=\"http://www.magentocommerce.com/boards/newreply/6370/\" title=\"View Category\">View Category</a>

I know that is a little bit old topic but i searched for hours on this and i can`t find solution for this simple task.

Thank you

 
Magento Community Magento Community
Magento Community
Magento Community
 
Amasty
Mentor
 
Avatar
Total Posts:  3988
Joined:  2009-11-10
 

You can try our Previous-Next Navigation extension. In addition to the “Back to Category” link the extension adds previous/next navigation between products in category (or in search results). Some additional features like preview thumbnails, images for navigation controls are also available!

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top