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


PHP Mage_Eav_Model_Entity_Attribute_Abstract::getBackend方法代码示例

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


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

示例1: _saveAttribute

 /**
  * @param Mage_Eav_Model_Entity_Type $object
  * @param Mage_Eav_Model_Entity_Attribute_Abstract $attribute
  * @param mixed $value
  * @return $this
  * @throws Mage_Core_Exception
  */
 protected function _saveAttribute($object, $attribute, $value)
 {
     $table = $attribute->getBackend()->getTable();
     if (!isset($this->_attributeValuesToSave[$table])) {
         $this->_attributeValuesToSave[$table] = array();
     }
     $entityIdField = $attribute->getBackend()->getEntityIdField();
     $data = array('entity_type_id' => $object->getEntityTypeId(), $entityIdField => $object->getId(), 'attribute_id' => $attribute->getId(), 'value' => $this->_prepareValueForSave($value, $attribute));
     $this->_attributeValuesToSave[$table][] = $data;
     $this->_saveEntityData($object);
     return $this;
 }
开发者ID:sereban,项目名称:magento-marketo-integration,代码行数:19,代码来源:Abstract.php

示例2: getFlatUpdateSelect

 /**
  * Retrieve Select for update Flat data
  *
  * @param   Mage_Eav_Model_Entity_Attribute_Abstract $attribute
  * @param   int $store
  * @param   bool $hasValueField flag which require option value
  * @return  Varien_Db_Select
  */
 public function getFlatUpdateSelect(Mage_Eav_Model_Entity_Attribute_Abstract $attribute, $store, $hasValueField = true)
 {
     $attributeTable = $attribute->getBackend()->getTable();
     $attributeCode = $attribute->getAttributeCode();
     $valueExpr = new Zend_Db_Expr("IFNULL(t2.value, t1.value)");
     $select = $this->_getReadAdapter()->select()->joinLeft(array('t1' => $attributeTable), "`e`.`entity_id`=`t1`.`entity_id` AND `e`.`child_id`=`t1`.`entity_id`", array())->joinLeft(array('t2' => $attributeTable), "`t2`.`entity_id`=`t1`.`entity_id`" . " AND `t1`.`entity_type_id`=`t2`.`entity_type_id`" . " AND `t1`.`attribute_id`=`t2`.`attribute_id`" . " AND `t2`.`store_id`={$store}", array($attributeCode => $valueExpr));
     if ($attribute->getFrontend()->getInputType() != 'multiselect' && $hasValueField) {
         $select->joinLeft(array('to1' => $this->getTable('eav/attribute_option_value')), "`to1`.`option_id`={$valueExpr}" . " AND `to1`.`store_id`='0'", array())->joinLeft(array('to2' => $this->getTable('eav/attribute_option_value')), "`to2`.`option_id`={$valueExpr}" . " AND `to2`.`store_id`='{$store}'", array($attributeCode . '_value' => "IFNULL(`to2`.`value`, `to1`.`value`)"));
     }
     $select->where('t1.entity_type_id=?', $attribute->getEntityTypeId())->where('t1.attribute_id=?', $attribute->getId())->where('t1.store_id=?', 0);
     return $select;
 }
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:20,代码来源:Mysql4_Entity_Attribute_Option.php

示例3: checkAttributeUniqueValue

 /**
  * Enter description here...
  *
  * @param Mage_Eav_Model_Entity_Attribute_Abstract $attribute
  * @param Varien_Object $object
  * @return boolean
  */
 public function checkAttributeUniqueValue(Mage_Eav_Model_Entity_Attribute_Abstract $attribute, $object)
 {
     $value = $object->getData($attribute->getAttributeCode());
     if ($attribute->getBackend()->getType() == 'datetime') {
         $date = new Zend_Date($value);
         $value = $date->toString(Varien_Date::DATETIME_INTERNAL_FORMAT);
     }
     $data = $this->_getWriteAdapter()->getCollection($this->getEntityTable())->findOne(array($attribute->getAttributeCode() => $value), array($this->getEntityIdField() => 1));
     if ($object->getId()) {
         if ($data) {
             return $data[$this->getEntityIdField()] == $object->getId();
         }
         return true;
     } else {
         return !$data;
     }
 }
