Monthly Archives: July 2009

  • The Magento adminhtml (or admin panel) is quite different from other modules for the frontend. The Adminhtml module has a distinct implementation of the Model-Controller-View scheme. In fact, forms, tables, graphs and etc. are usually stereotypical and highly repetitive comparing to the large varieties in the frondend. As a result, in Adminhtml page, such elements are generalized into block 'widgets' to boost coding efficiency.

    However, when building a new module, we often need to modify the frontend and the backend together. And in many cases, since the we already build the functions in frontend module, it's really a waste of energy if we have to rewrite everything in terms of 'widget' in the backend. Simply, we would like to migrate the controller and view to the backend and reuse the code.

    Here, I'm going to go through the basic steps the Mage_Adminhtml_Block_Template rather than widgets.

    (This is a developer's guide.)

    Let's begin with creating a new menu in the Admin panel. We added to the config.xml to our new module:

        <new_module translate="title" module="new_module">
          <title>New Module Name</title>

    Continue reading

  • More than often, we need to create a new Magento attribute to extend some Magento functions, or even a new attribute group to serve our own module.  Here is how we do it using the sql setup file.

    First, a few words about the sql setup file.

    If this is the first time building the module or fresh installation, create a php file, say "mysql4-install-0.1.0.php", in [company]/[module]/sql/[module]/[module]_setup/ folder, where the version 0.1.0 is defined the the config.xml file.

    In case of module upgrade, try something like "mysql4-upgrade-0.1.0-0.2.0.php", again, verify your upgrade version in the config.xml file.

    Inside this file, first we need to initiate:

    $installer = $this;
    $setup = new Mage_Eav_Model_Entity_Setup('core_setup');

    Continue reading

2 Item(s)

Back to top