magento sql脚本无法正常工作?

时间:2015-10-21 12:14:26

标签: php mysql sql xml magento

尝试构建我的第一个magento插件,我仍然是结构和编码的新手。现在问题是我的数据库表没有被创建。我不知道为什么我的数据库表没有被创建。我尝试了很多教程和堆栈流程,仍然无法弄清楚。任何帮助

继承我的config.xml

<?php

$installer = $this;

$installer->startSetup();

$installer->run("

-- DROP TABLE IF EXISTS {$this->getTable('nfrsuper_awesome_example')};
CREATE TABLE {$this->getTable('nfrsuper_awesome_example')} (
  `id` int(11) unsigned NOT NULL auto_increment,
  `name` varchar(100) NOT NULL,
  `description` varchar(100) NOT NULL,
  `other` varchar(100) NOT NULL,
  PRIMARY KEY (`id`)
 ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

INSERT INTO {$this->getTable('nfrsuper_awesome_example')} (name, description, other) values ('Example 1', 'Example One Description', 'This first example is reall awesome.');
INSERT INTO {$this->getTable('nfrsuper_awesome_example')} (name, description, other) values ('Example 2', 'Example Two Description', 'This second example is reall awesome.');
INSERT INTO {$this->getTable('nfrsuper_awesome_example')} (name, description, other) values ('Example 3', 'Example Three Description', 'This third example is reall awesome.');
INSERT INTO {$this->getTable('nfrsuper_awesome_example')} (name, description, other) values ('Example 4', 'Example Four Description', 'This fourth example is reall awesome.');

");

$installer->endSetup();

继承我的安装程序脚本

patch.get_bbox().get_points()

1 个答案:

答案 0 :(得分:1)

您的config.xml搞砸了...... 资源属于 global 这样的

<?xml version = "1.0"?>
<config>
    <modules>
        <Envato_CustomConfig>
            <version>0.0.1</version>
        </Envato_CustomConfig>
    </modules>
    <global>
        <helpers>
            <customconfig>
                <class>Envato_CustomConfig_Helper</class>
            </customconfig>
        </helpers>
        <models>
            <customconfig>
                <class>Envato_CustomConfig_Model</class>
            </customconfig>
        </models>
        <resources>
            <customconfig_setup>
                <setup>
                    <module>Envato_CustomConfig</module>
                </setup>
                <connection>
                    <use>core_setup</use>
                </connection>
            </customconfig_setup>
            <customconfig_write>
                <connection>
                    <use>core_write</use>
                </connection>
            </customconfig_write>
            <customconfig_read>
                <connection>
                    <use>core_read</use>
                </connection>
            </customconfig_read>
        </resources>
    </global>
    <adminhtml>
        <acl>
            <admin>
                <children>
                    <system>
                        <children>
                            <config>
                                <children>
                                    <customconfig_options>
                                        <title>Email Configuration Section</title>
                                    </customconfig_options>
                                </children>
                            </config>
                        </children>
                    </system>
                </children>
            </admin>
        </acl>
    </adminhtml>
</config>