当前位置: 首页>>代码示例>>PHP>>正文


PHP Mage_Core_Model_Config_Data类代码示例

本文整理汇总了PHP中Mage_Core_Model_Config_Data的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Core_Model_Config_Data类的具体用法?PHP Mage_Core_Model_Config_Data怎么用?PHP Mage_Core_Model_Config_Data使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Mage_Core_Model_Config_Data类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: checkConfigUnique

 /**
  * @param Mage_Core_Model_Config_Data $object
  * @return Mage_Core_Model_Config_Data
  */
 protected function checkConfigUnique(Mage_Core_Model_Config_Data $object)
 {
     /** @var $collection Mage_Core_Model_Mysql4_Config_Data_Collection | Mage_Core_Model_Resource_Config_Data_Collection */
     $collection = $this->getFactory()->getModelCoreConfigData()->getCollection();
     $collection->addFieldToFilter('scope', $object->getScope());
     $collection->addFieldToFilter('scope_id', $object->getScopeId());
     $collection->addFieldToFilter('path', $object->getPath());
     $collection->load();
     if ($collection->count() > 0) {
         /** @var $config Mage_Core_Model_Config_Data */
         $config = $collection->getFirstItem();
         $object->setId($config->getId());
     }
     return $object;
 }
开发者ID:kirchbergerknorr,项目名称:payone-magento,代码行数:19,代码来源:ProtectCheck.php

示例2: save

 public function save()
 {
     $enabled = $this->getValue();
     //get the value from our config
     $resource = Mage::getSingleton('core/resource');
     $readConnection = $resource->getConnection('core_read');
     $writeConnection = $resource->getConnection('core_write');
     //die($enabled);
     $query = 'SELECT attribute_id FROM eav_attribute WHERE `attribute_code` = \'telephone\'';
     $attribute_id = $readConnection->fetchOne($query);
     $query = 'UPDATE eav_attribute SET `is_required` = \'' . $enabled . '\' WHERE `attribute_code` = \'telephone\'';
     $writeConnection->query($query);
     if ($enabled == 1) {
         $validationRules = 'a:2:{s:15:"max_text_length";i:255;s:15:"min_text_length";i:1;}';
         $query = 'UPDATE customer_eav_attribute SET `validate_rules` = \'' . $validationRules . '\' WHERE `attribute_id` = \'' . $attribute_id . '\'';
         $writeConnection->query($query);
     } else {
         $query = 'UPDATE customer_eav_attribute SET `validate_rules` = NULL WHERE `attribute_id` = \'' . $attribute_id . '\'';
         $writeConnection->query($query);
     }
     //die($attribute_id);
     return parent::save();
     //call original save method so whatever happened
     //before still happens (the value saves)
 }
开发者ID:EliasKotlyar,项目名称:Twinsen_NoTelephoneRequired,代码行数:25,代码来源:EnableTelephone.php

示例3: save

 /**
  * Check request for errors found by Helper and Observer. It will print error messages if errors found and
  * in that case set value to 0.
  *
  * @return FACTFinder_Core_Model_System_Config_Backend_Enabled
  */
 public function save()
 {
     parent::save();
     Mage::app()->cleanCache();
     $this->_checkConfiguration();
     return $this;
 }
开发者ID:KaiStapel,项目名称:Magento-FACTFinder,代码行数:13,代码来源:Enabled.php

示例4: _beforeSave

 protected function _beforeSave()
 {
     $value = $this->getValue();
     if (is_array($value)) {
         unset($value['$ROW']);
         $rHlp = Mage::getResourceSingleton('udropship/helper');
         $conn = $rHlp->getWriteConnection();
         $dtTable = $rHlp->getTable('udtiership/delivery_type');
         $fieldsData = $rHlp->myPrepareDataForTable($dtTable, array(), true);
         $fields = array_keys($fieldsData);
         $existing = $rHlp->loadDbColumns(Mage::getModel('udtiership/deliveryType'), true, $fields);
         $insert = array();
         foreach ($value as $v) {
             if (empty($v['delivery_title'])) {
                 continue;
             }
             if (!empty($v['delivery_type_id'])) {
                 unset($existing[$v['delivery_type_id']]);
             } else {
                 $v['delivery_type_id'] = null;
             }
             $insert[] = $rHlp->myPrepareDataForTable($dtTable, $v, true);
         }
         if (!empty($insert)) {
             $rHlp->multiInsertOnDuplicate($dtTable, $insert);
         }
         if (!empty($existing)) {
             $conn->delete($dtTable, array('delivery_type_id in (?)' => array_keys($existing)));
         }
     }
     $this->setValue('');
     return parent::_beforeSave();
 }
开发者ID:xiaoguizhidao,项目名称:magento,代码行数:33,代码来源:DeliveryType.php

示例5: _afterload

 protected function _afterload()
 {
     if (!is_array($this->getValue())) {
         $this->setValue(explode(",", $this->getValue()));
     }
     return parent::_afterload();
 }