开发者ID:walexer,项目名称:magento-mongo,代码行数:24,代码来源:Entity.php

示例4: getFlatUpdateSelect

 /**
  * Retrieve Select for update Flat data
  *
  * @param   Mage_Eav_Model_Entity_Attribute_Abstract $attribute
  * @param   int $store
  * @param   bool $hasValueField flag which require option value
  * @return  Varien_Db_Select
  */
 public function getFlatUpdateSelect(Mage_Eav_Model_Entity_Attribute_Abstract $attribute, $store, $hasValueField = true)
 {
     $attributeTable = $attribute->getBackend()->getTable();
     $attributeCode = $attribute->getAttributeCode();
     $joinConditionTemplate = "`e`.`entity_id`=`%s`.`entity_id`" . " AND `%s`.`entity_type_id` = " . $attribute->getEntityTypeId() . " AND `%s`.`attribute_id` = " . $attribute->getId() . " AND `%s`.`store_id` = %d";
     $joinCondition = sprintf($joinConditionTemplate, 't1', 't1', 't1', 't1', Mage_Core_Model_App::ADMIN_STORE_ID);
     if ($attribute->getFlatAddChildData()) {
         $joinCondition .= " AND `e`.`child_id`=`t1`.`entity_id`";
     }
     $valueExpr = new Zend_Db_Expr("IF(t2.value_id>0, t2.value, t1.value)");
     $select = $this->_getReadAdapter()->select()->joinLeft(array('t1' => $attributeTable), $joinCondition, array())->joinLeft(array('t2' => $attributeTable), sprintf($joinConditionTemplate, 't2', 't2', 't2', 't2', $store), array($attributeCode => $valueExpr));
     if ($attribute->getFrontend()->getInputType() != 'multiselect' && $hasValueField) {
         $select->joinLeft(array('to1' => $this->getTable('eav/attribute_option_value')), "`to1`.`option_id`={$valueExpr}" . " AND `to1`.`store_id`='0'", array())->joinLeft(array('to2' => $this->getTable('eav/attribute_option_value')), "`to2`.`option_id`={$valueExpr}" . " AND `to2`.`store_id`='{$store}'", array($attributeCode . '_value' => "IFNULL(`to2`.`value`, `to1`.`value`)"));
     }
     if ($attribute->getFlatAddChildData()) {
         $select->where("e.is_child=?", 0);
     }
     return $select;
 }
开发者ID:votanlean,项目名称:Magento-Pruebas,代码行数:27,代码来源:Option.php

示例5: _saveAttributeValue

 /**
  * Insert or Update attribute data
  *
  * @param Mage_Catalog_Model_Abstract $object
  * @param Mage_Eav_Model_Entity_Attribute_Abstract $attribute
  * @param mixed $value
  * @return Mage_Catalog_Model_Resource_Abstract
  */
 protected function _saveAttributeValue($object, $attribute, $value)
 {
     $write = $this->_getWriteAdapter();
     //set default store id
     $storeId = Mage_Catalog_Model_Abstract::DEFAULT_STORE_ID;
     $table = $attribute->getBackend()->getTable();
     /**
      * If we work in single store mode all values should be saved just
      * for default store id
      * In this case we clear all not default values
      */
     if (Mage::app()->isSingleStoreMode()) {
         $storeId = $this->getDefaultStoreId();
         $write->delete($table, array('attribute_id = ?' => $attribute->getAttributeId(), 'entity_id = ?' => $object->getEntityId(), 'store_id <> ?' => $storeId));
     }
     $data = new Varien_Object(array('entity_type_id' => $attribute->getEntityTypeId(), 'attribute_id' => $attribute->getAttributeId(), 'store_id' => $storeId, 'entity_id' => $object->getEntityId(), 'value' => $this->_prepareValueForSave($value, $attribute)));
     $bind = $this->_prepareDataForTable($data, $table);
     if ($attribute->isScopeStore()) {
         /**
          * Update attribute value for store
          */
         $this->_attributeValuesToSave[$table][] = $bind;
     } else {
         if ($attribute->isScopeWebsite() && $storeId != $this->getDefaultStoreId()) {
             /**
              * Update attribute value for website
              */
             $storeIds = Mage::app()->getStore($storeId)->getWebsite()->getStoreIds(true);
             foreach ($storeIds as $storeId) {
                 $bind['store_id'] = (int) $storeId;
                 $this->_attributeValuesToSave[$table][] = $bind;
             }
         } else {
             /**
              * Update global attribute value
              */
             $bind['store_id'] = $this->getDefaultStoreId();
             $this->_attributeValuesToSave[$table][] = $bind;
         }
     }
     return $this;
 }
