Page 1 of 2 12 LastLast
Results 1 to 10 of 13
  1. #1
    Join Date
    May 2006
    Location
    Pacific Northwest (Canada Jr.)
    Posts
    25
    Plugin Contributions
    0

    Removing the "Home" link from breadcrumbs

    Hi again! I've previously posted as "Audra" but I lost access to my account with the board switch.

    Anyway- I'm happily working my way through installing and customizing the new version of Zen Cart. Everything is going great! I'm excited to have such possibilities at hand.

    I've been able to find a few of the issues I've had in new posts but haven't found an answer to this one yet! I found a few close ones in the archived messages, but not exactly what I'm looking for.

    I'd like to remove just the "Home" and its following separator from the breadcrumbs. I attempted this by leaving the "Home" in english.php blank, but then I lose the "Home" link in the navigation bar. I want to keep the Nav Bar one.

    Then I tried commenting out the home link in the breadcrumbs.php file

    Code:
    if ($this->_trail[$i]['title'] == HEADER_TITLE_CATALOG) {
    		$trail_string .= '  <a href="' . HTTP_SERVER . DIR_WS_CATALOG . '">' . $this->_trail[$i]['title'] . '</a>';
            } else {
    		$trail_string .= '  <a href="' . $this->_trail[$i]['link'] . '">' . $this->_trail[$i]['title'] . '</a>';
            }
          } else {
            $trail_string .= $this->_trail[$i]['title'];
          }
    
          if (($i+1) < $n) $trail_string .= $separator;
          $trail_string .= "\n";
        }
    and I get this error:
    Parse error: syntax error, unexpected T_ELSE in /home/.../includes/classes/breadcrumb.php on line 59

    I'd just like to lose the home link in breadcrumbs. I don't want to disable breadcrumbs altogether. Any ideas where to do this? Please don't tell me it's in admin and I'm just missing it!

  2. #2
    Join Date
    May 2006
    Location
    Pacific Northwest (Canada Jr.)
    Posts
    25
    Plugin Contributions
    0

    Default Re: Removing the "Home" link from breadcrumbs

    Just checking in to see if there's an answer for this yet?

  3. #3
    Join Date
    May 2006
    Posts
    14
    Plugin Contributions
    0

    Idea or Suggestion Re: Removing the "Home" link from breadcrumbs

    This was easy enough for me to figure out, as I had just been looking at the file in question for a different purpose.

    All you have to do is add the following code:


    if ($this->_trail[$i]['title'] == 'Home')
    {
    continue;
    }
    prior to:

    if (isset($this->_trail[$i]['link']) && zen_not_null($this->_trail[$i]['link']) && !$skip_link ) {

  4. #4

    Default Re: Removing the "Home" link from breadcrumbs

    Yep, works like a charm!

  5. #5
    Join Date
    Nov 2005
    Location
    Colorado Springs, CO USA
    Posts
    7,039
    Plugin Contributions
    31

    Default Re: Removing the "Home" link from breadcrumbs

    or you could do it in includes -> templates -> YOURTEMPLATE -> common -> tpl_main_page.php and not play around with the Core Code

    just add
    Code:
    <!-- bof  breadcrumb -->
    <?php if (DEFINE_BREADCRUMB_STATUS == '1' && ($current_page!='index' || (int)$cPath>0 )) { ?>    <div id="navBreadCrumb"><?php echo $breadcrumb->trail(BREAD_CRUMBS_SEPARATOR); ?></div>
    <?php } ?>
    <!-- eof breadcrumb -->

  6. #6
    Join Date
    May 2006
    Posts
    14
    Plugin Contributions
    0

    Re: Removing the "Home" link from breadcrumbs

    Quote Originally Posted by clydejones
    or you could do it in includes -> templates -> YOURTEMPLATE -> common -> tpl_main_page.php and not play around with the Core Code

    just add
    Code:
    <!-- bof  breadcrumb -->
    <?php if (DEFINE_BREADCRUMB_STATUS == '1' && ($current_page!='index' || (int)$cPath>0 )) { ?>    <div id="navBreadCrumb"><?php echo $breadcrumb->trail(BREAD_CRUMBS_SEPARATOR); ?></div>
    <?php } ?>
    <!-- eof breadcrumb -->
    While I am all for not modifying core files.... This recommendation doesn't do what is being asked. Your code removes the breadcrumbs completely under certain conditions.

  7. #7
    Join Date
    May 2006
    Location
    Pacific Northwest (Canada Jr.)
    Posts
    25
    Plugin Contributions
    0

    Default Re: Removing the "Home" link from breadcrumbs

    Thank you! It worked perfectly! Exactly what I needed. :)

    I really appreciate your help!

    ETA: I also try not to edit core when and where I can avoid it, but I clicked through every Admin option I could think of, and didn't see any easy way in the template overrides system to do this.
    Last edited by cupcake; 21 May 2006 at 04:49 PM.

  8. #8
    Join Date
    Jan 2004
    Posts
    58,261
    Blog Entries
    3
    Plugin Contributions
    106

    Default Re: Removing the "Home" link from breadcrumbs

    The "right" way to remove just the "Home" link from the breadcrumbs is this:

    1. copy /includes/init_includes/init_add_crumbs.php to the includes/init_includes/overrides folder.

    2. Edit includes/init_includes/overrides/init_add_crumbs.php
    You simply need to comment-out line 15, like this:
    PHP Code:
    //$breadcrumb->add(HEADER_TITLE_CATALOG, zen_href_link(FILENAME_DEFAULT)); 
    ... and of course upload the new file to your site.

    Thus no need to hack core files !
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donations always welcome: www.zen-cart.com/donate

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  9. #9
    Join Date
    Sep 2005
    Posts
    445
    Plugin Contributions
    0

    Default Re: Removing the "Home" link from breadcrumbs

    Still a good answer this "overrides" version. Thanks a lot!
    I may be blond but at least I found Zen.

  10. #10
    Join Date
    Sep 2007
    Posts
    168
    Plugin Contributions
    1

    Default Re: Removing the "Home" link from breadcrumbs

    DrByte = clean answer!

    I didn't feel too save not using the override system, thanks for the answer, worked perfectly!

 

 
Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •