Making another Navbar for Header

Open to all! Ask other shopowners for help.
User avatar
tessthepup
Certified Developer
Posts: 382
Joined: Mon Mar 01, 2021 5:55 pm
Phoenix Version:
Has thanked: 47 times
Been thanked: 62 times

Re: Making another Navbar for Header

Post by tessthepup »

Kofod95 wrote: Fri Dec 31, 2021 12:00 pm
tessthepup wrote: Fri Dec 31, 2021 9:21 am already tried that
It is better that it shows nothing than it shows something wrong. As far as I remember, the modules are called from table.configuration, with a key that is similar to MODULES_NAVBAR_INSTALLED - Do you have a new one like this for your new navbar_header-modules?

//Daniel
Yes
You do not have the required permissions to view the files attached to this post.


Join The Code Co-op to get access to your library in the Code Co-op Forum
User avatar
tessthepup
Certified Developer
Posts: 382
Joined: Mon Mar 01, 2021 5:55 pm
Phoenix Version:
Has thanked: 47 times
Been thanked: 62 times

Re: Making another Navbar for Header

Post by tessthepup »

ok I managed to solve the problem with navbar items duplicating in the new navbar

Whether this way is the correct way I am not sure, maybe one of the experts could confirm yes or no?

I copied an renamed includes/system/versioned/1.0.5.1/abstract_block_module.php to abstract_block_module_navbar.php

and changed the contents as follows:

Code: Select all

  abstract class abstract_block_module_navbar extends abstract_module {

    protected $group;
    protected $mr_auto;

    function __construct() {
      parent::__construct();

      if ( defined(static::CONFIG_KEY_BASE . 'STATUS') ) {
        switch (constant(static::CONFIG_KEY_BASE . 'CONTENT_PLACEMENT')) {
          case 'Home':
            $this->group = 'navbar_header_modules_home';
            break;
          case 'Left':
            $this->group = 'navbar_header_modules_left';
            break;
          case 'Center':
            $this->group = 'navbar_header_modules_center';
            break;
          case 'Right':
            $this->group = 'navbar_header_modules_right';
            break;
        }
      }
    }

    public function get_group() {
      return $this->group;
    }

  }
The only issue I have now is the the hamburger menu controls both navbars. I tried to change the id but not sure if/where else to change :?
User avatar
Kofod95
Senior Contributor
Posts: 748
Joined: Sat Feb 06, 2021 7:38 pm
Phoenix Version: 1.0.8.20
Has thanked: 99 times
Been thanked: 179 times

Re: Making another Navbar for Header

Post by Kofod95 »

tessthepup wrote: Sat Jan 01, 2022 4:27 pm ok I managed to solve the problem with navbar items duplicating in the new navbar
Well done! Sorry for not getting back to you, I had the topic bookmarked for when I had a little more time to look at it. Never got to do that, as you solved it yourself!
I *think* you have done it "the right way" - it works and you accomplished what you needed with files completely in your control. Maybe the abstract_block_module could be done in a "righter way", but I'm not sure.
tessthepup wrote: Sat Jan 01, 2022 4:27 pm The only issue I have now is the the hamburger menu controls both navbars. I tried to change the id but not sure if/where else to change :?
If I remember it right, there is the id in the Hamburger-menu-module and in the template-file for the navigation-module. I guess you have those two already?

//Daniel
I'm not smart, but sometimes even a blind chicken can find a corn.
Here are a lot of corns: Phoenix user guide
User avatar
tessthepup
Certified Developer
Posts: 382
Joined: Mon Mar 01, 2021 5:55 pm
Phoenix Version:
Has thanked: 47 times
Been thanked: 62 times

Re: Making another Navbar for Header

Post by tessthepup »

