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


PHP Mage_Eav_Model_Entity_Attribute_Backend_Abstract::beforeSave方法代码示例

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


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

示例1: beforeSave

 /**
  * Before save method
  *
  * @param Varien_Object $object
  * @return Mage_Eav_Model_Entity_Attribute_Backend_Abstract
  */
 public function beforeSave($object)
 {
     $attributeCode = $this->getAttribute()->getAttributeCode();
     $attributeValue = $object->getData($attributeCode);
     $delimiter = Glace_Menumobile_Block_Category_Attribute_Helper_Dropdown_Blocks::DELIMITER;
     $maxBlocks = Glace_Menumobile_Block_Category_Attribute_Helper_Dropdown_Blocks::MAX_BLOCKS;
     if ($attributeValue) {
         //To make parsing simpler, replace value with empty string if all blocks are empty
         $exploded = explode($delimiter, $attributeValue);
         $allBlocksAreEmpty = TRUE;
         for ($i = 0; $i < $maxBlocks; $i++) {
             if (isset($exploded[$i])) {
                 if (trim($exploded[$i])) {
                     //Block is not empty after trimming
                     $allBlocksAreEmpty = FALSE;
                     break;
                 }
             }
         }
         if ($allBlocksAreEmpty) {
             $object->setData($attributeCode, '');
             //Set empty value
         }
     }
     return parent::beforeSave($object);
 }
开发者ID:vinayshuklasourcefuse,项目名称:sareez,代码行数:32,代码来源:Glace_Menumobile_Model_Category_Attribute_Backend_Dropdown_Blocks.php

示例2: beforeSave

 /**
  * Method is invoked before save
  *
  * @param Varien_Object $object
  * @return Mage_Eav_Model_Entity_Attribute_Backend_Abstract
  */
 public function beforeSave($object)
 {
     if ($object->getCreditmemo()) {
         $object->setParentId($object->getCreditmemo()->getId());
     }
     return parent::beforeSave($object);
 }
开发者ID:par-orillonsoft,项目名称:magento_work,代码行数:13,代码来源:Child.php

示例3: afterSave

 public function afterSave($object)
 {
     if ($object->getOrderItem()) {
         $object->getOrderItem()->save();
     }
     return parent::beforeSave($object);
 }
开发者ID:jpbender,项目名称:mage_virtual,代码行数:7,代码来源:Item.php

示例4: beforeSave

 /**
  * Performed before data is saved
  *
  * @param Varieb_Object $object
  * @return Mage_Eav_Model_Entity_Attribute_Backend_Abstract
  */
 public function beforeSave($object)
 {
     if ($object->getShipment()) {
         $object->setParentId($object->getShipment()->getId());
     }
     return parent::beforeSave($object);
 }
开发者ID:QiuLihua83,项目名称:magento-enterprise-1.13.1.0,代码行数:13,代码来源:Child.php

示例5: beforeSave

 /**
  * Process the attribute value before saving
  *
  * @param Mage_Core_Model_Abstract $object
  * @return Mage_Eav_Model_Entity_Attribute_Backend_Abstract
  */
 public function beforeSave($object)
 {
     $attributeCode = $this->getAttribute()->getAttributeCode();
     $data = $object->getData($attributeCode);
     $customerGroupIds = array(Netzarbeiter_GroupsCatalog2_Helper_Data::USE_DEFAULT, Netzarbeiter_GroupsCatalog2_Helper_Data::USE_NONE);
     $customerGroups = Mage::helper('netzarbeiter_groupscatalog2')->getGroups();
     $customerGroupIds = array_merge($customerGroupIds, array_keys($customerGroups->getItems()));
     if (!$data) {
         $data = array(Netzarbeiter_GroupsCatalog2_Helper_Data::USE_DEFAULT);
     }
     if (!is_array($data)) {
         $data = explode(',', $data);
     }
     if (1 < count($data)) {
         // remove USE_DEFAULT if any other groups are selected, too
         $key = array_search(Netzarbeiter_GroupsCatalog2_Helper_Data::USE_DEFAULT, $data);
         if (false !== $key) {
             unset($data[$key]);
         }
         // if USE_NONE is selected remove all other groups
         if (in_array(Netzarbeiter_GroupsCatalog2_Helper_Data::USE_NONE, $data)) {
             $data = array(Netzarbeiter_GroupsCatalog2_Helper_Data::USE_NONE);
         }
     }
     // validate all customer groups ids are valid
     foreach ($data as $key => $groupId) {
         if (!in_array($groupId, $customerGroupIds)) {
             unset($data[$key]);
         }
     }
     // I like it nice and tidy, this gives us sequential index numbers again as a side effect :)
     sort($data);
     $object->setData($attributeCode, implode(',', $data));
     return parent::beforeSave($object);
 }
开发者ID:gewaechshaus,项目名称:groupscatalog2,代码行数:41,代码来源:Customergroups.php

示例6: beforeSave

 /**
  * Before save method
  *
  * @param  Varien_Object $object Object Model
  * @return FireGento_DynamicCategory_Model_Entity_Attribute_Backend_Rule Self.
  */
 public function beforeSave($object)
 {
     parent::beforeSave($object);
     $attrCode = $this->getAttribute()->getAttributeCode();
     $object->setData($attrCode, serialize($object->getData($attrCode)));
     return $this;
 }
