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


PHP Mage_Eav_Model_Entity_Attribute_Abstract类代码示例

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


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

示例1: isAttributeAllowed

 protected function isAttributeAllowed(Mage_Eav_Model_Entity_Attribute_Abstract $attribute)
 {
     if ($attribute->getFrontendLabel()) {
         return true;
     }
     return false;
 }
开发者ID:jsiefer,项目名称:emarketing,代码行数:7,代码来源:Attribute.php

示例2: _isAllowedAttribute

 /**
  * Check is attribute allowed
  *
  * @param Mage_Eav_Model_Entity_Attribute_Abstract $attribute
  * @param array $attributes
  * @return boolean
  */
 protected function _isAllowedAttribute($attribute, array $filter = null)
 {
     if (!is_null($filter) && !(in_array($attribute->getAttributeCode(), $filter) || in_array($attribute->getAttributeId(), $filter))) {
         return false;
     }
     return !in_array($attribute->getFrontendInput(), $this->_ignoredAttributeTypes) && !in_array($attribute->getAttributeCode(), $this->_ignoredAttributeCodes);
 }
开发者ID:chucky515,项目名称:Magento-CE-Mirror,代码行数:14,代码来源:Resource.php

示例3: _isAttributeIndexable

 protected function _isAttributeIndexable(Mage_Eav_Model_Entity_Attribute_Abstract $attribute)
 {
     if ($attribute->getAttributeCode() != 'tier_price') {
         return false;
     }
     return true;
 }
开发者ID:jpbender,项目名称:mage_virtual,代码行数:7,代码来源:Tierprice.php

示例4: setPricingLabelFromAttribute

 public function setPricingLabelFromAttribute(Mage_Eav_Model_Entity_Attribute_Abstract $attribute)
 {
     if ($attribute->getSource()) {
         $this->setLabel($attribute->getSource()->getOptionText($this->getValueIndex()));
     } else {
         $this->setLabel($this->getValueIndex());
     }
     return $this;
 }
开发者ID:arslbbt,项目名称:mangentovies,代码行数:9,代码来源:Pricing.php

示例5: _isAttributeIndexable

 protected function _isAttributeIndexable(Mage_Eav_Model_Entity_Attribute_Abstract $attribute)
 {
     if ($attribute->getIsFilterable() == 0 && $attribute->getIsVisibleInAdvancedSearch() == 0) {
         return false;
     }
     if ($attribute->getFrontendInput() != 'select' && $attribute->getFrontendInput() != 'multiselect') {
         return false;
     }
     return true;
 }
开发者ID:jauderho,项目名称:magento-mirror,代码行数:10,代码来源:Eav.php

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

示例7: deleteProductData

 /**
  * Delete product data
  *
  * @param Mage_Catalog_Model_Product $product
  * @param Mage_Eav_Model_Entity_Attribute_Abstract $attribute
  * @return Mage_Weee_Model_Resource_Attribute_Backend_Weee_Tax
  */
 public function deleteProductData($product, $attribute)
 {
     $where = array('entity_id = ?' => (int) $product->getId(), 'attribute_id = ?' => (int) $attribute->getId());
     $adapter = $this->_getWriteAdapter();
     if (!$attribute->isScopeGlobal()) {
         $storeId = $product->getStoreId();
         if ($storeId) {
             $where['website_id IN(?)'] = array(0, Mage::app()->getStore($storeId)->getWebsiteId());
         }
     }
     $adapter->delete($this->getMainTable(), $where);
     return $this;
 }
开发者ID:cnglobal-sl,项目名称:caterez,代码行数:20,代码来源:Tax.php

示例8: 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();
     $joinCondition = "`e`.`entity_id`=`t1`.`entity_id`";
     if ($attribute->getFlatAddChildData()) {
         $joinCondition .= " AND `e`.`child_id`=`t1`.`entity_id`";
     }
     $valueExpr = new Zend_Db_Expr("IFNULL(t2.value, t1.value)");
     $select = $this->_getReadAdapter()->select()->joinLeft(array('t1' => $attributeTable), $joinCondition, 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);
     if ($attribute->getFlatAddChildData()) {
         $select->where("e.is_child=?", 0);
     }
     return $select;
 }
开发者ID:jauderho,项目名称:magento-mirror,代码行数:27,代码来源:Option.php

