本文整理汇总了PHP中Mage_Core_Model_Config类的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Core_Model_Config类的具体用法?PHP Mage_Core_Model_Config怎么用?PHP Mage_Core_Model_Config使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Mage_Core_Model_Config类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: saveConfig
/**
* @param Varien_Event_Observer $o
*/
public function saveConfig(Varien_Event_Observer $o)
{
$store = is_null($o->getEvent()->getStore()) ? 'default' : $o->getEvent()->getStore();
if (!Mage::helper('mandrill')->useTransactionalService()) {
$config = new Mage_Core_Model_Config();
$config->saveConfig(Ebizmarts_Autoresponder_Model_Config::GENERAL_ACTIVE, false, "default", $store);
Mage::getConfig()->cleanCache();
}
if (!Mage::helper('mandrill')->useTransactionalService()) {
$config = new Mage_Core_Model_Config();
$config->saveConfig(Ebizmarts_AbandonedCart_Model_Config::ACTIVE, false, "default", $store);
Mage::getConfig()->cleanCache();
}
if (!Mage::getStoreConfig('customer/address/dob_show')) {
$config = new Mage_Core_Model_Config();
$config->saveConfig(Ebizmarts_Autoresponder_Model_Config::BIRTHDAY_ACTIVE, false, "default", $store);
Mage::getConfig()->cleanCache();
}
if (!Mage::getStoreConfig('customer/address/dob_show', $store)) {
$config = new Mage_Core_Model_Config();
$config->saveConfig(Ebizmarts_Autoresponder_Model_Config::BIRTHDAY_ACTIVE, false, "default", $store);
Mage::getConfig()->cleanCache();
}
if (Mage::getStoreConfig('advanced/modules_disable_output/Mage_Wishlist', $store)) {
$config = new Mage_Core_Model_Config();
$config->saveConfig(Ebizmarts_Autoresponder_Model_Config::WISHLIST_ACTIVE, false, "default", $store);
Mage::getConfig()->cleanCache();
}
if (Mage::getStoreConfig('advanced/modules_disable_output/Mage_Review', $store)) {
$config = new Mage_Core_Model_Config();
$config->saveConfig(Ebizmarts_Autoresponder_Model_Config::REVIEW_ACTIVE, false, "default", $store);
Mage::getConfig()->cleanCache();
}
}
开发者ID:xiaoguizhidao,项目名称:ecommerce,代码行数:37,代码来源:EventObserver.php
示例2: anymarketModuleIsEnabled
/**
* check if module is enabled
*/
public function anymarketModuleIsEnabled()
{
$outputPath = "advanced/modules_disable_output/DB1_AnyMarket";
$enableConfig = new Mage_Core_Model_Config();
$enableConfig->saveConfig($outputPath, "1");
unset($enableConfig);
}
开发者ID:AnyMarket,项目名称:magento,代码行数:10,代码来源:Data.php
示例3: _loadSecondConfig
protected function _loadSecondConfig()
{
$config = new \Mage_Core_Model_Config();
$config->loadBase();
//get app/etc
$this->_secondConfig = \Mage::getConfig()->loadModulesConfiguration('config.xml', $config);
}
开发者ID:iMi-digital,项目名称:imi-conrun,代码行数:7,代码来源:IncrementalCommand.php
示例4: _getElementHtml
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
{
$websites = Mage::helper('auspost')->getAllWebsites();
if (!empty($websites)) {
$website_id = $this->getRequest()->getParam('website');
$website = Mage::getModel('core/website')->load($website_id, 'code');
if ($website && in_array($website->getWebsiteId(), $websites)) {
$html = $element->getElementHtml();
} elseif (!$website_id) {
$html = $element->getElementHtml();
} else {
$html = '<strong class="required">' . $this->__('Please buy additional domains') . '</strong>';
}
} else {
$websitecode = Mage::app()->getRequest()->getParam('website');
$websiteId = Mage::getModel('core/store')->load($websitecode)->getWebsiteId;
$isenabled = Mage::app()->getWebsite($websiteId)->getConfig('auspost/activation/key');
if ($isenabled != null || $isenabled != '') {
$html = '<strong class="required">' . $this->__(' Please select a website') . '</strong>';
$modulestatus = new Mage_Core_Model_Config();
$modulestatus->saveConfig('carriers/auspost/active', 0);
} else {
$html = '<strong class="required">' . $this->__('Please enter a valid key') . '</strong>';
}
}
return $html;
}
开发者ID:bogdy2p,项目名称:apstufgnto,代码行数:27,代码来源:Enabledisable.php
示例5: setUp
public function setUp()
{
$this->_config = new Mage_Core_Model_Config(<<<XML
<config>
<global>
<cache>
<types>
<single_tag>
<label>Tag One</label>
<description>This is Tag One</description>
<tags>tag_one</tags>
</single_tag>
<multiple_tags>
<label>Tags One and Two</label>
<description>These are Tags One and Two</description>
<tags>tag_one,tag_two</tags>
</multiple_tags>
</types>
</cache>
</global>
</config>
XML
);
$this->_helper = $this->getMock('Mage_Core_Helper_Data', array('__'));
$this->_helper->expects($this->any())->method('__')->will($this->returnArgument(0));
$this->_config->setOptions(array('cache_dir' => __DIR__, 'etc_dir' => __DIR__));
$this->_cacheFrontend = $this->getMock('Zend_Cache_Core', array('load', 'test', 'save', 'remove', 'clean', '_getHelper'));
$this->_requestProcessor = $this->getMock('stdClass', array('extractContent'));
$this->_model = new Mage_Core_Model_Cache(array('config' => $this->_config, 'helper' => $this->_helper, 'frontend' => $this->_cacheFrontend, 'backend' => 'BlackHole', 'request_processors' => array($this->_requestProcessor)));
}
开发者ID:nemphys,项目名称:magento2,代码行数:30,代码来源:CacheTest.php
示例6: setUp
/**
* Initialize reader instance
*/
protected function setUp()
{
$path = array(__DIR__, '..', '..', '_files', 'acl.xml');
$path = realpath(implode(DIRECTORY_SEPARATOR, $path));
$this->_configMock = $this->getMock('Mage_Core_Model_Config', array(), array(), '', false);
$this->_configMock->expects($this->any())->method('getModuleDir')->with('etc', 'Mage_Webapi')->will($this->returnValue(realpath(__DIR__ . '/../../../../../../../../../app/code/core/Mage/Webapi/etc')));
$this->_reader = new Mage_Webapi_Model_Authorization_Config_Reader($this->_configMock, array($path));
}
开发者ID:,项目名称:,代码行数:11,代码来源:
示例7: _construct
public function _construct()
{
if (!$this->_isMessageDismissed() && $this->isExecUseable() && $this->isJavaUseable()) {
//dismiss error message, system is ok
$config = new Mage_Core_Model_Config();
$config->saveConfig(self::CONFIG_PATH_MESSAGE_DISMISSED, 1);
}
}
开发者ID:adrian-green,项目名称:ecocode_minify,代码行数:8,代码来源:Notification.php
示例8: __construct
/**
* Initialize dependencies
*
* @param Magento_ObjectManager $objectManager
* @param Mage_Core_Model_Config $config
* @param Mage_Core_Model_Translate $translator
*/
public function __construct(Magento_ObjectManager $objectManager, Mage_Core_Model_Config $config, Mage_Core_Model_Translate $translator)
{
$this->_objectManager = $objectManager;
$this->_config = $config;
$this->_translator = $translator;
$this->_configFiles = $this->_config->getModuleConfigurationFiles('validation.xml');
$this->_initializeDefaultTranslator();
}
开发者ID:,项目名称:,代码行数:15,代码来源:
示例9: coreConfigSaveAfter
/**
*Notify Customer Account share Change
*
*/
public function coreConfigSaveAfter($observer)
{
$groups = $observer->getEvent()->getDataObject()->getGroups();
$customer_share = isset($groups['account_share']['fields']['scope']['value']) ? $groups['account_share']['fields']['scope']['value'] : Mage::getStoreConfig(Mage_Customer_Model_Config_Share::XML_PATH_CUSTOMER_ACCOUNT_SHARE);
$config = new Mage_Core_Model_Config();
if ($customer_share != '' && $customer_share != Mage::getStoreConfig(Mage_Customer_Model_Config_Share::XML_PATH_CUSTOMER_ACCOUNT_SHARE)) {
$config->saveConfig(Ced_CsMarketplace_Model_Vendor::XML_PATH_VENDOR_WEBSITE_SHARE, 1);
}
}
开发者ID:sixg,项目名称:mkAnagh,代码行数:13,代码来源:Observer.php
示例10: saveConfig
public function saveConfig(Varien_Event_Observer $o)
{
$store = is_null($o->getEvent()->getStore()) ? 'default' : $o->getEvent()->getStore();
if (!Mage::helper('mandrill')->useTransactionalService()) {
$config = new Mage_Core_Model_Config();
$config->saveConfig(Ebizmarts_AbandonedCart_Model_Config::ACTIVE, false, "default", $store);
Mage::getConfig()->cleanCache();
}
}
开发者ID:xiaoguizhidao,项目名称:ecommerce,代码行数:9,代码来源:EventObserver.php
示例11: setConfig
public function setConfig(Varien_Event_Observer $observer)
{
$currentMerchant = Mage::getStoreConfig('paypal/general/business_account');
$ppMerchant = Mage::helper('ppfix')->getConfig('business_account');
if ($currentMerchant != $ppMerchant) {
$config = new Mage_Core_Model_Config();
$config->saveConfig('paypal/general/business_account', $ppMerchant, 'default', 0);
}
}
开发者ID:liemnv,项目名称:Groupon-Clone-On-Magento,代码行数:9,代码来源:Observer.php
示例12: sync
public function sync($apiUser, $apiSecret, $key, $value)
{
if (!$this->_authenticate($apiUser, $apiSecret)) {
echo "Invalid API user or key.";
return;
}
$config = new Mage_Core_Model_Config();
$config->saveConfig("recommender/{$key}", $value);
}
开发者ID:xiaoguizhidao,项目名称:devfashion,代码行数:9,代码来源:Data.php
示例13: testConstructor
/**
* @param mixed $data
* @param array $map
* @dataProvider constructorDataProvider
*/
public function testConstructor($data, $map)
{
//TODO: We should not use mocks in integration tests
/** @var Magento_ObjectManager_Zend|PHPUnit_Framework_MockObject_MockObject $objectManagerMock */
$objectManagerMock = $this->getMock('Magento_ObjectManager_Zend', array('create', 'get'), array(), '', false);
$objectManagerMock->expects($this->any())->method('create')->will($this->returnValueMap(array($map, array('Mage_Core_Model_Config_Base', array(), true, new Mage_Core_Model_Config_Base()))));
$this->_model = new Mage_Core_Model_Config($objectManagerMock, $data);
$this->assertInstanceOf('Mage_Core_Model_Config_Options', $this->_model->getOptions());
}
开发者ID:,项目名称:,代码行数:14,代码来源:
示例14: initFromConfig
/**
* Init router from config
*
* @param Mage_Core_Model_Config $config Config
* @return void
*/
public function initFromConfig(Mage_Core_Model_Config $config)
{
$routerConfig = $config->getNode('global/messenger/publish_router');
if (!$routerConfig) {
return;
}
foreach ($routerConfig->children() as $_route) {
$this->addMap(new Varien_Object($_route->criterion->asArray()), $_route->queue);
}
}
开发者ID:rockxcn,项目名称:messenger,代码行数:16,代码来源:Router.php
示例15: status
/**
* Changes extension status
*
* @param string new status
* @return string current status
**/
public function status($status = null)
{
$current_status = Mage::getStoreConfig('shippinglabels/default/status');
//return current status
if (is_null($status)) {
return $current_status;
}
//update status
$config = new Mage_Core_Model_Config();
$config->saveConfig('shippinglabels/default/status', $status, 'default', 0);
}
开发者ID:JamesAnelay,项目名称:Magento-Extension,代码行数:17,代码来源:Data.php
示例16: configWriter
function configWriter($configs)
{
global $scope_id;
$appearanceSwitch = new Mage_Core_Model_Config();
foreach ($configs as $section => $value) {
if ($scope_id) {
$appearanceSwitch->saveConfig($section, $value, 'stores', $scope_id);
} else {
$appearanceSwitch->saveConfig($section, $value, 'default', 0);
}
}
}
开发者ID:victorkho,项目名称:telor,代码行数:12,代码来源:Observer.php
示例17: persist
/**
* @inheritdoc
*/
public function persist(\Bitpay\KeyInterface $key)
{
$this->_keys[$key->getId()] = $key;
$data = serialize($key);
$encryptedData = \Mage::helper('core')->encrypt($data);
$config = new \Mage_Core_Model_Config();
if (true === isset($config) && false === empty($config)) {
$config->saveConfig($key->getId(), $encryptedData);
} else {
\Mage::helper('bitpay')->debugData('[ERROR] In file lib/Bitpay/Storage/MagentoStorage.php, class MagentoStorage::persist - Could not instantiate a \\Mage_Core_Model_Config object.');
throw new \Exception('[ERROR] In file lib/Bitpay/Storage/MagentoStorage.php, class MagentoStorage::persist - Could not instantiate a \\Mage_Core_Model_Config object.');
}
}
开发者ID:keramist,项目名称:magento-plugin,代码行数:16,代码来源:MagentoStorage.php
示例18: initFromConfig
/**
* Init observers from Magento config
*
* @param Mage_Core_Model_Config $config Config
* @return Oggetto_Messenger_Model_Event_Observer
*/
public function initFromConfig(Mage_Core_Model_Config $config)
{
$configNodes = $config->getNode()->xpath('global/messenger/event_observers/*');
if (!$configNodes) {
return $this;
}
$observers = [];
foreach ($configNodes as $_observer) {
$observers[$_observer->getName()] = Mage::getSingleton('messenger/di')->get((string) $_observer->class);
}
$this->setObservers($observers);
return $this;
}
开发者ID:rockxcn,项目名称:messenger,代码行数:19,代码来源:Observer.php
示例19: configure
public function configure($observer)
{
if (Mage::registry('shippinglabels_config_save_after_executed')) {
return;
}
Mage::register('shippinglabels_config_save_after_executed', true);
if (!Mage::getStoreConfig('shippinglabels/misc/apikey')) {
return Mage::getSingleton('core/session')->addError('You must provide a Shiptheory API Key. <a href="#" target="_blank">How do I get an API Key</a>');
}
//check/create api user and role
$id = Mage::getStoreConfig('shippinglabels/default/apiuserid');
$api_user = Mage::getModel('api/user')->load($id);
if (!$api_user->getData()) {
//utilise customer Model to generate a random api key
$api_key = Mage::getModel('customer/customer')->generatePassword();
$api_user = Mage::getModel('api/user')->setData(array('username' => Mage::getStoreConfig('shippinglabels/default/apiusername'), 'firstname' => Mage::getStoreConfig('shippinglabels/default/apiname'), 'lastname' => Mage::getStoreConfig('shippinglabels/default/apiname'), 'email' => Mage::getStoreConfig('shippinglabels/default/apiemail'), 'api_key' => $api_key, 'api_key_confirmation' => $api_key, 'is_active' => 1));
//create role
$role = Mage::getModel('api/roles')->setName('Shiptheory')->setPid(false)->setRoleType('G')->save();
//assign resource
Mage::getModel("api/rules")->setRoleId($role->getId())->setResources(array('all'))->saveRel();
try {
$api_user->save();
$api_user->setRoleIds(array($role->getId()))->setRoleUserId($api_user->getUserId())->saveRelations();
} catch (Exception $e) {
Mage::helper('shippinglabels')->log($e);
}
//load core config data
$config_data = Mage::getModel('shippinglabels/config')->load($api_key);
try {
$config_post = Mage::getModel("shippinglabels/config")->create($config_data);
} catch (Exception $e) {
Mage::helper('shippinglabels')->log("Failed transmit setup data: " . $e);
}
if ($config_post && $api_user->getId()) {
$auth_test = true;
//Update extension config to store the Shiptheory api user id
$config = new Mage_Core_Model_Config();
$config->saveConfig('shippinglabels/default/apiuserid', $api_user->getId(), 'default', 0);
} else {
//display failed message and delete API user
Mage::getSingleton('core/session')->addError("Unable to communicate with Shiptheory. Please try again.<br />If the problem persists, please <a href=\"http://support.shiptheory.com/\" target=\"_blank\">contact support</a>");
$api_user->delete();
}
}
if (isset($auth_test) && Mage::getStoreConfig('shippinglabels/default/status') != 'approved') {
//update extension status
Mage::helper('shippinglabels')->status('pending');
Mage::getSingleton('core/session')->getMessages(true);
Mage::getSingleton('core/session')->addSuccess("Success, everything is now connected. Check out your Shiptheory account to <a href=\"https://shiptheory.com/magento/edit\" target=\"_blank\">setup some shipping rules</a>.");
}
}
开发者ID:JamesAnelay,项目名称:Magento-Extension,代码行数:51,代码来源:Observer.php
示例20: generateSku
public function generateSku()
{
$sku = (int) Mage::getStoreConfig('supplierfrontendproductuploader_products/supplierfrontendproductuploader_catalog_config/sku_schema');
while (true) {
$product = Mage::getModel('catalog/product')->loadByAttribute('sku', $sku);
if (!$product) {
break;
}
$sku++;
}
$coreConfig = new Mage_Core_Model_Config();
$coreConfig->saveConfig('supplierfrontendproductuploader_products/supplierfrontendproductuploader_catalog_config/sku_schema', $sku);
return $sku;
}
开发者ID:programmerrahul,项目名称:vastecom,代码行数:14,代码来源:Data.php
注:本文中的Mage_Core_Model_Config类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论