Jump to content

How override AdminHomeController.php


dambie

Recommended Posts

How override AdminHomeController.php and add custom quick links ?

 

 

I put this in override\controllers\admin\AdminHomeController.php but doesn't work :(

class AdminHomeController extends AdminHomeControllerCore
{
public function getQuickLinks()
{

//rest code

Edited by dambie (see edit history)
Link to comment
Share on other sites

From just that snippet, you may want to maintain the protected status of the original method until you know what's invoking it. Also, start by invoking the parent::getQuickLinks() then add your links to the $quick_links array that it returns.

 

This is from v1.5.2:

protected function getQuickLinks()
{
$quick_links = array();
[...]

 

If you override, then invoke the parent the first line there will blitz all your work...

 

Posting your entire getQuickLinks() method may help in helping you.

 

HTH,

Link to comment
Share on other sites

My code: override\controllers\admin\AdminHomeController.php but doesn't work.

 

class AdminHomeController extends AdminHomeControllerCore
{
protected function getQuickLinks()
{
 $quick_links = array();

 $profile_access = Profile::getProfileAccesses($this->context->employee->id_profile);
 if ($profile_access[(int)Tab::getIdFromClassName('AdminStats')]['view'])
  $quick_links['first'] = array(
   'href' => $this->context->link->getAdminLink('AdminStats').'&module=statsbestproducts',
   'title' => $this->l('Recently sold products.'),
   'description' => $this->l('11Create a new category and organize your catalog.'),
  );
 return $quick_links;
}
}

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...