Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8576901
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T20:02:08+00:00 2026-06-11T20:02:08+00:00

In Magento, when the user directly accesses the product page, such as from Google,

  • 0

In Magento, when the user directly accesses the product page, such as from Google, the breadcrumbs would only be “Home” -> “Product Name”.

How can I add categories in there even when users access the page directly from Google?

For example, on this page, I want to add the categories “Wedding Apparel” and “Wedding Dresses” in the breadcrumbs. I came up with an idea other than hard editing breadcrumbs.phtml but is there any way I can programmatically add a breadcrumbs item in template/catalog/product/view.phtml ?

I can get the categories (title and link) of the current product and then use some function / method to add them in the breadcrumbs dynamically and programmatically. Is this possible?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T20:02:09+00:00Added an answer on June 11, 2026 at 8:02 pm

    Here’s the code that forces Magento to display the complete breadcrumb, including categories by looping trough each category for the current product:

    © Danny Vince

    <?php
    if ($product = Mage::registry('current_product')) {
        $categories = $product->getCategoryCollection()->load();
    
        if($categories) {
            foreach ($categories as $category)
            {
                if($category) {
                $category = Mage::getModel('catalog/category')->load($category->getId());
                break;
                }
            }
        }
        $lastCrumbName = $product->getName();
        $lastCategoryAdjust = 0;
    }
    else {
        if($category = Mage::registry('current_category')) {
        $lastCrumbName = $category->getName();
        }
        $lastCategoryAdjust = 1;
    }
    
    if($category) {
        if($path = $category->getPath()) {
            $path = explode('/', $path);
            $crumbs = array('home' => array('label' => 'Home',
            'title' => 'Home',
            'link' => Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB),
            'first' => true,
            'last' => false
            ));
            for($i = 2; $i < count($path) - $lastCategoryAdjust; $i++) {
                $cur_category = Mage::getModel('catalog/category')->load($path[$i]);
                if($cur_category && $cur_category->getIsActive()) {
                    $crumbs['category' . $path[$i]] = array('label' => $cur_category->getName(),
                    'title' => $cur_category->getName(),
                    'link' => $cur_category->getUrl(),
                    'first' => false,
                    'last' => false
                    );
                }
            }
            $crumbs['current'] = array('label' => $lastCrumbName,
            'title' => '',
            'link' => '',
            'first' => false,
            'last' => true
            );
        }
    }
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to show some text in Magento only if the user has
Magento Orders->Google Sitemap ... since recently a blank page?!!!! Hi since some weeks our
how can i re-direct to a particular page after the user submits the contact
How can I redirect different user groups to different pages in Magento ? what
Using Magento i want to create website where user can upload their products to
how can I redirect the user to a specific category after adding a product
Magento can add a suffix that is defined by the user to append onto
Understanding Magento Models by reference of SQL: select * from user_devices where user_id =
I am the root user of the system there is a file: D:\XAMPP\htdocs\magento_41\magento\ which
Magento 1.7.0.0 ok i'm using the product tabs that are available in the modern

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.