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


PHP Mage_Eav_Model_Entity_Attribute_Backend_Abstract类代码示例

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


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

示例1: _isCallableAttributeInstance

 /**
  * Check whether attribute instance (attribute, backend, frontend or source) has method and applicable
  *
  * @param Mage_Eav_Model_Entity_Attribute_Abstract|Mage_Eav_Model_Entity_Attribute_Backend_Abstract|Mage_Eav_Model_Entity_Attribute_Frontend_Abstract|Mage_Eav_Model_Entity_Attribute_Source_Abstract $instance
  * @param string $method
  * @param array $args array of arguments
  * @return boolean
  */
 protected function _isCallableAttributeInstance($instance, $method, $args)
 {
     if ($instance instanceof Mage_Eav_Model_Entity_Attribute_Backend_Abstract && ($method == 'beforeSave' || ($method = 'afterSave'))) {
         $attributeCode = $instance->getAttribute()->getAttributeCode();
         if (isset($args[0]) && $args[0] instanceof Varien_Object && $args[0]->getData($attributeCode) === false) {
             return false;
         }
     }
     return parent::_isCallableAttributeInstance($instance, $method, $args);
 }
开发者ID:barneydesmond,项目名称:propitious-octo-tribble,代码行数:18,代码来源:Abstract.php

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

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

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

示例5: testGetAffectedFields

 public function testGetAffectedFields()
 {
     $valueId = 10;
     $attributeId = 42;
     $attribute = $this->getMock('Mage_Eav_Model_Entity_Attribute_Abstract', array('getBackendTable', 'isStatic', 'getAttributeId'), array(), '', false);
     $attribute->expects($this->any())->method('getAttributeId')->will($this->returnValue($attributeId));
     $attribute->expects($this->any())->method('isStatic')->will($this->returnValue(false));
     $attribute->expects($this->any())->method('getBackendTable')->will($this->returnValue('table'));
     $this->_model->setAttribute($attribute);
     $object = new Varien_Object();
     $this->_model->setValueId($valueId);
     $this->assertEquals(array('table' => array(array('value_id' => $valueId, 'attribute_id' => $attributeId))), $this->_model->getAffectedFields($object));
 }
开发者ID:nemphys,项目名称:magento2,代码行数:13,代码来源:AbstractTest.php

示例6: afterSave

 /**
  * Save uploaded file and set its name to entity
  *
  * @param Goodahead_Etm_Model_Entity $object
  * @return void
  */
 public function afterSave($object)
 {
     parent::afterSave($object);
     $value = $object->getData($this->getAttribute()->getName());
     if (is_array($value) && !empty($value['delete'])) {
         $object->setData($this->getAttribute()->getName(), '');
         $this->getAttribute()->getEntity()->saveAttribute($object, $this->getAttribute()->getName());
         return $this;
     }
     $path = Mage::getBaseDir('media') . DS . 'goodahead' . DS . 'etm' . DS . 'images' . DS . $object->getEntityTypeInstance()->getEntityTypeCode() . DS . $this->getAttribute()->getAttributeCode() . DS;
     try {
         $uploader = new Varien_File_Uploader($this->getAttribute()->getName());
         $uploader->setAllowedExtensions(array('jpg', 'jpeg', 'gif', 'png'));
         $uploader->setAllowRenameFiles(true);
         $uploader->setAllowCreateFolders(true);
         $uploader->setFilesDispersion(true);
         $uploader->save($path);
         $object->setData($this->getAttribute()->getName(), $uploader->getUploadedFileName());
         $this->getAttribute()->getEntity()->saveAttribute($object, $this->getAttribute()->getName());
     } catch (Exception $e) {
         if ($e->getCode() != Varien_File_Uploader::TMP_NAME_EMPTY) {
             Mage::logException($e);
         }
         /** @TODO ??? */
         return $this;
     }
     return $this;
 }
开发者ID:eniuz,项目名称:entitytype-manager,代码行数:34,代码来源:Image.php

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

示例8: afterSave

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

示例9: afterSave

 public function afterSave($object)
 {
     parent::afterSave($object);
     $object->getItemsCollection()->save();
     $object->getShippingRatesCollection()->save();
     return $this;
 }
开发者ID:arslbbt,项目名称:mangentovies,代码行数:7,代码来源:Parent.php

示例10: getAttribute

 /**
  * Get attribute instance
  *
  * @return Mage_Eav_Model_Entity_Attribute_Abstract
  */
 public function getAttribute()
 {
     if (is_null($this->_attribute)) {
         $attribute = Mage::getModel('eav/entity_attribute')->loadByCode('catalog_category', 'virtual_category');
         $this->setAttribute($attribute);
     }
     return parent::getAttribute();
 }
开发者ID:anndream,项目名称:smile-magento-elasticsearch,代码行数:13,代码来源:Virtual.php

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

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

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

示例14: beforeSave

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

示例15: afterSave

 public function afterSave($object)
 {
     parent::afterSave($object);
     $object->getAddressesCollection()->save();
     $object->getItemsCollection()->save();
     $object->getPaymentsCollection()->save();
     return $this;
 }
开发者ID:arslbbt,项目名称:mangentovies,代码行数:8,代码来源:Parent.php


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