I am trying to create a simple module in order to add customer comments at checkout, I know there are a few freebies on the market that already do this but I need to further extend the functionality so decided to go about it from scratch.
The problem is I cannot even get my install script to run and create the necessary tables. I've been revising the code for hours but cannot get it to work!!!
Any help would be much welcomed...
config.xml
<?xml version="1.0"?>
<config>
<modules>
<Namespace_CheckoutComments>
<version>0.1.0</version>
</Namespace_CheckoutComments>
</modules>
<global>
<resources>
<checkoutcomments_setup>
<setup>
<module>Namespace_CheckoutComments</module>
</setup>
</checkoutcomments_setup>
</resources>
<models>
<checkoutcomments>
<class>Namespace_CheckoutComments_Model</class>
<resourceModel>checkoutcomments_resource</resourceModel>
</checkoutcomments>
<checkoutcomments_resource>
<class>Namespace_CheckoutComments_Model_Resource</class>
<entities>
<comments_table>
<table>checkout_comments</table>
</comments_table>
</entities>
</checkoutcomments_resource>
</models>
</global>
</config>
sql/namespace_checkoutcomments_setup/install-0.1.0.php
<?php
/* @var $installer Mage_Core_Model_Resource_Setup */
$installer = $this;
$installer->startSetup();
$table = $installer->getConnection()->newTable($installer->getTable('checkoutcomments/comments_table'))
->addColumn('comment_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
'identity' => true,
'unsigned' => true,
'nullable' => false,
'primary' => true,
), 'Comment ID')
->addColumn('order_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
'unsigned' => true,
'nullable' => false,
), 'Real Order ID')
->addColumn('comment', Varien_Db_Ddl_Table::TYPE_INTEGER, '64k', array(
), 'Comment')
->addForeignKey(
$installer->getFkName(
'checkoutcomments/comments_table',
'order_id',
'sales/order',
'entity_id'
),
'order_id', $installer->getTable('sales/order'), 'entity_id',
Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE)
->setComment('Checkout Comments');
$installer->getConnection()->createTable($table);
$installer->endSetup();
I have no idea what is wrong with either my install script or my config.xml. What would be the main reason for this not to execute and create the required tables?
+-------------------------+------------+--------------+
| code | version | data_version |
+-------------------------+------------+--------------+
| adminnotification_setup | 1.6.0.0 | 1.6.0.0 |
| admin_setup | 1.6.1.1 | 1.6.1.1 |
| api2_setup | 1.0.0.0 | 1.0.0.0 |
| api_setup | 1.6.0.1 | 1.6.0.1 |
| backup_setup | 1.6.0.0 | 1.6.0.0 |
| bundle_setup | 1.6.0.0.1 | 1.6.0.0.1 |
| captcha_setup | 1.7.0.0.0 | 1.7.0.0.0 |
| catalogindex_setup | 1.6.0.0 | 1.6.0.0 |
| cataloginventory_setup | 1.6.0.0.2 | 1.6.0.0.2 |
| catalogrule_setup | 1.6.0.3 | 1.6.0.3 |
| catalogsearch_setup | 1.6.0.0 | 1.6.0.0 |
| catalog_setup | 1.6.0.0.18 | 1.6.0.0.18 |
| checkoutcomments_setup | 0.0.1 | 0.0.1 |
| checkout_setup | 1.6.0.0 | 1.6.0.0 |