In Magento, the Adminhtml (Backend) is used to manage the website. Magento builds a template pattern helping developers easily program the Adminhtml. Thus, the information I’m about to provide will certainly a good reference for those who are the administrators or developers of Magento sites or simply want to have further understanding about Magento as well. Today my tutorial will start with some basic aspects of this issue.

1. Differences between the adminhtml and the frontend

2. Components of the admin structure

In general, a page in Magento’s backend has the following parts:

• Header of admin:

  • Global search
  • Admin menu

• Content:

  • Grid Widget
  • Form view
  • Tabs in left panel

• Footer: select a box to choose locale and the other information.

3. Create a controller for admin router

  • Step 1: Create a module (similar to chapters above)
  • Step 2: Register an admin router for the module (use the configuration)
<config>
    ...
    <admin>
        <routers>
            <(modulename)>
                <use>admin</use>
                <args>
                    <module>(Namespace_Modulename)</module>
                    <frontName>(frontname)</frontName>
                </args>
            </(modulename)>
        </routers>
    </admin>
    ...
</config>
  • Step 3: Create a controller. An admin controller class needs to be extended from class Mage_Adminhtml_Controller_Action:
<?php

class (Namespace_Modulename)_IndexController
 extends Mage_Adminhtml_Controller_Action{
    public function indexAction(){
        // code for admin action here...
    }
}

4. How to operate with cache clearing

To clear cache in admin, you can go to menu System > Cache Management.

Then you may take these actions:

• Flush Magento Cache: clear all frontend caches

• Flush Cache Storage: all cache files in the folder /var/cache/* will be removed

• Refresh/Disable/Enable cache for the configuration, layouts, …

  • Refresh: All caches except for enabled aspects will be cleared.
  • Disable: Disable all caches
  • Enable: Enable all caches

• Flush image/javascript/css cache

5. How to clear the cache using code

To clear cache in Magento using code, you can use one of some methods below:

• Clear all cache files of Magento by the command: rm -rf var/cache/*

<?php
system("rm -rf var/cache/*");
?>

• Clear by Magento’s code

Clear all frontend caches:

Mage::app()->cleanCache();

Clear cache by tag:

$tags = array("CONFIG");
Mage::app()->cleanCache($tags);

Clear all caches:

Mage::app()->getCacheInstance()->flush();

That’s all for today. Don’t forget to follow the next parts to get more interesting knowledge of Adminhtml.
Have a great day;)

Author

Why Magestore? We believe in building a meaningful & long-term relationship with you.

4 Comments

  1. Thanks for the articles, however i think Topic 5 is not fully covered. You did not touch the Attributes Management.

    • Hi Milen,
      For some reasons, the last part of topic 5 will be released later. We are trying to make it available in the shortest time. Anw, thanks for your interest! 🙂

  2. Sorry, but it did not work in my case: Error in file: /var/www/clients/client1/web1/web/app/code/core/Mage/Customer/sql/customer_setup/mysql4-data-upgrade-1.4.0.0.7-1.4.0.0.8.php Invalid entity_type sfecipied: customer_addressTrace:#0 /var/www/clients/client1/web1/web/app/code/core/Mage/Core/Model/Resource/Setup.php(390): Mage::exception( Mage_Core’, Error in file: ‘)#1 /var/www/clients/client1/web1/web/app/code/core/Mage/Core/Model/Resource/Setup.php(264): Mage_Core_Model_Resource_Setup->_modifyResourceDb( data-upgrade’, ‘1.4.0.0.7 , ‘1.4.0.0.13 )#2 /var/www/clients/client1/web1/web/app/code/core/Mage/Core/Model/Resource/Setup.php(211): Mage_Core_Model_Resource_Setup->_upgradeData(‘1.4.0.0.7 , ‘1.4.0.0.13 )#3 /var/www/clients/client1/web1/web/app/code/core/Mage/Core/Model/Resource/Setup.php(194): Mage_Core_Model_Resource_Setup->applyDataUpdates()#4 /var/www/clients/client1/web1/web/app/code/core/Mage/Core/Model/App.php(337): Mage_Core_Model_Resource_Setup::applyAllDataUpdates()#5 /var/www/clients/client1/web1/web/app/Mage.php(627): Mage_Core_Model_App->run(Array)#6 /var/www/clients/client1/web1/web/index.php(80): Mage::run( , store’)#7 {main}

    • Hi Jayda,
      You can try clearing cache by your ftp account. You can remove or rename the folder /var/cache, then try running your site.
      Hope this helps

Write A Comment