开发者ID:magebrew,项目名称:magentoSetBaseImage,代码行数:50,代码来源:Product.php

示例6: getFlatUpdateSelect

 /**
  * Retrieve Select for update Flat data
  *
  * @param Mage_Eav_Model_Entity_Attribute_Abstract $attribute
  * @param int $store
  * @param bool $hasValueField flag which require option value
  * @return Varien_Db_Select
  */
 public function getFlatUpdateSelect(Mage_Eav_Model_Entity_Attribute_Abstract $attribute, $store, $hasValueField = true)
 {
     $adapter = $this->_getReadAdapter();
     $attributeTable = $attribute->getBackend()->getTable();
     $attributeCode = $attribute->getAttributeCode();
     $joinConditionTemplate = "%s.entity_id = %s.entity_id" . " AND %s.entity_type_id = " . $attribute->getEntityTypeId() . " AND %s.attribute_id = " . $attribute->getId() . " AND %s.store_id = %d";
     $joinCondition = sprintf($joinConditionTemplate, 'e', 't1', 't1', 't1', 't1', Mage_Core_Model_App::ADMIN_STORE_ID);
     if ($attribute->getFlatAddChildData()) {
         $joinCondition .= ' AND e.child_id = t1.entity_id';
     }
     $valueExpr = $adapter->getCheckSql('t2.value_id > 0', 't2.value', 't1.value');
     /** @var $select Varien_Db_Select */
     $select = $adapter->select()->joinLeft(array('t1' => $attributeTable), $joinCondition, array())->joinLeft(array('t2' => $attributeTable), sprintf($joinConditionTemplate, 'e', 't2', 't2', 't2', 't2', $store), array($attributeCode => $valueExpr));
     if ($attribute->getFrontend()->getInputType() != 'multiselect' && $hasValueField) {
         $valueIdExpr = $adapter->getCheckSql('to2.value_id > 0', 'to2.value', 'to1.value');
         $select->joinLeft(array('to1' => $this->getTable('eav/attribute_option_value')), "to1.option_id = {$valueExpr} AND to1.store_id = 0", array())->joinLeft(array('to2' => $this->getTable('eav/attribute_option_value')), $adapter->quoteInto("to2.option_id = {$valueExpr} AND to2.store_id = ?", $store), array($attributeCode . '_value' => $valueIdExpr));
     }
     if ($attribute->getFlatAddChildData()) {
         $select->where("e.is_child = ?", 0);
     }
     return $select;
 }
开发者ID:QiuLihua83,项目名称:magento-enterprise-1.13.1.0,代码行数:30,代码来源:Option.php

示例7: getAttributeInputType

 /**
  * Retrieve attribute input type
  *
  * @param Mage_Eav_Model_Entity_Attribute_Abstract $attribute
  * @return  string
  */
 public function getAttributeInputType($attribute)
 {
     $dataType = $attribute->getBackend()->getType();
     $imputType = $attribute->getFrontend()->getInputType();
     if ($imputType == 'select' || $imputType == 'multiselect') {
         return 'select';
     }
     if ($imputType == 'boolean') {
         return 'yesno';
     }
     if ($imputType == 'price') {
         return 'price';
     }
     if ($dataType == 'int' || $dataType == 'decimal') {
         return 'number';
     }
     if ($dataType == 'datetime') {
         return 'date';
     }
     return 'string';
 }
