2013-05-04 25 views
1

最近我创建了自定义的magento扩展,我想发布它,但是我发现installtion文件没有安装。mysql4-install-1.0.0.php文件不能用于Mageno 1.5

安装文件未创建表。

我有以下config.xml中

<?xml version="1.0" ?> 
<config> 
    <modules> 
     <Tricore_Contactus> 
      <version>1.0.0</version> 
     </Tricore_Contactus> 
    </modules> 
. 
. 
. 
</config> 

代码我已经创建了内部扩展SQL \ contactus_setup文件夹mysql4安装-1.0.0.php文件,下面的代码。

$installer = $this; 
$installer->startSetup(); 

$installer->run(" 
    INSERT INTO ".Mage::getConfig()->getTablePrefix()."core_email_template VALUES 
    (NULL, 'Tricore Contact us', 'Name: {{var data.name}}\r\nE-mail: {{var data.email}}\r\nTelephone: {{var data.mobilenumber}}\r\n\r\nComment: {{var data.message}}', NULL, 1, 'Contact Form', NULL, NULL, NULL, '2013-04-23 11:04:45', 'contacts_email_email_template', '{\"var data.name\":\"Sender Name\",\"var data.email\":\"Sender Email\",\"var data.telephone\":\"Sender Telephone\",\"var data.comment\":\"Comment\"}'), 
    (NULL, 'Tricore Auto Respond', 'Dear {{var data.name}}\r\n\r\nWe have got your submitted information.\r\n\r\nE-mail: {{var data.email}}\r\nelephone: {{var data.mobilenumber}}\r\n\r\nComment: {{var data.message}}\r\n\r\nOur representative will respond you soon.\r\n', NULL, 1, 'Autoreply ', NULL, NULL, NULL, '2013-04-23 11:07:46', 'contacts_email_email_template', '{\"var data.name\":\"Sender Name\",\"var data.email\":\"Sender Email\",\"var data.telephone\":\"Sender Telephone\",\"var data.comment\":\"Comment\"}'); 
"); 
$installer->endSetup(); 

当扩展程序安装它时,将条目添加到core_resource表中,但它不会将reocrd插入到core_email_template表中。

有时它不会调用mysql4-install-1.0.0.php文件。 enter code here

请帮忙。

谢谢

回答

2

你发布的一切似乎都是正确的。 因此,也许你忘记了以下http://www.magentocommerce.com/knowledge-base/entry/magento-for-dev-part-6-magento-setup-resources

在你的情况下,XML将是:

<global> 
    <!-- ... --> 
    <resources> 
     <contactus_setup> 
      <setup> 
       <module>Tricore_Contactus</module> 
       <class>Mage_Eav_Model_Entity_Setup</class> 
      </setup> 
     </contactus_setup> 
     <contactus_write> 
      <connection> 
       <use>core_write</use> 
      </connection> 
     </contactus_write> 
     <contactus_read> 
      <connection> 
       <use>core_read</use> 
      </connection> 
     </contactus_read> 
    </resources> 
    <!-- ... --> 
</global> 

而且在旁注: 用于调试那些我在添加一个芯片(“SQL-脚本运行”) mysql4 -... php的底部,所以我可以肯定,代码至少是被执行的 - 如果sql只是没有得到应用,我可以打F5直到它工作(相比之下,更改core_resources条目所有的时间)..如果“死”不显示你可以肯定,你的XML是问题