在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的档案中) 我收到一份所有支付方法的冰名单。