开发者ID:hipay,项目名称:hipay-fullservice-sdk-magento1,代码行数:7,代码来源:CcTypes.php

示例6: _afterSave

 /**
  * Cleanup blocks HTML cache if value has been changed
  *
  * @return Enterprise_WebsiteRestriction_Model_System_Config_Backend_Active
  */
 protected function _afterSave()
 {
     if ($this->isValueChanged()) {
         Mage::dispatchEvent('clean_cache_by_tags', array('tags' => array(Mage_Core_Model_Store::CACHE_TAG, Mage_Cms_Model_Block::CACHE_TAG)));
     }
     return parent::_afterSave();
 }
开发者ID:hientruong90,项目名称:ee_14_installer,代码行数:12,代码来源:Active.php

示例7: _beforeSave

 /**
  * Clean the project code of unicode characters.
  *
  * @return Mage_Core_Model_Abstract|void
  */
 protected function _beforeSave()
 {
     $script = $this->getValue();
     $script = preg_replace('/[^(\\x20-\\x7F)]*/', '', $script);
     $this->setValue($script);
     return parent::_beforeSave();
 }
开发者ID:technomagegithub,项目名称:colb2b,代码行数:12,代码来源:Projectcode.php

示例8: _beforeSave

 /**
  * Checks to see if we have a new and valid Site Id Checksum Entered
  * @return self
  */
 protected function _beforeSave()
 {
     $helper = Mage::helper('eems_display');
     // We need this helper several times herein
     $newChecksum = $this->getValue();
     list($oldHash, $oldSiteId) = $helper->splitSiteIdChecksumField($this->getOldValue());
     if (empty($newChecksum) && empty($oldHash)) {
         // If both old and new checksums are still empty, prompt with some help info.
         $this->_dataSaveAllowed = false;
         Mage::getSingleton(self::SESSION_KEY)->addWarning('Please note that tracking is not enabled. Site Id Checksum is empty. ' . self::CONTACT_INFO);
         return $this;
     }
     $storeId = $helper->getStoreIdForCurrentAdminScope();
     $formFields = $this->getFieldsetData();
     $newSiteId = $formFields['site_id'];
     // Not allowed to change the Checksum unless we previously had a hash and we are changing the Site Id
     if (!empty($oldHash) && $oldSiteId === $newSiteId) {
         $this->_dataSaveAllowed = false;
         return $this;
     }
     // Check that the value provided in newCheckSum matches what we calculate for ourHash.
     $url = parse_url($helper->getProductFeedUrl($storeId), PHP_URL_HOST);
     $ourHash = md5($newSiteId . $url);
     if ($ourHash === $newChecksum) {
         // Upon success, we save the hash and the newSiteId. In the frontend at runtime,
         // we just have make sure that the siteId matches the runtime siteId
         $this->setValue($newChecksum . self::FIELD_SEP . $newSiteId);
         parent::_beforeSave();
     } else {
         $this->setValue(self::FIELD_SEP);
         Mage::getSingleton(self::SESSION_KEY)->addError('Failed to validate the Site Id. ' . self::CONTACT_INFO);
     }
     return $this;
 }
开发者ID:xiaoguizhidao,项目名称:magento,代码行数:38,代码来源:Siteidchecksum.php

示例9: _beforeSave

 /**
  * Processing object before save data
  *
  * @return Mage_Core_Model_Abstract
  */
 protected function _beforeSave()
 {
     $path = $this->getPath();
     $realpath = str_replace('-', '/', array_pop(explode('/', $path)));
     $this->_saveConfigData($realpath, $this->getValue());
     parent::_beforeSave();
 }
开发者ID:bevello,项目名称:bevello,代码行数:12,代码来源:Field.php

示例10: save

 /**
  * Perform API call to Amazon to validate Client ID/Secret
  *
  */
 public function save()
 {
     $data = $this->getFieldsetData();
     $isEnabled = $this->getValue();
     if ($data['client_id'] && $data['client_secret']) {
         $_api = Mage::getModel('amazon_login/api');
         // REST API params
         $params = array('grant_type' => 'authorization_code', 'code' => 'SplxlOBeZQQYbYS6WxSbIA', 'client_id' => trim($data['client_id']), 'client_secret' => trim($data['client_secret']));
         $response = $_api->request('auth/o2/token', $params);
         if (!$response) {
             Mage::getSingleton('core/session')->addError('Error: Unable to perform HTTP request to Amazon API.');
         } else {
             if ($response && isset($response['error'])) {
                 if ($response['error'] == 'invalid_client') {
                     Mage::getSingleton('core/session')->addError('Client authentication failed. Please verify your Client ID and Client Secret.');
                     $this->setValue(0);
                     // Set "Enabled" to "No"
                 } else {
                     Mage::getSingleton('core/session')->addSuccess('Successfully connected to Amazon API with Client ID and Client Secret.');
                 }
             }
         }
     }
     return parent::save();
 }
开发者ID:frognrainbow,项目名称:amazon-payments-magento-plugin,代码行数:29,代码来源:Enabled.php