示例9: 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, 't1', '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:evinw,项目名称:project_bloom_magento,代码行数:30,代码来源:Option.php

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

示例11: _isAllowedAttribute

 /**
  * Check if attribute allowed
  *
  * @param Mage_Eav_Model_Entity_Attribute_Abstract $attribute
  * @param array $attributes
  * @return boolean
  */
 protected function _isAllowedAttribute($attribute)
 {
     return !in_array($attribute->getFrontendInput(), $this->_ignoredAttributeTypes) && !in_array($attribute->getAttributeCode(), $this->_ignoredAttributeCodes) && $attribute->getFrontendLabel() != "";
 }
开发者ID:hazaeluz,项目名称:magento_connect,代码行数:11,代码来源:Attribute.php

示例12: getDateInput

 /**
  * Build date element html string for attribute
  *
  * @param Mage_Eav_Model_Entity_Attribute_Abstract $attribute
  * @param string $part
  * @return string
  */
 public function getDateInput($attribute, $part = 'from')
 {
     $name = $attribute->getAttributeCode() . '[' . $part . ']';
     $value = $this->getAttributeValue($attribute, $part);
     return $this->_getDateBlock()->setName($name)->setId($attribute->getAttributeCode() . ($part == 'from' ? '' : '_' . $part))->setTitle($this->getAttributeLabel($attribute))->setValue($value)->setImage($this->getSkinUrl('images/calendar.gif'))->setFormat('%m/%d/%y')->setClass('input-text')->getHtml();
 }
开发者ID:blazeriaz,项目名称:youguess,代码行数:13,代码来源:Form.php

示例13: _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:hyhoocchan,项目名称:mage-local,代码行数:18,代码来源:Item.php

示例14: getAttributeType

 /**
  * Get attribute type for upcoming validation.
  *
  * @param Mage_Eav_Model_Entity_Attribute_Abstract|Mage_Eav_Model_Entity_Attribute $attribute
  * @return string
  */
 public static function getAttributeType(Mage_Eav_Model_Entity_Attribute_Abstract $attribute)
 {
     if ($attribute->usesSource()) {
         return $attribute->getFrontendInput() == 'multiselect' ? 'multiselect' : 'select';
     } elseif ($attribute->isStatic()) {
         return $attribute->getFrontendInput() == 'date' ? 'datetime' : 'varchar';
     } else {
         return $attribute->getBackendType();
     }
 }
开发者ID:nemphys,项目名称:magento2,代码行数:16,代码来源:Import.php

示例15: _getFieldMapping

 /**
  * get elasticsearch field mapping
  *
  * @param $attribute Mage_Eav_Model_Entity_Attribute_Abstract
  * @param $fieldType
  * @return array
  */
 protected function _getFieldMapping(Mage_Eav_Model_Entity_Attribute_Abstract $attribute, $fieldType, $fieldName)
 {
     switch ($fieldType) {
         case 'date':
             $mapping['type'] = 'date';
             $mapping['format'] = 'yyyy-MM-dd HH:mm:ss||yyyy-MM-dd';
             break;
         case 'string':
             //@todo add backend flags for analyzers and so on
             if (1 == $attribute->getisSearchable() || 1 == $attribute->getisVisibleInAdvancedSearch()) {
                 $mapping = array('type' => 'multi_field', 'fields' => array($fieldName => array("store" => 'no', 'type' => 'string', 'boost' => $attribute->getSearchWeight()), 'untouched' => array('type' => 'string', 'index' => 'not_analyzed')));
                 //for now we implementing all analyzer
                 //@todo make multiselect in backend to make analyser selectable
                 $settings = $this->_getIndexSettings();
                 foreach (array_keys($settings['analysis']['analyzer']) as $analyzer) {
                     $mapping['fields'][$analyzer] = array('type' => 'string', 'analyzer' => $analyzer, 'boost' => $attribute->getSearchWeight());
                 }
             } else {
                 $mapping = array('type' => 'string', 'index' => 'not_analyzed');
             }
             break;
         default:
             $mapping = array('type' => $fieldType);
             break;
     }
     return $mapping;
 }
开发者ID:Mohitsahu123,项目名称:Elasticgento,代码行数:34,代码来源:Mappings.php


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