Hello All,
I would like change positions for Tabs In Admin: Products: Edit-View
For Ex: I want move some tabs to the first and some to the end.
Kindly check attached
What the best way to do that ?
Thank you all
Hello All,
I would like change positions for Tabs In Admin: Products: Edit-View
For Ex: I want move some tabs to the first and some to the end.
Kindly check attached
What the best way to do that ?
Thank you all
I believe on the admin side you would need a small chunk of custom code to reorder the navigation tabs data that is generated. I would use a 'post' controller like app/addons/my_changes/controllers/backend/products.post.php containing something similar to (not tested, just an idea):
if( !defined('BOOTSTRAP') ) die('Access denied');use Tygh\Registry;
if( $_SERVER[‘REQUEST_METHOD’] == ‘GET’ && ($nav_tabs = Registry::get(‘navigation.tabs’)) ) {
$my_tab_order = array(‘general’, ‘options’, ‘shippings’, ‘qty_discounts’, ‘product_tabs’, ‘seo’); // all the rest will be copied over in their original order
$new_tabs = array();
foreach($my_tab_order as $tab_id) {
if( isset($nav_tabs[$tab_id]) ) {
$new_tabs = $nav_tabs[$tab_id];
unset($nav_tabs[$tab_id]);
}
// Unspecified tabs are left in $nav_tabs;
}
if( !empty($nav_tabs) )
$new_tabs = array_merge($new_tabs, $nav_tabs);
Registry::set(‘navigation.tabs’, $new_tabs);
}
return array(CONTROLLER_STATUS_OK);
This should result with a tab order of general, options, shippings, qty_discounts, product_tabs, seo, files, subscribers, addons, features,buy_together, attachments and blocks. Followed by any addons that may add to your product tabs.
I believe on the admin side you would need a small chunk of custom code to reorder the navigation tabs data that is generated. I would use a 'post' controller like app/addons/my_changes/controllers/backend/products.post.php containing something similar to (not tested, just an idea):
if( !defined('BOOTSTRAP') ) die('Access denied');use Tygh\Registry;
if( $_SERVER[‘REQUEST_METHOD’] == ‘GET’ && ($nav_tabs = Registry::get(‘navigation.tabs’)) ) {
$my_tab_order = array(‘general’, ‘options’, ‘shippings’, ‘qty_discounts’, ‘product_tabs’, ‘seo’); // all the rest will be copied over in their original order
$new_tabs = array();
foreach($my_tab_order as $tab_id) {
if( isset($nav_tabs[$tab_id]) ) {
$new_tabs = $nav_tabs[$tab_id];
unset($nav_tabs[$tab_id]);
}
// Unspecified tabs are left in $nav_tabs;
}
if( !empty($nav_tabs) )
$new_tabs = array_merge($new_tabs, $nav_tabs);
Registry::set(‘navigation.tabs’, $new_tabs);
}
return array(CONTROLLER_STATUS_OK);
This should result with a tab order of general, options, shippings, qty_discounts, product_tabs, seo, files, subscribers, addons, features,buy_together, attachments and blocks. Followed by any addons that may add to your product tabs.
As I said, it's untested and it was free. Suggest you have your developer review and either add some diagnostics or otherwise adjust.
You might need to 'get' the 'navigation' property versus 'navigation.tabs' and adjust and save the updated tabs instead.
I.e.
if( !defined('BOOTSTRAP') ) die('Access denied');use Tygh\Registry;
if( $_SERVER[‘REQUEST_METHOD’] == ‘GET’ && ($nav = Registry::get(‘navigation’)) ) {
$nav_tabs = empty($nav[‘tabs’]) ? [] : $nav[‘tabs’];
$my_tab_order = array(‘general’, ‘options’, ‘shippings’, ‘qty_discounts’, ‘product_tabs’, ‘seo’); // all the rest will be copied over in their original order
$new_tabs = array();
foreach($my_tab_order as $tab_id) {
if( isset($nav_tabs[$tab_id]) ) {
$new_tabs = $nav_tabs[$tab_id];
unset($nav_tabs[$tab_id]);
}
// Unspecified tabs are left in $nav_tabs;
}
if( !empty($nav_tabs) )
$new_tabs = array_merge($new_tabs, $nav_tabs);
$nav[‘tabs’] = $new_tabs;
Registry::set(‘navigation’, $nav);
}
return array(CONTROLLER_STATUS_OK);
As I said, it's untested and it was free. Suggest you have your developer review and either add some diagnostics or otherwise adjust.
You might need to 'get' the 'navigation' property versus 'navigation.tabs' and adjust and save the updated tabs instead.
I.e.
if( !defined('BOOTSTRAP') ) die('Access denied');use Tygh\Registry;
if( $_SERVER[‘REQUEST_METHOD’] == ‘GET’ && ($nav = Registry::get(‘navigation’)) ) {
$nav_tabs = empty($nav[‘tabs’]) ? [] : $nav[‘tabs’];
$my_tab_order = array(‘general’, ‘options’, ‘shippings’, ‘qty_discounts’, ‘product_tabs’, ‘seo’); // all the rest will be copied over in their original order
$new_tabs = array();
foreach($my_tab_order as $tab_id) {
if( isset($nav_tabs[$tab_id]) ) {
$new_tabs = $nav_tabs[$tab_id];
unset($nav_tabs[$tab_id]);
}
// Unspecified tabs are left in $nav_tabs;
}
if( !empty($nav_tabs) )
$new_tabs = array_merge($new_tabs, $nav_tabs);
$nav[‘tabs’] = $new_tabs;
Registry::set(‘navigation’, $nav);
}
return array(CONTROLLER_STATUS_OK);
Thank you, I modified the code and it working very well with me :
use Tygh\Registry;if( $_SERVER[‘REQUEST_METHOD’] == ‘GET’ && ($nav_tabs = Registry::get(‘navigation.tabs’)) ) {
$my_tab_order = array(‘detailed’, ‘options’, ‘features’, ‘package_info’, ‘addons’, ‘product_tabs’); // all the rest will be copied over in their original order
$new_tabs = array();
foreach($my_tab_order as $tab_id) {
if( isset($nav_tabs[$tab_id]) ) {
$new_tabs[$tab_id] = $nav_tabs[$tab_id];
if($tab_id == ‘addons’) {
$new_tabs[$tab_id][‘title’] = ‘Important Options’;
}
unset($nav_tabs[$tab_id]);
}
// Unspecified tabs are left in $nav_tabs;
}
if( !empty($nav_tabs) )
$new_tabs = array_merge($new_tabs, $nav_tabs);
Registry::set(‘navigation.tabs’, $new_tabs);
}
return array(CONTROLLER_STATUS_OK);?>