Kofod95 wrote: Sat Jan 01, 2022 5:24 pm
tessthepup wrote: Sat Jan 01, 2022 4:27 pm ok I managed to solve the problem with navbar items duplicating in the new navbar
Well done! Sorry for not getting back to you, I had the topic bookmarked for when I had a little more time to look at it. Never got to do that, as you solved it yourself!
I *think* you have done it "the right way" - it works and you accomplished what you needed with files completely in your control. Maybe the abstract_block_module could be done in a "righter way", but I'm not sure.
tessthepup wrote: Sat Jan 01, 2022 4:27 pm The only issue I have now is the the hamburger menu controls both navbars. I tried to change the id but not sure if/where else to change :?
If I remember it right, there is the id in the Hamburger-menu-module and in the template-file for the navigation-module. I guess you have those two already?

//Daniel
Thanks Daniel, time to copy the hamburger-menu-module although I wonder if there is a better way as having 2 hamburger menu's seems a bit daft
User avatar
Kofod95
Senior Contributor
Posts: 748
Joined: Sat Feb 06, 2021 7:38 pm
Phoenix Version: 1.0.8.20
Has thanked: 99 times
Been thanked: 179 times

Re: Making another Navbar for Header

Post by Kofod95 »

tessthepup wrote: Sat Jan 01, 2022 5:49 pm I wonder if there is a better way as having 2 hamburger menu's seems a bit daft
If you prefer your new navbar not to collapse, that could be done simply by removing this line from your new Header-modules' template file:

Code: Select all

    <div class="collapse navbar-collapse" id="collapseCoreNav">
along with its' closing </div>.
You could also just set the 'Collapse'-setting to 'navbar-expand' on which ever of the two you don't want to collapse. Be aware of the look on small screens though!

//Daniel
I'm not smart, but sometimes even a blind chicken can find a corn.
Here are a lot of corns: Phoenix user guide
User avatar
tessthepup
Certified Developer
Posts: 382
Joined: Mon Mar 01, 2021 5:55 pm
Phoenix Version:
Has thanked: 47 times
Been thanked: 62 times

Re: Making another Navbar for Header

Post by tessthepup »

Kofod95 wrote: Sat Jan 01, 2022 5:56 pm
tessthepup wrote: Sat Jan 01, 2022 5:49 pm I wonder if there is a better way as having 2 hamburger menu's seems a bit daft
If you prefer your new navbar not to collapse, that could be done simply by removing this line from your new Header-modules' template file:

Code: Select all

    <div class="collapse navbar-collapse" id="collapseCoreNav">
along with its' closing </div>.
You could also just set the 'Collapse'-setting to 'navbar-expand' on which ever of the two you don't want to collapse. Be aware of the look on small screens though!

//Daniel
I will have to have a ponder on the best way of doing it
User avatar
Kofod95
Senior Contributor
Posts: 748
Joined: Sat Feb 06, 2021 7:38 pm
Phoenix Version: 1.0.8.20
Has thanked: 99 times
Been thanked: 179 times

Re: Making another Navbar for Header

Post by Kofod95 »

tessthepup wrote: Sat Jan 01, 2022 6:04 pm I will have to have a ponder on the best way of doing it
Enjoy ;)

I just remembered something that might have saved you all the work:
The Menu Master addon which even has a lite version. Sorry for having forgot about that!

//Daniel
I'm not smart, but sometimes even a blind chicken can find a corn.
Here are a lot of corns: Phoenix user guide
User avatar
tessthepup
Certified Developer
Posts: 382
Joined: Mon Mar 01, 2021 5:55 pm
Phoenix Version:
Has thanked: 47 times
Been thanked: 62 times

Re: Making another Navbar for Header

Post by tessthepup »

Kofod95 wrote: Sat Jan 01, 2022 6:16 pm
tessthepup wrote: Sat Jan 01, 2022 6:04 pm I will have to have a ponder on the best way of doing it
Enjoy ;)

I just remembered something that might have saved you all the work:
The Menu Master addon which even has a lite version. Sorry for having forgot about that!

//Daniel
I did initially look at that but you dont learn if you dont do :ugeek:


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