I have created a custom module that creates a custom Database table. I have been following Alan Storm’s tutorials http://alanstorm.com/magento_setup_resources and http://alanstorm.com/magento_models_orm in order to create custom Database tables.
My module entry gets showed up in core_resource table but the actual doesn’t get showed up.
This is my config.xml code
<?xml version="1.0"?>
<config>
<modules>
<Ajzele_SimpleModel>
<version>0.0.1</version>
</Ajzele_SimpleModel>
</modules>
<global>
<models>
<simplemodel>
<class>Ajzele_SimpleModel_Model</class>
<resourceModel>simplemodel_mysql4</resourceModel>
</simplemodel>
<simplemodel_mysql4>
<class>Ajzele_SimpleModel_Model_Mysql4</class>
<entities>
<simplemodel>
<table>simplemodel</table>
</simplemodel>
</entities>
</simplemodel_mysql4>
</models>
<resources>
<simplemodel_setup>
<setup>
<module>Ajzele_SimpleModel</module>
<class>Ajzele_SimpleModel_Model_Mysql4_Setup</class>
</setup>
<connection>
<use>core_setup</use>
</connection>
</simplemodel_setup>
<simplemodel_read>
<connection>
<use>core_read</use>
</connection>
</simplemodel_read>
<simplemodel_write>
<connection>
<use>core_write</use>
</connection>
</simplemodel_write>
</resources>
</global>
</config>
And my Model file Structure is
Model
SimpleModel.php
Mysql4
SimpleModel.php
Setup.php
SimpleModel
Collection.php
Here’s teh contents of my sql/simplemodel_setup/mysql4-install-0.0.1.php
<?php
$installer = $this;
$installer->startSetup();
$baseTableName = 'simplemodel';
$sql = "
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for `simplemodel`
-- ----------------------------
DROP TABLE IF EXISTS {$this->getTable($baseTableName)};
CREATE TABLE {$this->getTable($baseTableName)} (
`simplemodel_id` int(11) NOT NULL AUTO_INCREMENT,
`field1` varchar(255) DEFAULT NULL,
`field2` varchar(255) DEFAULT NULL,
PRIMARY KEY (`simplemodel_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
";
$installer->run($sql);
$installer->endSetup();
I have tried various debugging methods, but I get neither any exception nor an error. What should I do in order to get my table actually show up in Database?
I recommend you put Magento in developer mode and debug the trace of XML to check the XML. To configure Magento in developer Mode you should put the variable MAGE_IS_DEVELOPER_MODE in the definition of the virtual host or in the .htaccess of the Magento root.
For example in de virtual host:
later you should modify index.php in the line 66 and put
Varien_Profiler::enable(); and ini_set(‘display_errors’, 1); is out of conditional i think for mistake.
Now, you can´t see the simplexml_load_string() error whent have an error in the XML:
Warning: simplexml_load_string() [function.simplexml-load-string]: Entity: line 4: parser error : error parsing attribute name in C:\Program Files\Zend\Apache2\htdocs\local.pruebas.com\lib\Varien\Simplexml\Config.php on line 510……
then, its time to debug
1.first: go to app/etc/Ajzele_SimpleModel and force and error, for example:
you should see the error.
2.second: go to app/code/local/Ajzele/SimpleModel/etc/config.xml and retry the process
if you don´t have simple xml error in this point you don´t load correctly your extension, and the next step is debug and debug config.xml
This isn´t a concrete answere, but i think that you can see whith the solution with this.
thanks,sorry for my inglish