├── README.md └── app ├── code └── community │ └── Bubble │ └── ConfigNav │ ├── Block │ └── Adminhtml │ │ └── Page │ │ └── Menu.php │ └── etc │ └── config.xml └── etc └── modules └── Bubble_ConfigNav.xml /README.md: -------------------------------------------------------------------------------- 1 | ## Include configuration tabs into admin nav for fast access 2 | 3 | ![Magento Configuration Navigation](http://i.imgur.com/QjT04xP.png) 4 | 5 | ## Demo 6 | 7 | Demo is available here: [demo.bubbleshop.net/admin](http://demo.bubbleshop.net/admin) 8 | 9 | ## Installation on Magento 1.9.x 10 | 11 | Install with [modgit](https://github.com/jreinke/modgit): 12 | 13 | $ cd /path/to/magento 14 | $ modgit init 15 | $ modgit clone confignav https://github.com/jreinke/magento-config-nav.git 16 | 17 | or download package manually: 18 | 19 | * Download latest version [here](https://github.com/jreinke/magento-config-nav/archive/master.zip) 20 | * Unzip in Magento root folder 21 | * Clear cache 22 | 23 | Other awesome Magento extensions available here: [www.bubbleshop.net](https://www.bubbleshop.net/) -------------------------------------------------------------------------------- /app/code/community/Bubble/ConfigNav/Block/Adminhtml/Page/Menu.php: -------------------------------------------------------------------------------- 1 | Mage::helper('adminhtml')->__('Config'), 27 | 'sort_order' => 1000, 28 | 'url' => '#', 29 | 'active' => false, 30 | 'level' => 0, 31 | 'click' => 'return false', 32 | 'children' => array(), 33 | ); 34 | 35 | $url = Mage::getModel('adminhtml/url'); 36 | $websiteCode = $this->getRequest()->getParam('website'); 37 | $storeCode = $this->getRequest()->getParam('store'); 38 | $configFields = Mage::getSingleton('adminhtml/config'); 39 | $sections = (array) $configFields->getSections(); 40 | $tabs = (array) $configFields->getTabs()->children(); 41 | 42 | usort($sections, array($this, '_sort')); 43 | usort($tabs, array($this, '_sort')); 44 | 45 | foreach ($tabs as $i => $tab) { 46 | if (strlen(trim((string) $tab->label)) === 0) { 47 | continue; 48 | } 49 | $helperName = $configFields->getAttributeModule($tab); 50 | $label = Mage::helper($helperName)->__((string) $tab->label); 51 | $menu['config']['children'][$tab->getName()] = array( 52 | 'label' => $label, 53 | 'sort_order' => $i, 54 | 'url' => '#', 55 | 'active' => false, 56 | 'level' => 1, 57 | 'click' => 'return false', 58 | 'children' => array(), 59 | ); 60 | } 61 | 62 | foreach ($sections as $i => $section) { 63 | Mage::dispatchEvent('adminhtml_block_system_config_init_tab_sections_before', array('section' => $section)); 64 | 65 | $tab = (string) $section->tab; 66 | 67 | if (!isset($menu['config']['children'][$tab]) || strlen(trim((string) $section->label)) === 0) { 68 | continue; 69 | } 70 | 71 | $hasChildren = $configFields->hasChildren($section, $websiteCode, $storeCode); 72 | $code = $section->getName(); 73 | $sectionAllowed = $this->checkSectionPermissions($code); 74 | $helperName = $configFields->getAttributeModule($section); 75 | $label = Mage::helper($helperName)->__((string) $section->label); 76 | 77 | if ($sectionAllowed && $hasChildren) { 78 | $menu['config']['children'][$tab]['children'][$code] = array( 79 | 'label' => $label, 80 | 'sort_order' => $i, 81 | 'url' => $url->getUrl('adminhtml/system_config/', array('section' => $code)), 82 | 'active' => false, 83 | 'level' => 2, 84 | ); 85 | } 86 | } 87 | 88 | end($menu['config']['children']); 89 | $menu['config']['children'][key($menu['config']['children'])]['last'] = true; 90 | 91 | foreach ($menu['config']['children'] as $code => &$tab) { 92 | if (empty($tab['children'])) { 93 | unset($menu['config']['children'][$code]); 94 | continue; 95 | } 96 | end($tab['children']); 97 | $tab['children'][key($tab['children'])]['last'] = true; 98 | } 99 | 100 | // Mark the new Config tab as active (and System as inactive) if we are in configuration section 101 | if ($menu['system']['active']) { 102 | $menu['system']['active'] = false; 103 | $menu['config']['active'] = true; 104 | } 105 | 106 | return $menu; 107 | } 108 | 109 | /** 110 | * @param null $code 111 | * @return bool 112 | */ 113 | public function checkSectionPermissions($code = null) 114 | { 115 | static $permissions; 116 | 117 | if (!$code || trim($code) == '') { 118 | return false; 119 | } 120 | 121 | if (!$permissions) { 122 | $permissions = Mage::getSingleton('admin/session'); 123 | } 124 | 125 | $showTab = false; 126 | if ($permissions->isAllowed('system/config/' . $code)) { 127 | $showTab = true; 128 | } 129 | 130 | return $showTab; 131 | } 132 | 133 | /** 134 | * @param $a 135 | * @param $b 136 | * @return int 137 | */ 138 | protected function _sort($a, $b) 139 | { 140 | return (int) $a->sort_order < (int) $b->sort_order ? -1 : ((int) $a->sort_order > (int) $b->sort_order ? 1 : 0); 141 | } 142 | } -------------------------------------------------------------------------------- /app/code/community/Bubble/ConfigNav/etc/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 1.0.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | Bubble_ConfigNav_Block_Adminhtml_Page_Menu 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /app/etc/modules/Bubble_ConfigNav.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | true 6 | community 7 | 8 | 9 | --------------------------------------------------------------------------------