开发者ID:hsq,项目名称:firegento-dynamiccategory,代码行数:13,代码来源:Rule.php

示例7: beforeSave

 public function beforeSave($object)
 {
     if ($object->getOrder()) {
         $object->setParentId($object->getOrder()->getId());
     }
     parent::beforeSave($object);
     return $this;
 }
开发者ID:codercv,项目名称:urbansurprisedev,代码行数:8,代码来源:Child.php

示例8: beforeSave

 public function beforeSave($object)
 {
     if ($object->getAddress()) {
         $object->setParentId($object->getAddress()->getId())->setStoreId($object->getAddress()->getStoreId());
     }
     parent::beforeSave($object);
     return $this;
 }
开发者ID:cewolf2002,项目名称:magento,代码行数:8,代码来源:Child.php

示例9: beforeSave

 public function beforeSave($object)
 {
     if ($object->getOrder()) {
         $object->setOrderId($object->getOrder()->getId());
         $object->setBillingAddressId($object->getOrder()->getBillingAddress()->getId());
     }
     return parent::beforeSave($object);
 }
开发者ID:hyhoocchan,项目名称:mage-local,代码行数:8,代码来源:Order.php

示例10: beforeSave

 public function beforeSave($object)
 {
     $data = $object->getData($this->getAttribute()->getAttributeCode());
     if (is_array($data)) {
         $object->setData($this->getAttribute()->getAttributeCode(), implode(',', $data));
     }
     return parent::beforeSave($object);
 }
开发者ID:jpbender,项目名称:mage_virtual,代码行数:8,代码来源:Array.php

示例11: beforeSave

 /**
  * Prepare data for save
  *
  * @param Varien_Object $object
  * @return Mage_Eav_Model_Entity_Attribute_Backend_Abstract
  */
 public function beforeSave($object)
 {
     $attributeCode = $this->getAttribute()->getAttributeCode();
     $data = $object->getData($attributeCode);
     if (is_array($data)) {
         $data = array_filter($data);
         $object->setData($attributeCode, implode(',', $data));
     }
     return parent::beforeSave($object);
 }
开发者ID:Airmal,项目名称:Magento-Em,代码行数:16,代码来源:Array.php

示例12: beforeSave

 /**
  * Prepare data for save
  *
  * @param Varien_Object $object
  * @return Mage_Eav_Model_Entity_Attribute_Backend_Abstract
  */
 public function beforeSave($object)
 {
     $attributeCode = $this->getAttribute()->getAttributeCode();
     $data = $object->getData($attributeCode);
     if ($data instanceof Varien_Object) {
         $data = get_class($data) . '|' . json_encode($data->getData());
     }
     $object->setData($attributeCode, $data);
     return parent::beforeSave($object);
 }
开发者ID:rcclaudrey,项目名称:dev,代码行数:16,代码来源:Json.php

示例13: beforeSave

 /**
  * Encrypts the value before saving
  *
  * @param  Mage_Core_Model_Abstract $object Object
  * @return Itabs_Debit_Model_Entity_Customer_Attribute_Backend_Encrypted
  */
 public function beforeSave($object)
 {
     $helper = Mage::helper('core');
     $attributeName = $this->getAttribute()->getName();
     if ($object->getData($attributeName) != '') {
         $value = $helper->encrypt($object->getData($attributeName));
         $object->setData($attributeName, $value);
     }
     return parent::beforeSave($object);
 }
开发者ID:pette87,项目名称:Magento-DebitPayment,代码行数:16,代码来源:Encrypted.php

示例14: beforeSave

 /**
  * Prepare inventory data from custom atribute
  *
  * @param Varien_Object $object
  * @return Mage_Eav_Model_Entity_Attribute_Backend_Abstract|void
  */
 public function beforeSave($object)
 {
     /** @var $object Mage_Catalog_Model_Product  */
     $stockData = $object->getData($this->getAttribute()->getAttributeCode());
     if ($object->getStockData() !== null || $stockData !== null) {
         $object->setStockData(array_replace((array) $object->getStockData(), (array) $stockData));
     }
     $object->unsetData($this->getAttribute()->getAttributeCode());
     parent::beforeSave($object);
 }
开发者ID:nickimproove,项目名称:magento2,代码行数:16,代码来源:Stock.php

示例15: beforeSave

 public function beforeSave($object)
 {
     $attrCode = $this->getAttribute()->getAttributeCode();
     if ($object->hasData($attrCode)) {
         $value = trim($object->getData($attrCode));
         if ('' !== $value) {
             if (!preg_match('#^(?:http|https|ftp)://[a-z][a-z.]*\\.[a-z]+#', $value)) {
                 throw new RuntimeException($this->getHelper()->__('Please specify a full URL including http://, https:// or ftp:// for for the attribute "%s"', $this->getAttribute()->getFrontendLabel()));
                 //Mage::throwException($this->getHelper()->__('Please specify a full URL.'));
             }
         }
     }
     return parent::beforeSave($object);
 }
开发者ID:riker09,项目名称:VinaiKopp_CategoryLink,代码行数:14,代码来源:Url.php


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