Jump to content

Changing Category Pricelist pages to another endpoint?


Lex3891

Recommended Posts

As title. I've currently managed to change the Store menu links with the following. I'm trying make the category pages direct to an external as well, but struggling to find anything on a search or through playing about. 

Anyone know of anything I can add to this to make it change them as well? Many advanced thanks. 🙂 

 

add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar)
{
    $navItem = $primaryNavbar->getChild('Home');
    if (is_null($navItem)) {
        return;
    }
    $navItem->setUri('/billing/clientarea.php');
    $navItem->setlabel('My Account');
    $navItem->setIcon('far fa-user');
    
    $navItem1 = $primaryNavbar->getChild('Store');
    if (is_null($navItem1)) {
        return;
    }
    $navItem1 = $navItem1->getChild('Web Builder Hosting');
    if (is_null($navItem1)) {
        return;
    }
    $navItem1->setUri('/web-builder-hosting');
  
    $navItem2 = $primaryNavbar->getChild('Store');
    if (is_null($navItem1)) {
        return;
    }
    $navItem2 = $navItem2->getChild('Linux Hosting');
    if (is_null($navItem2)) {
        return;
    }
    $navItem2->setUri('/linux-hosting');
    
    if (!is_null($primaryNavbar->getChild('Store'))) {
    $primaryNavbar->getChild('Store')->removeChild('Browse Products Services');
    }

});

 

Link to comment
Share on other sites

22 hours ago, Lex3891 said:

As title. I've currently managed to change the Store menu links with the following.

a slightly unusual way to have done it - i'd have taken the following route...

you could even use it to add icons to those links too.

btw - I doubt you would need the path /billing/ in that replacement home URL.

22 hours ago, Lex3891 said:

I'm trying make the category pages direct to an external as well, but struggling to find anything on a search or through playing about. 

to be honest, you could just duplicate the hook from the above thread, change "ClientAreaPrimaryNavbar" to "ClientAreaSecondarySidebar", replace references of $primarynavbar with $secondarysidebar, change 'Store' to 'Categories' and it would work on the sidebar too. 🙂

although if you only have two links to change in your sidebar, then that hook might be overkill and you could easily just write a hook to replace those two non-MC group links.

LYaJqwm.png

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated