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


PHP Mage_Core_Model_Config_Data::_beforeSave方法代码示例

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


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

示例1: _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

示例2: _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

示例3: _beforeSave

 protected function _beforeSave()
 {
     $value = $this->getValue();
     Mage::helper('udtiership')->saveV2SimpleCondRates($value);
     $this->setValue('');
     return parent::_beforeSave();
 }
开发者ID:xiaoguizhidao,项目名称:magento,代码行数:7,代码来源:SimpleCondRates.php

示例4: _beforeSave

 /**
  * Update history expiration date to simplify frontend calculations
  *
  * @return Enterprise_Reward_Model_System_Config_Backend_Expiration
  */
 protected function _beforeSave()
 {
     parent::_beforeSave();
     if (!$this->isValueChanged()) {
         return $this;
     }
     $websiteIds = array();
     if ($this->getWebsiteCode()) {
         $websiteIds = array(Mage::app()->getWebsite($this->getWebsiteCode())->getId());
     } else {
         $collection = Mage::getResourceModel('core/config_data_collection')->addFieldToFilter('path', self::XML_PATH_EXPIRATION_DAYS)->addFieldToFilter('scope', 'websites');
         $websiteScopeIds = array();
         foreach ($collection as $item) {
             $websiteScopeIds[] = $item->getScopeId();
         }
         foreach (Mage::app()->getWebsites() as $website) {
             /* @var $website Mage_Core_Model_Website */
             if (!in_array($website->getId(), $websiteScopeIds)) {
                 $websiteIds[] = $website->getId();
             }
         }
     }
     if (count($websiteIds) > 0) {
         Mage::getResourceModel('enterprise_reward/reward_history')->updateExpirationDate($this->getValue(), $websiteIds);
     }
     return $this;
 }
开发者ID:jpbender,项目名称:mage_virtual,代码行数:32,代码来源:Expiration.php

示例5: _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

示例6: _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

示例7: _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

示例8: _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

示例9: _beforeSave

 /**
  * Processing object before save data
  *
  * @return Mage_Core_Model_Abstract
  */
 protected function _beforeSave()
 {
     //if ($this->isValueChanged()) {
     if ($this->field == 'reward_points' || $this->field == 'store_credit') {
         Mage::throwException($this->getValue());
     }
     /* @var $fieldObject Bronto_Api_Field */
     $fieldObject = Mage::getModel('bronto_common/system_config_source_field')->getFieldObjectById($this->getValue());
     if ($fieldObject) {
         if ('attributes' == $this->group_id) {
             $attributes = Mage::getModel('customer/entity_attribute_collection');
         } elseif ('address_attributes' == $this->group_id) {
             $attributes = Mage::getModel('customer/entity_address_attribute_collection')->addVisibleFilter();
         }
         if ($attributes) {
             foreach ($attributes as $attribute) {
                 if ($this->field == $attribute->attribute_code) {
                     if ($attribute->frontend_input != $fieldObject->type && $fieldObject->type != 'text') {
                         $message = "Input type doesn't match: {$this->getFieldConfig()->label} [type: {$attribute->frontend_input}] => {$fieldObject->label} [type: {$fieldObject->type}]" . "... Please note that this could cause issues when attempting to import customers";
                         // Throw Warning, but allow saving
                         Mage::getSingleton('core/session')->addWarning(Mage::helper('adminhtml')->__($message));
                         // Throw Exception and prevent saving
                         // Mage::throwException(Mage::helper('adminhtml')->__($message));
                     }
                 }
             }
         }
     }
     //}
     return parent::_beforeSave();
 }
开发者ID:xiaoguizhidao,项目名称:blingjewelry-prod,代码行数:36,代码来源:Brontofield.php

示例10: _beforeSave

 /**
  * @return Mage_Core_Model_Abstract
  * @throws Exception
  */
 protected function _beforeSave()
 {
     $filePath = $this->getValue();
     if (!file_exists($filePath) || !is_readable($filePath)) {
         throw new Exception(Mage::helper('swisspost_yellowcube')->__("Failed to load certificate from '%s'", $filePath));
     }
     return parent::_beforeSave();
 }
开发者ID:swisspost-yellowcube,项目名称:magento-yellowcube,代码行数:12,代码来源:Backend.php

示例11: _beforeSave

 protected function _beforeSave()
 {
     $value = $this->getValue();
     if (is_array($value) && isset($value['delete']) && $value['delete']) {
         $this->setValue('');
     }
     return parent::_beforeSave();
 }
开发者ID:flintdigital,项目名称:mage-mod-ar-po-emja,代码行数:8,代码来源:Icon.php

示例12: _beforeSave

 protected function _beforeSave()
 {
     if ($this->getValue() == AW_Helpdesk3_Model_Source_Yesno::YES_VALUE && $this->_isCanEnabled()) {
         return parent::_beforeSave();
     }
     $this->setValue(AW_Helpdesk3_Model_Source_Yesno::NO_VALUE);
     return $this;
 }
开发者ID:protechhelp,项目名称:gamamba,代码行数:8,代码来源:TicketEscalation.php

示例13: _beforeSave

 public function _beforeSave()
 {
     $result = $this->validate();
     if ($result !== true) {
         Mage::throwException(implode("\n", $result));
     }
     return parent::_beforeSave();
 }
开发者ID:cabrerabywaters,项目名称:magentoSunshine,代码行数:8,代码来源:Path.php

示例14: _beforeSave

 public function _beforeSave()
 {
     $valid = new Zend_Validate_Between(array('min' => 1, 'max' => 100));
     if (!$valid->isValid($this->getValue())) {
         $this->_dataSaveAllowed = false;
         Mage::throwException(Mage::helper('welance_kraken')->__('Please use a value between 1 and 100'));
     }
     return parent::_beforeSave();
 }
开发者ID:fasimana,项目名称:kraken-magento,代码行数:9,代码来源:Quality.php

示例15: _beforeSave

 /**
  * Attempt to canonicalize and validate the provided language code. The
  * "canonical" version of the langauge code will be all lowercase. This
  * value is compared to xml:lang attributes in feeds being processed, which
  * are also translated to all lowercase during processing. Validation
  * checks that the canonical language code is a valid value for an xml:lang
  * attribute.
  *
  * @return self
  */
 public function _beforeSave()
 {
     parent::_beforeSave();
     if ($this->isValueChanged()) {
         $value = strtolower(trim($this->getValue()));
         $this->_validateLanguageCode($value)->setValue($value);
     }
     return $this;
 }
开发者ID:sirishreddyg,项目名称:magento-retail-order-management,代码行数:19,代码来源:Code.php


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