Is it possible to add new tab to the tabs in Admin Dashboard
1 Answer
Yes it is possible to add the new tabs in Admin dashboard.
If you check the file:
vendor/magento/module-backend/Block/Dashboard/Grids.php
This is the block file where you can add the tabs. Here you need to point to proper controller to show the data for the tab.
protected function _prepareLayout()
{
// load this active tab statically
$this->addTab(
'ordered_products',
[
'label' => __('Bestsellers'),
'content' => $this->getLayout()->createBlock(
'Magento\Backend\Block\Dashboard\Tab\Products\Ordered'
)->toHtml(),
'active' => true
]
);
// load other tabs with ajax
$this->addTab(
'reviewed_products',
[
'label' => __('Most Viewed Products'),
'url' => $this->getUrl('adminhtml/*/productsViewed', ['_current' => true]),
'class' => 'ajax'
]
);
$this->addTab(
'new_customers',
[
'label' => __('New Customers'),
'url' => $this->getUrl('adminhtml/*/customersNewest', ['_current' => true]),
'class' => 'ajax'
]
);
$this->addTab(
'customers',
[
'label' => __('Customers'),
'url' => $this->getUrl('adminhtml/*/customersMost', ['_current' => true]),
'class' => 'ajax'
]
);
return parent::_prepareLayout();
}
You can call addTab menthod to to add the new tab on the admin dashboard.
The proper way of doing it to not modify the core files and override the module.
Hope this help to take the right path to achieve what you are looking for.
If this answer helps, please accept and vote up so that it will help others too.
Cheers!!
-
1Thank you very much :) overriding this block worked for me!! Commented Mar 2, 2018 at 10:03
-
Hi, I checked but this answer is half because not add full actions part Commented Feb 4, 2020 at 10:17