本文整理汇总了PHP中Mage_Core_Model_Resource_Setup::setConfigData方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Core_Model_Resource_Setup::setConfigData方法的具体用法?PHP Mage_Core_Model_Resource_Setup::setConfigData怎么用?PHP Mage_Core_Model_Resource_Setup::setConfigData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Core_Model_Resource_Setup
的用法示例。
在下文中一共展示了Mage_Core_Model_Resource_Setup::setConfigData方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testSetDeleteConfigData
public function testSetDeleteConfigData()
{
$select = $this->_model->getConnection()->select()->from($this->_model->getTable('core_config_data'), 'value')->where('path=?', 'my/test/path');
$this->_model->setConfigData('my/test/path', 'test_value');
$this->assertEquals('test_value', $this->_model->getConnection()->fetchOne($select));
$this->_model->deleteConfigData('my/test/path', 'test');
$this->assertNotEmpty($this->_model->getConnection()->fetchRow($select));
$this->_model->deleteConfigData('my/test/path');
$this->assertEmpty($this->_model->getConnection()->fetchRow($select));
}
示例2: installDb
/**
* Database installation
*
* @return Mage_Install_Model_Installer
*/
public function installDb()
{
Mage_Core_Model_Resource_Setup::applyAllUpdates();
$data = $this->getDataModel()->getConfigData();
/**
* Saving host information into DB
*/
$setupModel = new Mage_Core_Model_Resource_Setup('core_setup');
if (!empty($data['use_rewrites'])) {
$setupModel->setConfigData(Mage_Core_Model_Store::XML_PATH_USE_REWRITES, 1);
}
$unsecureBaseUrl = Mage::getBaseUrl('web');
if (!empty($data['unsecure_base_url'])) {
$unsecureBaseUrl = $data['unsecure_base_url'];
$setupModel->setConfigData(Mage_Core_Model_Store::XML_PATH_UNSECURE_BASE_URL, $unsecureBaseUrl);
}
if (!empty($data['use_secure'])) {
$setupModel->setConfigData(Mage_Core_Model_Store::XML_PATH_SECURE_IN_FRONTEND, 1);
$setupModel->setConfigData(Mage_Core_Model_Store::XML_PATH_SECURE_BASE_URL, $data['secure_base_url']);
if (!empty($data['use_secure_admin'])) {
$setupModel->setConfigData(Mage_Core_Model_Store::XML_PATH_SECURE_IN_ADMINHTML, 1);
}
} elseif (!empty($data['unsecure_base_url'])) {
$setupModel->setConfigData(Mage_Core_Model_Store::XML_PATH_SECURE_BASE_URL, $unsecureBaseUrl);
}
/**
* Saving locale information into DB
*/
$locale = Mage::getSingleton('install/session')->getLocaleData();
if (!empty($locale['locale'])) {
$setupModel->setConfigData(Mage_Core_Model_Locale::XML_PATH_DEFAULT_LOCALE, $locale['locale']);
}
if (!empty($locale['timezone'])) {
$setupModel->setConfigData(Mage_Core_Model_Locale::XML_PATH_DEFAULT_TIMEZONE, $locale['timezone']);
}
if (!empty($locale['currency'])) {
$setupModel->setConfigData(Mage_Directory_Model_Currency::XML_PATH_CURRENCY_BASE, $locale['currency']);
$setupModel->setConfigData(Mage_Directory_Model_Currency::XML_PATH_CURRENCY_DEFAULT, $locale['currency']);
$setupModel->setConfigData(Mage_Directory_Model_Currency::XML_PATH_CURRENCY_ALLOW, $locale['currency']);
}
return $this;
}
示例3: setSponsor
public function setSponsor()
{
Mage::helper('mercadopago')->log("Sponsor_id: " . Mage::getStoreConfig('payment/mercadopago/sponsor_id'), 'mercadopago.log');
$sponsor_id = "";
Mage::helper('mercadopago')->log("Valid user test", 'mercadopago.log');
$client_id = Mage::getStoreConfig('payment/mercadopago/client_id');
Mage::helper('mercadopago')->log("Get client id: " . $client_id, 'mercadopago.log');
$client_secret = Mage::getStoreConfig('payment/mercadopago/client_secret');
Mage::helper('mercadopago')->log("Get client secret: " . $client_secret, 'mercadopago.log');
$mp = new MP($client_id, $client_secret);
$user = $mp->get("/users/me");
Mage::helper('mercadopago')->log("API Users response", 'mercadopago.log', $user);
//caso api retorne 403 (error no get) verifica se a mensagem e do usuario com test credentials
if ($user['status'] == 200 && !in_array("test_user", $user['response']['tags'])) {
$sponsor_id = 1;
$country = Mage::getStoreConfig('payment/mercadopago/country');
switch ($user['response']['site_id']) {
case 'MLA':
$sponsor_id = 186172525;
break;
case 'MLB':
$sponsor_id = 186175129;
break;
case 'MLM':
$sponsor_id = 186175064;
break;
default:
$sponsor_id = "";
break;
}
Mage::helper('mercadopago')->log("Sponsor id setted", 'mercadopago.log', $sponsor_id);
}
$core = new Mage_Core_Model_Resource_Setup('core_setup');
$core->setConfigData('payment/mercadopago/sponsor_id', $sponsor_id);
Mage::helper('mercadopago')->log("Sponsor saved", 'mercadopago.log', $sponsor_id);
}
示例4: installDb
/**
* Database installation
*
* @return Mage_Install_Model_Installer
*/
public function installDb()
{
Mage_Core_Model_Resource_Setup::applyAllUpdates();
$data = $this->getDataModel()->getConfigData();
/**
* Saving host information into DB
*/
$setupModel = new Mage_Core_Model_Resource_Setup('core_setup');
if (!empty($data['use_rewrites'])) {
$setupModel->setConfigData(Mage_Core_Model_Store::XML_PATH_USE_REWRITES, 1);
}
if (!empty($data['enable_charts'])) {
$setupModel->setConfigData(Mage_Adminhtml_Block_Dashboard::XML_PATH_ENABLE_CHARTS, 1);
} else {
$setupModel->setConfigData(Mage_Adminhtml_Block_Dashboard::XML_PATH_ENABLE_CHARTS, 0);
}
if (!empty($data['admin_no_form_key'])) {
$setupModel->setConfigData('admin/security/use_form_key', 0);
}
$unsecureBaseUrl = Mage::getBaseUrl('web');
if (!empty($data['unsecure_base_url'])) {
$unsecureBaseUrl = $data['unsecure_base_url'];
$setupModel->setConfigData(Mage_Core_Model_Store::XML_PATH_UNSECURE_BASE_URL, $unsecureBaseUrl);
}
if (!empty($data['use_secure'])) {
$setupModel->setConfigData(Mage_Core_Model_Store::XML_PATH_SECURE_IN_FRONTEND, 1);
$setupModel->setConfigData(Mage_Core_Model_Store::XML_PATH_SECURE_BASE_URL, $data['secure_base_url']);
if (!empty($data['use_secure_admin'])) {
$setupModel->setConfigData(Mage_Core_Model_Store::XML_PATH_SECURE_IN_ADMINHTML, 1);
}
} elseif (!empty($data['unsecure_base_url'])) {
$setupModel->setConfigData(Mage_Core_Model_Store::XML_PATH_SECURE_BASE_URL, $unsecureBaseUrl);
}
/**
* Saving locale information into DB
*/
$locale = $this->getDataModel()->getLocaleData();
if (!empty($locale['locale'])) {
$setupModel->setConfigData(Mage_Core_Model_Locale::XML_PATH_DEFAULT_LOCALE, $locale['locale']);
}
if (!empty($locale['timezone'])) {
$setupModel->setConfigData(Mage_Core_Model_Locale::XML_PATH_DEFAULT_TIMEZONE, $locale['timezone']);
}
if (!empty($locale['currency'])) {
$setupModel->setConfigData(Mage_Directory_Model_Currency::XML_PATH_CURRENCY_BASE, $locale['currency']);
$setupModel->setConfigData(Mage_Directory_Model_Currency::XML_PATH_CURRENCY_DEFAULT, $locale['currency']);
$setupModel->setConfigData(Mage_Directory_Model_Currency::XML_PATH_CURRENCY_ALLOW, $locale['currency']);
}
if (!empty($data['order_increment_prefix'])) {
$this->_setOrderIncrementPrefix($setupModel, $data['order_increment_prefix']);
}
return $this;
}
示例5: exit
// Don't remove this
$_SERVER['SCRIPT_NAME'] = str_replace(basename(__FILE__), 'index.php', $_SERVER['SCRIPT_NAME']);
$_SERVER['SCRIPT_FILENAME'] = str_replace(basename(__FILE__), 'index.php', $_SERVER['SCRIPT_FILENAME']);
Mage::app('admin')->setUseSessionInUrl(false);
umask(0);
try {
$setup = new Mage_Core_Model_Resource_Setup('write');
$csv = new Varien_File_Csv();
if (empty($_SERVER['argv'][1])) {
echo "Please set file path as a parameter.";
exit(1);
}
$file = $_SERVER['argv'][1];
$winAbsolute = substr($file, 1, 1) !== ':';
if (ltrim($file, '\\/') == $file && $winAbsolute) {
$file = realpath(__DIR__ . DIRECTORY_SEPARATOR . $file);
}
if (!file_exists($file)) {
echo "File '{$file}' does not exist.";
exit(1);
}
$data = $csv->getData($file);
foreach ($data as $row) {
if (isset($row[0]) && isset($row[1])) {
$setup->setConfigData($row[0], trim($row[1]));
}
}
} catch (Exception $e) {
Mage::printException($e);
exit(1);
}