Hide Breadcrumb on index.php

Open to all! Ask other shopowners for help.
Post Reply
heatherbell
Senior Contributor
Posts: 2540
Joined: Mon Oct 07, 2019 4:39 am
Phoenix Version:
Has thanked: 35 times
Been thanked: 243 times

Hide Breadcrumb on index.php

Post by heatherbell »

Hide Breadcrumb on index.php only.
What's the best/easiest way to do this?
I modified core file cm_header_breadcrumb.php by adding

Code: Select all

if(basename($PHP_SELF) == 'index.php' && $cPath == '' && !isset($_GET['manufacturers_id'])) {
        echo '';
      }else{
This worked so I copied that file to /templates/override/modules/content/header/ which I expected to work but does not - have I done something wrong here?
Must I create a new module to do this or could/should this be done with a hook? If so, how?
Any pointers appreciated.


Join The Code Co-op to get access to your library in the Code Co-op Forum
ecartz
Core Team
Posts: 3084
Joined: Tue Nov 05, 2019 6:02 pm
Phoenix Version:
Has thanked: 4 times
Been thanked: 208 times

Re: Hide Breadcrumb on index.php

Post by ecartz »

heatherbell wrote: Tue Oct 12, 2021 9:56 am I expected to work but does not
"[D]oes not" could mean a variety of things.

1. It still displays on the index page.
2. It does not display on the index_nested and index_products page.
3. It does not display on any pages.
4. The site breaks and shows a white screen or error message.

In the file https://github.com/CE-PhoenixCart/Phoen ... dcrumb.php

If you copy to /templates/override/modules/content/header/ and add at the beginning

Code: Select all

<?php
if (basename(Request::get_page()) === 'index.php' && empty($GLOBALS['cPath']) && empty($_GET['manufacturers_id'])) {
  return;
}
?>
does that do what you want? Not display on the welcome page but do display on the category and product listings?

If not, are you on a site where the template is set (in admin) to override and not default?
heatherbell
Senior Contributor
Posts: 2540
Joined: Mon Oct 07, 2019 4:39 am
Phoenix Version:
Has thanked: 35 times
Been thanked: 243 times

Re: Hide Breadcrumb on index.php

Post by heatherbell »

ecartz wrote: Tue Oct 12, 2021 10:55 amdoes that do what you want?
That does exactly what I want. Many thanks for taking the time.


Join The Code Co-op to get access to your library in the Code Co-op Forum
Post Reply