开发者ID:blazeriaz,项目名称:youguess,代码行数:27,代码来源:Form.php

示例8: getFlatUpdateSelect

 /**
  * Retrieve Select For Flat Attribute update
  *
  * @param Mage_Eav_Model_Entity_Attribute_Abstract $attribute
  * @param int $storeId
  * @return Varien_Db_Select
  */
 public function getFlatUpdateSelect(Mage_Eav_Model_Entity_Attribute_Abstract $attribute, $storeId)
 {
     $adapter = $this->_getReadAdapter();
     $joinConditionTemplate = "%s.entity_id=%s.entity_id" . " AND %s.entity_type_id = " . $attribute->getEntityTypeId() . " AND %s.attribute_id = " . $attribute->getId() . " AND %s.store_id = %d";
     $joinCondition = sprintf($joinConditionTemplate, 'e', 't1', 't1', 't1', 't1', Mage_Core_Model_App::ADMIN_STORE_ID);
     if ($attribute->getFlatAddChildData()) {
         $joinCondition .= ' AND e.child_id = t1.entity_id';
     }
     $valueExpr = $adapter->getCheckSql('t2.value_id > 0', 't2.value', 't1.value');
     /** @var $select Varien_Db_Select */
     $select = $adapter->select()->joinLeft(array('t1' => $attribute->getBackend()->getTable()), $joinCondition, array())->joinLeft(array('t2' => $attribute->getBackend()->getTable()), sprintf($joinConditionTemplate, 't1', 't2', 't2', 't2', 't2', $storeId), array($attribute->getAttributeCode() => $valueExpr));
     if ($attribute->getFlatAddChildData()) {
         $select->where("e.is_child = ?", 0);
     }
     return $select;
 }
开发者ID:natxetee,项目名称:magento2,代码行数:23,代码来源:Attribute.php

示例9: _saveAttributeValue

 /**
  * Insert or Update attribute data
  *
  * @param Mage_Catalog_Model_Abstract $object
  * @param Mage_Eav_Model_Entity_Attribute_Abstract $attribute
  * @param mixed $value
  * @return Mage_Catalog_Model_Resource_Eav_Mysql4_Abstract
  */
 protected function _saveAttributeValue($object, $attribute, $value)
 {
     $write = $this->_getWriteAdapter();
     $storeId = Mage::app()->getStore($object->getStoreId())->getId();
     $table = $attribute->getBackend()->getTable();
     /**
      * If we work in single store mode all values should be saved just
      * for default store id
      * In this case we clear all not default values
      */
     if (Mage::app()->isSingleStoreMode()) {
         $storeId = $this->getDefaultStoreId();
         $write->delete($table, join(' AND ', array($write->quoteInto('attribute_id=?', $attribute->getAttributeId()), $write->quoteInto('entity_id=?', $object->getEntityId()), $write->quoteInto('store_id<>?', $storeId))));
     }
     $bind = array('entity_type_id' => $attribute->getEntityTypeId(), 'attribute_id' => $attribute->getAttributeId(), 'store_id' => $storeId, 'entity_id' => $object->getEntityId(), 'value' => $this->_prepareValueForSave($value, $attribute));
     if ($attribute->isScopeStore()) {
         /**
          * Update attribute value for store
          */
         $this->_attributeValuesToSave[$table][] = $bind;
     } else {
         if ($attribute->isScopeWebsite() && $storeId != $this->getDefaultStoreId()) {
             /**
              * Update attribute value for website
              */
             $storeIds = $object->getWebsiteStoreIds();
             foreach ($storeIds as $storeId) {
                 $bind['store_id'] = $storeId;
                 $this->_attributeValuesToSave[$table][] = $bind;
             }
         } else {
             /**
              * Update global attribute value
              */
             $bind['store_id'] = $this->getDefaultStoreId();
             $this->_attributeValuesToSave[$table][] = $bind;
         }
     }
     return $this;
 }
