0

我无法让 magento 终生执行我的 sql 设置。我以前做过这个没有问题,但是这个应用程序有它自己的想法,因为它现在不想这样做。这是我到目前为止所做的。

应用程序/代码/本地/命名空间/模块/etc/config.xml

<config>
    <modules>
        <namespace_module>
            <version>0.0.1</version>
        </namespace_module>
    </modules>
    <global>
        <resources>
            <module_setup>
                <setup>
                    <module>Namespace_Module</module>
                    <class>Namespace_Module_Model_Resource_Setup</class>
                </setup>
            </module_setup>
        </resources>
    </global>
</config>

应用程序/代码/本地/命名空间/模块/模型/资源/Setup.php

<?php
class Namespace_Module_Model_Resource_Setup extends Mage_Core_Model_Resource_Setup {


}

app/code/local/Namespace/Module/sql/module_setup/mysql4-install-0.0.1.php

<?php
/**
 * Magento Enterprise Edition
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Magento Enterprise Edition License
 * that is bundled with this package in the file LICENSE_EE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://www.magentocommerce.com/license/enterprise-edition
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magentocommerce.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magentocommerce.com for more information.
 *
 * @category    Mage
 * @package     Mage_Catalog
 * @copyright   Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
 * @license     http://www.magentocommerce.com/license/enterprise-edition
 */

$installer = $this;
/* @var $installer Mage_Catalog_Model_Resource_Eav_Mysql4_Setup */

$installer->startSetup();

if (!$installer->tableExists($installer->getTable('namespace_module_table'))) {
    $installer->run("
    create table namespace_module_table (
        postal_code char(5) primary key,
        north_east_bound_lat varchar(64),
        north_east_bound_lng,
        namespace_module_address varchar(64),
        time_zone_id varchar(30)
    );
    ");
}

$installer->endSetup();

因此,我能够让 magento 识别我的 Setup.php 文件,因为它曾一度引发错误,但我修复了这个问题。但是当我检查 core_resources 时,我没有看到我的模块设置..

我已禁用所有缓存并刷新 magentos 缓存和存储缓存。并禁用和启用我的app/etc/modules/Namespace_Module.xml

请记住,这个模块功能齐全,只是没有我想要做的安装程序。我只是给了你安装这个东西的最低限度。

4

1 回答 1

0

弄清楚了...

<config>
    <modules>
        <namespace_module>
            <version>0.0.1</version>
        </namespace_module>
    </modules>
</config>

需要是...

<config>
    <modules>
        <Namespace_Module>
            <version>0.0.1</version>
        </Namespace_Module>
    </modules>
</config>

您的模块命名空间和模块名称需要与模块命名空间和模块名称目录结构相匹配。

于 2013-06-03T16:07:45.233 回答