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.

Interested in hiring us?

Have a chat with us. You would be surprised how small changes can make your business even more successful.


26 comments

  1. 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

    		<blocks>
    			<leiser_ics>
    				<class>Leiser_Ics_Block</class>
    			</leiser_ics>
    			<ics_import>
    				<class>Leise_Ics_Block_Import</class>
    			</ics_import>
    		</blocks>
    	</global>
    
    	<admin>
    		<routers>
    			<adminhtml>
    				<args>
    					<modules>
    						<Leiser_Ics after="Mage_Adminhtml">Leiser_Ics</Leiser_Ics>
    					</modules>
    				</args>
    			</adminhtml>
    		</routers>
    	</admin>

    Controller:

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

    Tab Block:

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

    Content Block:

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

    Thanks for your troubles in adavance.

    Thanks in advance

  2. 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.

  3. 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…

  4. 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…..

  5. @naturalcrusader

    I was referring to the setting in

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

    admin
    change ‘admin’

  6. @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.

  7. @Tigran ,

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

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

  9. 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!

  10. 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

  11. 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.

  12. 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!

  13. 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

  14. 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)

  15. 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.

  16. 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 :)

  17. 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.

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

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

    and it works fine ;)

  19. 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.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <blockquote cite=""> <code> <del datetime=""> <em> <strike> <strong>. You may use following syntax for source code: <pre><code>$current = "Inchoo";</code></pre>.