Search code examples
magentoresources

Magento extension not registering in core resources table


I am writing a Magento extension and I just cannot get it to show up in the core resources table. I believe I am declaring the resources part of my config correctly. Why is my extension not visible in the resource table?

<?xml version="1.0"?>
<config>
    <modules>
        <CTRL_Analytics>
            <version>0.2.0</version>
        </CTRL_Analytics>
    </modules>
    <global>
      <blocks>
        <analytics>
          <class>CTRL_Analytics_Block</class>
        </analytics>
      </blocks>
      
       <helpers>
          <analytics>
            <class>CTRL_Analytics_Helper</class>
          </analytics>
      </helpers>
        
      <resources>
        <analytics_setup>
            <setup>     
                <module>CTRL_Analytics</module>
            </setup>
            <connection>
                <use>core_setup</use>
            </connection>
        </analytics_setup>
        
        <analytics_write>
            <connection>
                <use>core_write</use>
            </connection>
        </analytics_write>
        
        <analytics_read>
            <connection>
                <use>core_read</use>
            </connection>
        </analytics_read>
      </resources>
      
    </global>
    <adminhtml>
        <menu>
          <analytics translate="title" module="analytics">
              <title>Marketing and Analytics</title>
              <sort_order>100</sort_order>
              <action>analytics/admin</action>
          </analytics>
        </menu>
    </adminhtml>
    <frontend>
        <routers>
            <CTRL_Analytics>
                <use>standard</use>
                <args>
                    <module>CTRL_Analytics</module>
                    <frontName>analytics</frontName>
                </args>
            </CTRL_Analytics>
        </routers>
    </frontend>
</config>

Solution

  • Looking at your XML, you're naming your installer file

    "mysql4-install-0.1.0.php", 
    

    but your starting module version is

    "<version>0.2.0</version>"  
    

    Try changing your starting version to

    "<version>0.1.0</version>"
    

    or changing your installer file to

    "mysql4-install-0.2.0.php".  
    

    Those file version numbers come from your module version number.

    I always drop an exit or exception into any new installer file to make sure PHP is trying to load the file. Information is written out to the core_resource table only after a successful execution of this file, an exit or exception will prevent that writing. This allows you to reload the page and have an installer run again and again until you get it right.