本文整理汇总了PHP中Mage_Core_Model_Config_Data::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Core_Model_Config_Data::save方法的具体用法?PHP Mage_Core_Model_Config_Data::save怎么用?PHP Mage_Core_Model_Config_Data::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Core_Model_Config_Data
的用法示例。
在下文中一共展示了Mage_Core_Model_Config_Data::save方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例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)
}
示例3: 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();
}
示例4: 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();
}
示例5: save
public function save()
{
if ($value = $this->getValue()) {
$value = implode(',', array_unique(explode(',', $this->getValue())));
}
$this->setValue($value);
return parent::save();
}
示例6: save
function save()
{
if ($this->getFieldsetDataValue('active')) {
$merchantId = $this->getFieldsetDataValue("merchant_id");
Litle_CreditCard_Model_ValidateMerchantId::validate($merchantId);
}
return parent::save();
}
示例7: save
public function save()
{
if (!Mage::getModel($this->getValue())) {
Mage::throwException(sprintf('Invalid Access Class: Could not instantiate a [%s]', $this->getValue()));
} else {
parent::save();
}
}
示例8: save
/**
* Disable saving if multiselect fields are disabled
*
* @return $this|Mage_Core_Model_Abstract
*/
public function save()
{
$helper = Mage::helper('netzarbeiter_groupscatalog2');
if ($helper->getConfig('show_multiselect_field')) {
parent::save();
}
return $this;
}
示例9: save
public function save()
{
$v = $this->getValue();
if ($v == 'rgba(0, 0, 0, 0)') {
$this->setValue('transparent');
}
return parent::save();
}
示例10: save
public function save()
{
$value = $this->getValue();
if ($value && !is_numeric($value)) {
Mage::throwException("Fields specifying 'Numeric' must have numeric values only!");
}
return parent::save();
}
示例11: save
public function save()
{
// Validate number. Should be a whole number greater than 0.
if (!ctype_digit((string) $this->getValue()) || (int) $this->getValue() <= 0) {
Mage::throwException("Invalid entry for attempts. Must be a positive whole number, such as 20");
}
return parent::save();
}
开发者ID:ankita-parashar,项目名称:magento,代码行数:8,代码来源:Gorilla_Greatplains_Model_System_Config_Backend_Attempts.php
示例12: save
public function save()
{
// Validate email. Do not allow invalid emails
if (!Zend_Validate::is($this->getValue(), 'EmailAddress')) {
Mage::throwException("Invalid email format. Recipient and sender emails must be valid emails");
}
return parent::save();
}
开发者ID:ankita-parashar,项目名称:magento,代码行数:8,代码来源:Gorilla_Greatplains_Model_System_Config_Backend_Email.php
示例13: save
/**
* Checks the entered value before saving it to the configuration. Setting to default (DE only) if
* another country than Germany was choosen.
*
* @return Mage_Core_Model_Abstract
*/
public function save()
{
if ($this->getValue() != '1') {
$translateMessage = Mage::helper('barzahlen')->__('bz_adm_specificcountry_exception');
Mage::getSingleton('adminhtml/session')->addError($translateMessage);
Mage::helper('barzahlen')->bzLog('adminexceptions/country: Setting DE as allowed country');
$this->setValue(1);
}
return parent::save();
}
示例14: save
public function save()
{
$group = $this->getData('groups');
$fields = $group['messages']['fields'];
if ($fields['activate']['value'] == 1) {
if ($fields['mode']['value'] == 1) {
$productionpublickey = $fields['productionpublickey']['value'];
$productionprikey = $fields['productionprikey']['value'];
if ($productionpublickey == NULL || $productionpublickey == ' ' || !isset($productionpublickey)) {
Mage::throwException(Mage::helper('core')->__('Production Public key is required'));
die;
}
if ($productionprikey == NULL || $productionprikey == ' ' || !isset($productionprikey)) {
Mage::throwException(Mage::helper('core')->__('Production Private key is required'));
die;
}
if (strlen($productionpublickey) != 11) {
Mage::throwException(Mage::helper('core')->__('Public key lenth must be 11 characters'));
die;
}
if (strlen($productionprikey) != 21) {
Mage::throwException(Mage::helper('core')->__('Private key length must be 21 characters'));
die;
}
if (substr($productionprikey, 0, 1) != "P" || substr($productionpublickey, 0, 1) != "P") {
Mage::throwException(Mage::helper('core')->__('Please enter a valid Production key'));
die;
}
} elseif ($fields['mode']['value'] == 0) {
$sandboxpublickey = $fields['sandboxpublickey']['value'];
$sandboxprikey = $fields['sandboxprikey']['value'];
if ($sandboxpublickey == NULL || $sandboxpublickey == ' ' || !isset($sandboxpublickey)) {
Mage::throwException(Mage::helper('core')->__('Sandbox Public key is required'));
die;
}
if ($sandboxprikey == NULL || $sandboxprikey == ' ' || !isset($sandboxprikey)) {
Mage::throwException(Mage::helper('core')->__('Sandbox Private key is required'));
die;
}
if (strlen($sandboxpublickey) != 11) {
Mage::throwException(Mage::helper('core')->__('Public key lenth must be 11 characters'));
die;
}
if (strlen($sandboxprikey) != 21) {
Mage::throwException(Mage::helper('core')->__('Private key length must be 21 characters'));
die;
}
if (substr($sandboxprikey, 0, 1) != "T" || substr($sandboxpublickey, 0, 1) != "T") {
Mage::throwException(Mage::helper('core')->__('Please enter a valid Sandbox key'));
die;
}
}
}
return parent::save();
}
示例15: save
/**
* Checks the entered value before saving it to the configuration. Setting to default if string
* length is lower than 1.
*
* @return Mage_Core_Model_Abstract
*/
public function save()
{
$title = $this->getValue();
if (strlen($title) < 1) {
$translateMessage = Mage::helper('barzahlen')->__('bz_adm_co_exception');
Mage::getSingleton('adminhtml/session')->addError($translateMessage);
Mage::helper('barzahlen')->bzLog('adminexceptions/title: Empty string given. Setting default title.');
$this->setValue('Barzahlen');
}
return parent::save();
}