0

When a user is checking the product page, the breadcrumb trail should give Home > Shop > Category > Product aka Home > Shop > Hats > A Hat

I used Crumbs, but it only gives me Home > Hats > A Hat and I cannot figure out how to include > Shop >.

Well obviously at the same time the breadcrumbs should also work fine in the rest of the pages like for contacts page it would be Home > Contacts

What would you recommend? What module? Or is it still possible with Crumbs and I am missing something?

  • The maintainer of Crumbs is usually quite open to support issues .. :) – donquixote Mar 24 '14 at 14:07
  • The way Crumbs works, what you want to do is to specify "Shop" as a parent path for "Hats". If "Hats" is a taxonomy term, you can do that under Structure > Crumbs > Entity parent > Taxonomy. – donquixote Mar 24 '14 at 14:09
  • Sorry donquixote, I solved this problem with Custom Breadcrumbs already. – Optimus Prime Mar 24 '14 at 17:07
3

You can add breadcrumbs in your page using drupal_get_breadcrumb and drupal_set_breadcrumb function

In template.php

 function THEMENAME_preprocess_page(&$variables, $hook) {

        if(arg(0)=='shoppage'){  //Put appropriate condition 
            $breadcrumb = drupal_get_breadcrumb();
            $breadcrumb[1] = l('Shop', 'shop_link');
            $breadcrumb[2] = l('Category', 'category_link');
            drupal_set_breadcrumb($breadcrumb);
        }
    }
  • So there's no module solution for that? If I implement this, will the rest for non shop pages work fine? Like Home > Contacts and etc. – Optimus Prime Mar 24 '14 at 11:51
  • Is you are writing separate function for shop pages OR have you created any template for shop pages? – Reshma Mar 24 '14 at 12:20
  • You can write above code in your shop template file or you can write in template.php file by checking arguments for that particular pages – Reshma Mar 24 '14 at 12:23
  • I'm not writing no functions and no custom templates. – Optimus Prime Mar 24 '14 at 12:27
  • I have updated code please check – Reshma Mar 24 '14 at 12:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.