CoffeeFreak – Blank Magento extension for building main admin menu with sidebar and tabs

Featured Image

My previous article, CoolDash – Blank Magento extension for building admin system configuration area, was about blank start-up extension for building System > Configuration admin area. I used a lot of “funny” attribute names so that “get around” gets some speed. This extension is somewhat similar to previous one, except its meant to be a blank start-up extension for building items under main admin menu with sidebar and tabs.

Keep in mind that, once again, extension name is something I popped out of my head while I was making myself a coffee:).

Below are two screenshots for you to see final result.

NoSidebar

SidebarInView

In short, this extension demonstrates the use of controllers (router definition under config file) and widgets in Magento.

Download Inchoo_CoffeeFreak extension for Magento.

Hope you find it useful.

26
Top

Care to rate this post?

Author

Branko Ajzele

Ex Inchooer

Worked at Inchoo as a Backend Developer/CTO from 2008 to 2013

Other posts from this author

Discussion 26 Comments

Add Comment
  1. wee-man

    Thanks for this nice example. Have you any idea, how to mark the menu item as active, if it is clicked? the build-in magento items are still active if you click one of them.

  2. wee-man

    playing around for a little bit, i’ve found a solution:

    $this -> loadLayout();
    $this -> _setActiveMenu(‘mymenu1′);

    and it works fine ;)

  3. Viktor

    Thanks, it’s a grate Tutorial and help me much

  4. Tobey

    Can you give an example of how to add a custom tab to the product edit page? I have tired without success other than adding to core code which I dont want to do.

  5. Happy

    Hi there

    thansk for the blank module – its good.

    I’ve been searching around to find out how to add my admin module to an already existent tab, under the system->configuration menus…. rather than having it as a loan module at the top on that hoz menu.

    do you guys have any information on this?

    many thanks
    btw, v nice design on this site :)

  6. Senthil

    Hi,
    I am new to Magento.. for the beginners like me this is very helpful.

    Great work.

    Ya.. just like above comment.. i too require a module in submenus not in main menu.

    All the Best to your team.

  7. Nicola

    Hi thank you for this great example! I have a little problem: i’m trying to add a public function to the controller saveAction… but if I try to open

    http://mymagento/admin/mymodule/save/key/xxxx

    i’m redirected to the admin dashboard… http://mymagento/admin/mymodule/index/key/xxxx work well.

    What i’m missing?
    please help and thank you!! :)

  8. Nicola

    hi, sorry if i ask again, but can find a solution.

    I can add new methods in controllers on the frontend, but i don’t know how to do it in admin…

    i have a controller on a frontend and it is accessible by

    http://mymagento/mymodule/
    or
    http://mymagento/mymodule/index

    now i add a new function on this controller “save”

    and i can go to access this on
    http://mymagento/mymodule/index/save

    i can’t replicate it on the backend… every new public function i add on the admin controller will redirect me to the admin dashboard…

    Can somebody help me please? what i’m missing?

    Thank you very much and sorry for my english (i’m from italy)

  9. Nicola

    Nobody? :( please….

  10. Shani

    Hello,
    This post was very helpful, thank you.
    But I have a problem that I don’t understand -
    When I add the file “Inchoo_CoffeeFreak.xml” to /app/etc/modules
    I get the extension to work but it causes problems with some pages in the admin – The Index Index Management and other pages stop working (I get 404 Error).

    When I delete this file (Inchoo_CoffeeFreak.xml) from the folder The pages start working again.

    What can cause this? What should I do?

    Thank you

  11. Daniel Landi

    Hello,

    First of all, congratulations for the post!!! It’s very good and works very well.

    I was several days trying to do it and I was near to get it when I found your post and it helps me to solve all the problems with the tabs and active menu!.

    I wanted to request you a post explain how to use this block to save data. For example to save some informations about a manufacturer.

    Thanks!

  12. Richard Creek

    Hi, thanks for the tutorial. There’s a problem with it in magento 1.4.1.1 though, it breaks the index management page, makes it return a 404 error.

  13. Tigran

    Hi, got the same problem as Shani. After installing and modifying this module, I’ve got a problem with index management. Can’t access that page. It gives 404 error. Please, if anyone have a solution or have ideas, what can be the reason, respond!!!! It’s very important!!!
    Thank you

  14. Tigran

    Forgot to write. I’m also using magento version 1.4.1.1

  15. It looks like if you change the line:

    <codePool>community</codePool>

    to:

    <codePool>local</codePool>

    Everything in Index Management comes back online without a problem. Let me know if that works for you!

  16. Tigran

    Hello Bob.
    Thanks for reply.
    I’ve tried that, but with no luck. If you have found any solution, please share it here

  17. aureleonidas

    @Tigran ,

    I’ve experienced the same problem, changed the admin>router>frontname from admin to ‘anyothername’ fixed this issue.

  18. naturalcrusader

    @aureleonidas

    having same issue with 404 for all modules, even ones known to already work in the admin->config, I am trying to use your solution by changing the admin>router>frontname from admin, but I am unable to find what you are saying, I went to config and selected admin, but there was no router option.

  19. aurelionidas

    @naturalcrusader

    I was referring to the setting in

    app/code/local/Inchoo/CoffeeFreak/etc/config.xml,
    look for :

    admin
    change ‘admin’

  20. Tigran

    @aurelionidas
    Thanks man! Your solution worked for me!

  21. nayan

    as per ur steps i put code in my website
    after that in admin side system-> configuration -> advanced i see disable module output Inchoo_CoffeeFreak is enable but it didnt display in my admin menubar…..
    reply soon…..

  22. Beginner

    Hello,
    I am wondering if there is something like a visual buidler for Magento extensions. I mean there are so many menus and files… It feels like wasting time when I build all the XML and folder structures by hand…

  23. Varun

    Hi

    Can you provide the version of this extension that supports magento 1.7.0.2.

  24. Iammabbella

    I have solved the problem:

    Change the codepool from community to local in .xml etc/modules (and MOVE the inchoo folder from community to local…)
    Then in config.xml:

    admin
    Inchoo_CoffeeFreak_AdminControllersHere

    Mage_Adminhtml

    (“frontname” isn’t necessary)

    and in the menu, change the action like this:

    adminhtml/FreakOut

    I’m using Magento 1.7.0.2., works perfect.

  25. Thanks, I have been trying to create admin panel page in magento for 3 days. You saved my time :)

  26. Hi im having a problem not being able to get the content Area to show up. I hope you or someone can Help me:

    config.xml

    		&lt;blocks&gt;
    			&lt;leiser_ics&gt;
    				&lt;class&gt;Leiser_Ics_Block&lt;/class&gt;
    			&lt;/leiser_ics&gt;
    			&lt;ics_import&gt;
    				&lt;class&gt;Leise_Ics_Block_Import&lt;/class&gt;
    			&lt;/ics_import&gt;
    		&lt;/blocks&gt;
    	&lt;/global&gt;
    	&lt;admin&gt;
    		&lt;routers&gt;
    			&lt;adminhtml&gt;
    				&lt;args&gt;
    					&lt;modules&gt;
    						&lt;Leiser_Ics after=&quot;Mage_Adminhtml&quot;&gt;Leiser_Ics&lt;/Leiser_Ics&gt;
    					&lt;/modules&gt;
    				&lt;/args&gt;
    			&lt;/adminhtml&gt;
    		&lt;/routers&gt;
    	&lt;/admin&gt;
    

    Controller:

    	public function indexAction()
    	{
    		$this-&gt;_title('Leiser Ics');
    		$this-&gt;loadLayout();
    		$this-&gt;_setActiveMenu('leiser_ics');
    		$this-&gt;_addLeft($this-&gt;getLayout()-&gt;createBlock('Leiser_Ics_Block_Import'));
    		$this-&gt;renderLayout();
    	}
    

    Tab Block:

    class Leiser_Ics_Block_Import extends Mage_Adminhtml_Block_Widget_Tabs
    {
    	public function __construct()
    	{
    		parent::__construct();
    		$this-&gt;setId('ics-import');
    		$this-&gt;setTitle(Mage::helper('leiser_ics')-&gt;__('Leiser ICS'));
    	}
    	protected function _beforeToHtml()
    	{
    		$this-&gt;addTab('overview', array(
    			'label' 	=&gt; Mage::helper('leiser_ics')-&gt;__('Kollektion'),
    			'title' 	=&gt; Mage::helper('leiser_ics')-&gt;__('Kollektion'),
    			'content' =&gt; $this-&gt;getLayout()-&gt;createBlock(&quot;ics_import/Collection&quot;),
    			'active' 	=&gt; true));
    		return parent::_beforeToHtml();
    	}
    }
    

    Content Block:

    class Leiser_Ics_Block_Import_Collection extends Mage_Adminhtml_Block_Template
    {
      public function __construct()
      {
      	parent::__construct();
      	$this-&gt;setTemplate('leiser/ics/import/collection.phtml');
      }
    }
    

    Thanks for your troubles in adavance.

    Thanks in advance

Add Your Comment

Please wrap all source codes with [code][/code] tags.
Top