English 中文(简体)
Magento 安装习惯单元期间的库存杂质
原标题:Magento Store config strange behavior during custom module installation

在Magento安装习俗模块时,是否限制进入储存配置? 这里的问题是

我有安装文字:

    <?php
    $installer = $this;
    $installer->startSetup();
    $installer->run("
    DROP TABLE IF EXISTS {$this->getTable( userpaymentban )};
    CREATE  TABLE IF NOT EXISTS {$this->getTable( userpaymentban )} (
      `ban_id` INT NOT NULL AUTO_INCREMENT ,
      `user_id` INT NOT NULL ,
      `paymentmethod_id` VARCHAR(200) NOT NULL ,
      `store_id` INT NOT NULL ,
      PRIMARY KEY (`ban_id`) )
    ENGINE = InnoDB
    DEFAULT CHARACTER SET = utf8
    COLLATE = utf8_general_ci;");
    $defaultNotBannedPaymentMethods = array();
    $paymentMethods = Mage::getSingleton( payment/config )->getAllMethods();

问题是科索沃,但最后是扔 some一些大事的原因:

    Error in file: "/var/www/magentotest/magento161/app/code/local/Alpha/Userpaymentban/sql/userpaymentban_setup/mysql4-install-0.1.0.php" - Warning: Invalid argument supplied for foreach()  in /var/www/magentotest/magento161/app/code/core/Mage/Payment/Model/Config.php on line 76

    #0 /var/www/magentotest/magento161/app/code/core/Mage/Core/Model/Resource/Setup.php(645): Mage::exception( Mage_Core ,  Error in file: ... )
    #1 /var/www/magentotest/magento161/app/code/core/Mage/Core/Model/Resource/Setup.php(421): Mage_Core_Model_Resource_Setup->_modifyResourceDb( install ,   ,  0.1.0 )
    #2 /var/www/magentotest/magento161/app/code/core/Mage/Core/Model/Resource/Setup.php(327): Mage_Core_Model_Resource_Setup->_installResourceDb( 0.1.0 )
    #3 /var/www/magentotest/magento161/app/code/core/Mage/Core/Model/Resource/Setup.php(235): Mage_Core_Model_Resource_Setup->applyUpdates()
    #4 /var/www/magentotest/magento161/app/code/core/Mage/Core/Model/App.php(412): Mage_Core_Model_Resource_Setup::applyAllUpdates()
    #5 /var/www/magentotest/magento161/app/code/core/Mage/Core/Model/App.php(338): Mage_Core_Model_App->_initModules()
    #6 /var/www/magentotest/magento161/app/Mage.php(640): Mage_Core_Model_App->run(Array)
    #7 /var/www/magentotest/magento161/index.php(80): Mage::run(  ,  store )
    #8 {main}

例外情况载于<代码>。 Mage_Payment_Model_Config in Code:

    public function getAllMethods($store=null)
{
    $methods = array();
    $config = Mage::getStoreConfig( payment , $store);
echo "<pre>";
var_dump($config);
echo "</pre>";
    foreach ($config as $code => $methodConfig) {
        $data = $this->_getMethod($code, $methodConfig);
        if (false !== $data) {
            $methods[$code] = $data;
        }
    }
    return $methods;
}

你可以看到,我已经增加了一些行乞守则,但我从这部守则中收到的所有东西都只是NUL

我的Magento是OK(我认为),因为当我使用<代码>Mage:getSingleton(付款/汇票)->getAllMethods()超出模块安装范围(在进口<代码>app/Mage.php的档案中) 我收到一份所有支付方法的冰名单。

最佳回答

Ha, I m总会寻找理由,证明我的Magento U学生有data>-install/up levels 字母,这是另一个伟大的例子。

如果您对初始化过程(从Mage:run(<> in index.php)进行考察,请迅速到达。 Mage_Core_Model_App:run()。 在座各位请上<代码>_initModules()。 从这一方法来看,“常规”安装/更新级文字的操作(通过<条码>Mage_Core_Model_Resource_Setup:apply AllUpdates()。 后来载于<代码>。 Mage_Core_Model_App:run(<> is a calls to Mage_Core_Model_Resource_Setup:apply AllDataUpdates(。 这就是数据工具/数据级字母的运行情况,其just after<>。 储存物体通过<代码>_initCurrentStore()入选。

That seems to be the purpose of the so-called data scripts - you get the store object with its configuration loaded.

这些文字与“普通”装置/级字母相类似,唯一的区别是,文档名称为:sql4-data-[instversion(archs))-[[[E<)].php; 1.6和E < 1.11. 关于1.6/1.11和附件,数据说明丢失了我的sql4序号,并放在了你的模块目录下(例如见/code dir)。

问题回答

暂无回答




相关问题
Working with modules in IntelliJ IDEA

As I understand, using modules allows us to control some dependencies. I mean that we can allow one module to interact with another one but not vise versa. We also can make some reusable things and ...

Module import path

I m unable to test-run a cssparser that I d like to use. test.py: from css.parse import parse data = """ em { padding: 2px; margin: 1em; border-width: medium; border-style: ...

Problem modulating action script project

I am refactoring a hugh action script solution in Flash builder (beta 2) using the flex 4 sdk. The project does NOT use the mx framework. What i want to have is: A big MAIN project several small ...

Test modules with Test::Unit

I encountered a problem when trying to test a module with Test::Unit. What I used to do is this: my_module.rb: class MyModule def my_func 5 # return some value end end test_my_module.rb: ...

Drupal section accessible by role

I need to limit access of content on Drupal site based on the Drupal User s Role. http://site.com/managers/intro http://site.com/managers/reviews http://site.com/managers/up-for-raises The ...

How to find where a function was imported from in Python?

I have a Python module with a function in it: == bar.py == def foo(): pass == EOF == And then I import it into the global namespace like so: from bar import * So now the function foo is ...

How to wire two modules in Verilog?

I have written two modules DLatch and RSLatch and i want to write verilog code to join those two.