예제 #1
0
 /**
  * Adding attribute to entity
  *
  * @param   Mage_Eav_Model_Entity_Attribute_Abstract $attribute
  * @return  Mage_Eav_Model_Entity_Abstract
  */
 public function addAttribute(Mage_Eav_Model_Entity_Attribute_Abstract $attribute)
 {
     $attribute->setEntity($this);
     $attributeCode = $attribute->getAttributeCode();
     $this->_attributesByCode[$attributeCode] = $attribute;
     if ($attribute->isStatic()) {
         $this->_staticAttributes[$attributeCode] = $attribute;
     } else {
         $this->_attributesById[$attribute->getId()] = $attribute;
         $this->_attributesByTable[$attribute->getBackendTable()][$attributeCode] = $attribute;
     }
     return $this;
 }
예제 #2
0
파일: Import.php 프로젝트: nemphys/magento2
 /**
  * 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();
     }
 }