Jump to content

Include Support SideBar on submitticket.php


Recommended Posts

Dear friends,

I've already tried to include the Support Secondary Sidebar on submitticket.php page, but I was not able.
I can add a custom sidebar, but what I would like is to show the Support default secondary Sidebar.

Any idea if this can be done and how?

Thank you very much.

Best regards,
David Duarte

Link to comment
Share on other sites

Hi David,

17 hours ago, David Duarte said:

I've already tried to include the Support Secondary Sidebar on submitticket.php page, but I was not able.
I can add a custom sidebar, but what I would like is to show the Support default secondary Sidebar.

unless you can do it using Contexts, the easier way might just be to make a custom sidebar - if you're taking about the sidebar below...

hNHANgE.png

the way I would suggest is to write a hook that checks, on the submittickets page, if that support sidebar exists and if so, does nothing...if it doesn't, then you recreate the support sidebar - it's only six links with icons, so there should be plenty of coding examples elsewhere in the community about how to do that... although, all those links will be available in the navbar by default (unless you've modified the navbar).

Link to comment
Share on other sites

Hello Brian,

 

Thank you very much for your help.

With your tips I was able to code what I needed.

Here you have the code, as it can be useful for someone else.

 

<?php

use WHMCS\View\Menu\Item as MenuItem;

add_hook('ClientAreaSecondarySidebar', 1, function(MenuItem $secondarySidebar)
{
    
   if (APP::getCurrentFileName()=="submitticket"){
       
       
       if (!is_null($secondarySidebar->getChild('Support'))) {
           
           
    }else{ $secondarySidebar->addChild('sidebar1', array(
               'label' => Lang::trans('navsupport'),
               'order' => '10',
               'icon' => 'fa-support'
       ));
       $secondarySidebar->getChild('sidebar1')
               ->addChild('child1', array(
               'label' => Lang::trans('clientareanavsupporttickets'),
               'uri' => 'supporttickets.php'
               
       ));   
       $secondarySidebar->getChild('sidebar1')
               ->addChild('child2', array(
               'label' => Lang::trans('announcementstitle'),
               'uri' => 'announcements'
               
       ));   
       $secondarySidebar->getChild('sidebar1')
               ->addChild('child3', array(
               'label' => Lang::trans('knowledgebasetitle'),
               'uri' => 'knowledgebase'
               
       ));  
 
      
        }

           

   }
});

 

Link to comment
Share on other sites

Now with icons :-)

<?php

use WHMCS\View\Menu\Item as MenuItem;

add_hook('ClientAreaSecondarySidebar', 1, function(MenuItem $secondarySidebar)
{
    
   if (APP::getCurrentFileName()=="submitticket"){
       
       
       if (!is_null($secondarySidebar->getChild('Support'))) {
           
           
    }else{ $secondarySidebar->addChild('sidebar1', array(
               'label' => Lang::trans('navsupport'),
               'order' => '10',
               'icon' => 'fa-support',
       ));
       $secondarySidebar->getChild('sidebar1')
               ->addChild('child1', array(
               'label' => Lang::trans('clientareanavsupporttickets'),
               'uri' => 'supporttickets.php',
               'icon' => 'fa-ticket'
               
       ));   
       $secondarySidebar->getChild('sidebar1')
               ->addChild('child2', array(
               'label' => Lang::trans('announcementstitle'),
               'uri' => 'announcements',
               'icon' => 'fa-list'
               
       ));   
       $secondarySidebar->getChild('sidebar1')
               ->addChild('child3', array(
               'label' => Lang::trans('knowledgebasetitle'),
               'uri' => 'knowledgebase',
               'icon' => 'fa-info-circle'
               
       ));  
 
      
        }

           

   }
});

 

Link to comment
Share on other sites

for the benefit of others, it's worth noting that the only reason the sidebar children are in the desired order is because David has called them child1, child2 etc... if he had given them the names used by default in WHMCS, he would have needed to add 'order' values to each of the children to specify their sidebar position, otherwise they would have been shown in alphabetical order by their child names.

Link to comment
Share on other sites

  • 2 years later...
16 hours ago, BackupAddict said:

Hello, yep, even the home page. I am using a Zomex template tho, might that be the cause?  Running on 8.1RC 

this is what i'm seeing on a v8.1RC1 dev using the Zomex (Stellar) template...

zHkgiuO.png

that sidebar is only included on the submitticket page (using either of David's hooks above) - it's not showing on any other page for me... including login.

I suppose, if for some reason, it doesn't like the use of APP, then there would be alternative ways of getting the filename..

<?php

use WHMCS\View\Menu\Item as MenuItem;

add_hook('ClientAreaSecondarySidebar', 1, function(MenuItem $secondarySidebar) {
	
	GLOBAL $smarty;
	$filename = $smarty->getTemplateVars()['filename'];
	if ($filename == "submitticket" && is_null($secondarySidebar->getChild('Support'))) {
		$secondarySidebar->addChild('sidebar1', array('label' => Lang::trans('navsupport'), 'order' => '10', 'icon' => 'fa-support',));
		$secondarySidebar->getChild('sidebar1')->addChild('child1', array('label' => Lang::trans('clientareanavsupporttickets'), 'uri' => 'supporttickets.php', 'icon' => 'fa-ticket'));
		$secondarySidebar->getChild('sidebar1')->addChild('child2', array('label' => Lang::trans('announcementstitle'), 'uri' => 'announcements', 'icon' => 'fa-list'));
		$secondarySidebar->getChild('sidebar1')->addChild('child3', array('label' => Lang::trans('knowledgebasetitle'), 'uri' => 'knowledgebase', 'icon' => 'fa-info-circle'));
	}
});

which again for me only shows the sidebar on the submitticket page and nowhere else...

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