开发者ID:joebushi,项目名称:magento-mirror,代码行数:48,代码来源:Abstract.php

示例10: getFlatUpdateSelect

 /**
  * Retrieve Select For Flat Attribute update
  *
  * @param Mage_Eav_Model_Entity_Attribute_Abstract $attribute
  * @param int $store
  * @return Varien_Db_Select
  */
 public function getFlatUpdateSelect(Mage_Eav_Model_Entity_Attribute_Abstract $attribute, $store)
 {
     $joinCondition = "`e`.`entity_id`=`t1`.`entity_id`";
     if ($attribute->getFlatAddChildData()) {
         $joinCondition .= " AND `e`.`child_id`=`t1`.`entity_id`";
     }
     $select = $this->_getReadAdapter()->select()->joinLeft(array('t1' => $attribute->getBackend()->getTable()), $joinCondition, array())->joinLeft(array('t2' => $attribute->getBackend()->getTable()), "t2.entity_id = t1.entity_id" . " AND t1.entity_type_id = t2.entity_type_id" . " AND t1.attribute_id = t2.attribute_id" . " AND t2.store_id = {$store}", array($attribute->getAttributeCode() => "IF(t2.value_id>0, t2.value, t1.value)"))->where("t1.entity_type_id=?", $attribute->getEntityTypeId())->where("t1.attribute_id=?", $attribute->getId())->where("t1.store_id=?", 0);
     if ($attribute->getFlatAddChildData()) {
         $select->where("e.is_child=?", 0);
     }
     return $select;
 }
开发者ID:jpbender,项目名称:mage_virtual,代码行数:19,代码来源:Attribute.php

示例11: _insertAttribute

 /**
  * Insert entity attribute value
  *
  * Insert attribute value we do only for default store
  *
  * @param   Varien_Object $object
  * @param   Mage_Eav_Model_Entity_Attribute_Abstract $attribute
  * @param   mixed $value
  * @return  Mage_Eav_Model_Entity_Abstract
  */
 protected function _insertAttribute($object, $attribute, $value)
 {
     $entityIdField = $attribute->getBackend()->getEntityIdField();
     $row = array($entityIdField => $object->getId(), 'entity_type_id' => $object->getEntityTypeId(), 'attribute_id' => $attribute->getId(), 'value' => $value, 'store_id' => $this->getDefaultStoreId());
     $this->_getWriteAdapter()->insert($attribute->getBackend()->getTable(), $row);
     return $this;
 }
开发者ID:arslbbt,项目名称:mangentovies,代码行数:17,代码来源:Abstract.php

示例12: getFlatUpdateSelect

 /**
  * Retrieve Select For Flat Attribute update
  *
  * @param Mage_Eav_Model_Entity_Attribute_Abstract $attribute
  * @param int $store
  * @return Varien_Db_Select
  */
 public function getFlatUpdateSelect(Mage_Eav_Model_Entity_Attribute_Abstract $attribute, $store)
 {
     $joinConditionTemplate = "`e`.`entity_id`=`%s`.`entity_id`" . " AND `%s`.`entity_type_id` = " . $attribute->getEntityTypeId() . " AND `%s`.`attribute_id` = " . $attribute->getId() . " AND `%s`.`store_id` = %d";
     $joinCondition = sprintf($joinConditionTemplate, 't1', 't1', 't1', 't1', Mage_Core_Model_App::ADMIN_STORE_ID);
     if ($attribute->getFlatAddChildData()) {
         $joinCondition .= " AND `e`.`child_id`=`t1`.`entity_id`";
     }
     $select = $this->_getReadAdapter()->select()->joinLeft(array('t1' => $attribute->getBackend()->getTable()), $joinCondition, array())->joinLeft(array('t2' => $attribute->getBackend()->getTable()), sprintf($joinConditionTemplate, 't2', 't2', 't2', 't2', $store), array($attribute->getAttributeCode() => "IF(t2.value_id>0, t2.value, t1.value)"));
     if ($attribute->getFlatAddChildData()) {
         $select->where("e.is_child=?", 0);
     }
     return $select;
 }