示例11: _beforeSave

 /**
  * Validate minimum product qty value
  *
  * @return Mage_CatalogInventory_Model_System_Config_Backend_Minqty
  */
 protected function _beforeSave()
 {
     parent::_beforeSave();
     $minQty = (int) $this->getValue() >= 0 ? (int) $this->getValue() : (int) $this->getOldValue();
     $this->setValue((string) $minQty);
     return $this;
 }
开发者ID:xiaoguizhidao,项目名称:blingjewelry-prod,代码行数:12,代码来源:Minqty.php

示例12: _afterSave

 protected function _afterSave()
 {
     if ($this->isValueChanged()) {
         Mage::getModel('enterprise_giftcardaccount/pool')->cleanupFree();
     }
     parent::_afterSave();
 }
开发者ID:hientruong90,项目名称:ee_14_installer,代码行数:7,代码来源:Pool.php

示例13: _afterLoad

 /**
  * if we dont' have a value yet retrieve a starting value from
  * the default config xml configuration
  *
  * @return Fooman_PdfCustomiser_Model_Backend_Pdftotal
  */
 protected function _afterLoad()
 {
     if ($this->getValue() == '') {
         $this->setValue((string) Mage::getConfig()->getNode($this->_getGlobalConfigPath()));
     }
     return parent::_afterLoad();
 }
开发者ID:AleksNesh,项目名称:pandora,代码行数:13,代码来源:PdfTotal.php

示例14: save

 public function save()
 {
     $fdata = array();
     foreach ($this->groups['account']['fields'] as $name => $field) {
         $fdata[$name] = $field['value'];
     }
     if ($fdata['embed']) {
         $obj = json_decode($fdata['embed']);
         $fdata['embed'] = $obj->embed;
         $fdata['guid'] = $obj->guid;
     }
     include_once dirname(__FILE__) . '/JustunoAccess.php';
     $params = array('apiKey' => JUSTUNO_KEY, 'email' => $fdata['email'], 'domain' => $fdata['domain'], 'guid' => $fdata['guid']);
     if ($fdata['password']) {
         $params['password'] = $fdata['password'];
     }
     $jAccess = new JustunoAccess($params);
     try {
         $justuno = $jAccess->getWidgetConfig();
         $jusdata = array();
         $jusdata['dashboard'] = (string) $jAccess->getDashboardLink();
         $jusdata['guid'] = (string) $justuno['guid'];
         $jusdata['embed'] = (string) $justuno['embed'];
         $this->setValue((string) json_encode($jusdata));
     } catch (JustunoAccessException $e) {
         Mage::throwException($e->getMessage());
     }
     return parent::save();
 }
开发者ID:billadams,项目名称:forever-frame,代码行数:29,代码来源:Embed.php

示例15: _beforeSave

 /**
  * @return Bronto_Common_Model_System_Config_Backend_Token
  */
 protected function _beforeSave()
 {
     $commonHelper = Mage::helper('bronto_common');
     $value = $this->getValue();
     if (!empty($value)) {
         if ($commonHelper->validApiToken($value) === false) {
             // reset the verified status
             Mage::helper('bronto_verify/apitoken')->setStatus(Mage::helper('bronto_verify/apitoken')->getPath('token_status'), '2', $this->getScope(), $this->getScopeId());
             Mage::throwException($commonHelper->__('The Bronto API Token you have entered appears to be invalid.'));
         }
         // reset the verified status
         Mage::helper('bronto_verify/apitoken')->setStatus(Mage::helper('bronto_verify/apitoken')->getPath('token_status'), '1', $this->getScope(), $this->getScopeId());
         // Enable Common Module
         Mage::getModel('core/config_data')->load(Bronto_Common_Helper_Data::XML_PATH_ENABLED, 'path')->setValue(1)->setPath(Bronto_Common_Helper_Data::XML_PATH_ENABLED)->setScope($this->getScope())->setScopeId($this->getScopeId())->save();
         //  API key is new and doesn't match existing API key
         $currentApiKey = $commonHelper->getApiToken();
         if (!empty($currentApiKey) && $currentApiKey !== $value) {
             Mage::getSingleton('adminhtml/session')->addNotice($commonHelper->__('You have changed your Bronto API Token so all Bronto modules have been disabled for this configuration scope.' . '<br />Please proceed to each module and reconfigure all available options to avoid undesired behavior.'));
             $this->_disableAndUnlink();
         }
     } else {
         Mage::getSingleton('adminhtml/session')->addNotice($commonHelper->__('You have removed your Bronto API Token so all Bronto modules have been disabled for this configuration scope.'));
         // reset the verified status
         Mage::helper('bronto_verify/apitoken')->setStatus(Mage::helper('bronto_verify/apitoken')->getPath('token_status'), '0', $this->getScope(), $this->getScopeId());
         $this->_disableAndUnlink(true);
     }
     return parent::_beforeSave();
 }
开发者ID:Rodrifer,项目名称:candyclub,代码行数:31,代码来源:Token.php


注:本文中的Mage_Core_Model_Config_Data类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。