If you are tired to waste your time finding a Magento configuration or clicking 3 times to clear a specific cache, this is the module you were waiting for. It allows you to access a menu entry or a configuration field quickly, and to perform common tasks easily via a keystroke launcher directly inspired by Alfred on OSX and Launchy on Windows/Linux.
Features
- Quick access to the launcher via spacebar hotkey (customizable)
- Fast search thanks to client-side indexation
- Use scoped query with keyword auto-suggestion (e.g. config, menu, action)
- Perform common tasks quickly such as “Clear Cache” and “Reindex All”
- Default indexers: menu, config, actions
- Other available indexers (disabled by default): products, categories, customers, orders, promotions, attributes
- Add your own logic easily by writing custom indexers and actions
Overview
Installation
Extension is available on GitHub: https://github.com/jreinke/magento-admin-launcher
You have 2 ways to install it:
- Manual installation: download package here, unzip in Magento root folder, then clean cache.
- Installation with modgit:
modgit -e README.md clone launcher https://github.com/jreinke/magento-admin-launcher.git
See a full example of how to use
modgit
here.
Usage
Status icon
When launcher is indexing (just after admin login), status icon is off in navigation bar:
Once indexation has finished, status icon becomes orange and launcher is now ready to use:
Display the launcher
When launcher is ready (orange logo), you just have to press spacebar
for displaying the launcher:
Default is spacebar key, it is modifiable in configuration.
Scope usage
The launcher allows you to use scopes for your query. It means that you are able to display only results of the type you want such as configuration or a menu entry for example. In order to do that, the launcher will suggest you a scope as soon as you type something in input field. If the suggested scope is suitable, then just press tab
key to validate its use:
You can disable scope usage in configuration.
Launcher configuration
Configuration is available under “System > Configuration > Bubble Launcher” (or just type “config: bubble” from the launcher :p)
General settings
Launcher customization
Custom indexer creation
If default indexers don’t meet your needs, you can easily create yours with the scopes you want.
As an example, we are going to create an indexer for customer groups.
Module creation
Start by creating a module with the following structure:
<!-- app/etc/modules/Namespace_Module.xml --> <?xml version="1.0"?> <config> <modules> <Namespace_Module> <active>true</active> <codePool>local</codePool> </Namespace_Module> </modules> </config> |
<!-- app/code/local/Namespace/Module/etc/config.xml --> <?xml version="1.0" encoding="utf-8"?> <config> <modules> <Namespace_Module> <!-- module name --> <version>0.1.0</version> </Namespace_Module> </modules> <global> <models> <namespace_module> <!-- used in launcher.xml --> <class>Namespace_Module_Model</class> <!-- used to find indexer model in the module --> </namespace_module> </models> </global> </config> |
Indexer definition
<!-- app/code/local/Namespace/Module/etc/launcher.xml --> <?xml version="1.0" encoding="utf-8"?> <launcher> <indexers> <group> <!-- group is the scope, it can be translated --> <class>namespace_module/indexer_group</class> <!-- class instantiated via Mage::getSingleton() --> </group> </indexers> </launcher> |
Indexer creation
Indexer must extend Bubble_Launcher_Model_Indexer_Abstract
and must implement _buildIndexData
method:
<?php // app/code/local/Namespace/Module/Model/Indexer/Group.php class Namespace_Module_Model_Indexer_Group extends Bubble_Launcher_Model_Indexer_Abstract { protected function _buildIndexData() { $data = array(); $collection = Mage::getModel('customer/group')->getCollection(); $menuLabel = Mage::helper('adminhtml')->__('Customer Groups'); foreach ($collection as $group) { /** @var $group Mage_Customer_Model_Group */ $title = sprintf('%s', $group->getCustomerGroupCode()); $text = sprintf('%s > %s', $menuLabel, $group->getCustomerGroupCode()); $url = $this->_getUrl('adminhtml/customer_group/edit', array('id' => $group->getId())); $data[] = $this->_prepareData($title, $text, $url); } return $data; } } |
Check permissions
Each indexer inherits a canIndex()
method which is useful for checking a configuration flag and/or permissions. In our example, we are going to verify that the admin user has enough permissions for managing customer groups:
<?php // app/code/local/Namespace/Module/Model/Indexer/Group.php class Namespace_Module_Model_Indexer_Group extends Bubble_Launcher_Model_Indexer_Abstract { protected function _buildIndexData() { // ... see above } public function canIndex() { return $this->_isAllowed('customer/group'); } } |
Add custom icon in search results
You are able to display an icon for customer groups displayed in search results.
Start by retrieving an icon, for example group.png
, in a free icon set available here: http://www.famfamfam.com/lab/icons/silk/.
Copy it in skin/adminhtml/default/default/images/bubblelauncher/fam/group.png
.
Then modify css file by adding lines below:
/* skin/adminhtml/default/default/bubblelauncher.css */ #bubblelauncher-results ul.show-icon li.group a { /* li.group matches scope group defined in launcher.xml above */ background-image: url(images/bubblelauncher/fam/group.png); } |
Default files should not be modified directly. It would be a better idea to add this in a separate css file.
Result
Clear cache and you should obtain the following result when you use group
scope:
You can translate “group” scope by adding a translation in Bubble_Launcher.csv file.
Custom action creation
Add a launcher.xml file
The module provides default actions such as “Clear Magento Cache” and “Reindex All”. You can define your own action by adding custom configuration to etc/launcher.xml
file of your module. It will be merged to default actions.
Here is an example of how to add logout action to the launcher.
<!-- app/code/local/Namespace/Module/etc/launcher.xml --> <?xml version="1.0" encoding="utf-8"?> <launcher> <actions> <logout> <title module="adminhtml">Log Out</title> <!-- this will be translated by adminhtml helper --> <text module="adminhtml">Log Out</text> <!-- this will be translated by adminhtml helper --> <action>adminhtml/index/logout</action> <!--acl>not needed for logout</acl--> </logout> </actions> </launcher> |
Result
After clearing the cache, you should obtain this:
See how default actions are defined in file app/code/community/Bubble/Launcher/etc/launcher.xml
Have fun
2 Responses to “A powerful launcher for Magento admin panel”
Salut Johann,
and a grand merci for your excellent extension!
I am just trying out a different Wysiwyg (Redaktor) but it seems to react differently to positioning the cursor inside the “text area” so when I hit space, Launcher comes up instead of giving me a space in the text. This would have been all good by just changing the key code but I tried to do that with several different key codes but it doesn’t change. Looking into the js file I found that the value 32 is statically input so easy to change but would be great if you updated the extension to take the value from config.
Cheerio
Peter
Hi. Excellent tool.
This may or may not be a bug. In system.log we see the following:
2013-12-28T18:57:53+00:00 ERR (3): Notice: Undefined index: fields in includes/src/Bubble_Launcher_Model_Indexer_Config.php on line 36
2013-12-28T18:57:53+00:00 ERR (3): Notice: Undefined index: label in includes/src/Bubble_Launcher_Model_Indexer_Config.php on line 38
2013-12-28T18:57:53+00:00 ERR (3): Notice: Undefined index: label in includes/src/Bubble_Launcher_Model_Indexer_Config.php on line 23
And, possibly unrelated, I do not see the ‘B’ icon in the menu bar of the admin panel.
This is on CE 1.8.1.0