开发者ID:votanlean,项目名称:Magento-Pruebas,代码行数:20,代码来源:Attribute.php

示例13: _updateAttribute

 /**
  * Update entity attribute value
  *
  * @param   Varien_Object $object
  * @param   Mage_Eav_Model_Entity_Attribute_Abstract $attribute
  * @param   mixed $valueId
  * @param   mixed $value
  * @return  Mage_Eav_Model_Entity_Abstract
  */
 protected function _updateAttribute($object, $attribute, $valueId, $value)
 {
     $this->_getWriteAdapter()->update($attribute->getBackend()->getTable(), array('value' => $this->_prepareValueForSave($value, $attribute)), 'value_id=' . (int) $valueId);
     return $this;
 }
开发者ID:jauderho,项目名称:magento-mirror,代码行数:14,代码来源:Abstract.php

示例14: _joinCustomerAttibute

 /**
  * Join customer attribute
  *
  * @param Mage_Eav_Model_Entity_Attribute_Abstract $attribute
  */
 protected function _joinCustomerAttibute(Mage_Eav_Model_Entity_Attribute_Abstract $attribute)
 {
     $tableName = 'at_' . $attribute->getName();
     $joinExpr = array($tableName . '.entity_id = wishlist_table.customer_id', $this->getSelect()->getAdapter()->quoteInto($tableName . '.attribute_id = ?', $attribute->getAttributeId()));
     $this->getSelect()->joinLeft(array($tableName => $attribute->getBackend()->getTable()), implode(' AND ', $joinExpr), array());
 }
开发者ID:hientruong90,项目名称:ee_14_installer,代码行数:11,代码来源:Collection.php

示例15: _updateAttribute

 /**
  * Update entity attribute value
  *
  * @param   Varien_Object $object
  * @param   Mage_Eav_Model_Entity_Attribute_Abstract $attribute
  * @param   mixed $valueId
  * @param   mixed $value
  * @return  Mage_Eav_Model_Entity_Abstract
  */
 protected function _updateAttribute($object, $attribute, $valueId, $value)
 {
     /**
      * If we work in single store mode all values should be saved just
      * for default store id
      * In this case we clear all not default values
      */
     if (AO::app()->isSingleStoreMode()) {
         $this->_getWriteAdapter()->delete($attribute->getBackend()->getTable(), $this->_getWriteAdapter()->quoteInto('attribute_id=?', $attribute->getId()) . $this->_getWriteAdapter()->quoteInto(' AND entity_id=?', $object->getId()) . $this->_getWriteAdapter()->quoteInto(' AND store_id!=?', Mage_Catalog_Model_Abstract::DEFAULT_STORE_ID));
     }
     /**
      * Update attribute value for store
      */
     if ($attribute->isScopeStore()) {
         $this->_updateAttributeForStore($object, $attribute, $value, $object->getStoreId());
     } elseif ($attribute->isScopeWebsite()) {
         if ($object->getStoreId() == 0) {
             $this->_updateAttributeForStore($object, $attribute, $value, $object->getStoreId());
         } else {
             if (is_array($object->getWebsiteStoreIds())) {
                 foreach ($object->getWebsiteStoreIds() as $storeId) {
                     $this->_updateAttributeForStore($object, $attribute, $value, $storeId);
                 }
             }
         }
     } else {
         $this->_getWriteAdapter()->update($attribute->getBackend()->getTable(), array('value' => $this->_prepareValueForSave($value, $attribute)), 'value_id=' . (int) $valueId);
     }
     return $this;
 }
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:39,代码来源:Resource_Eav_Mysql4_Abstract.php


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