Example #1
0
 /**
  * Adds bundle price type to internal attributes.
  *
  * @return Danslo_ApiImport_Model_Import_Entity_Product_Type_Bundle
  */
 public function _initAttributes()
 {
     parent::_initAttributes();
     // Price type does not live in an attribute set, so it is not picked up by abstract _initAttributes method. We add it here manually.
     $attribute = Mage::getResourceModel('catalog/eav_attribute')->load('price_type', 'attribute_code');
     foreach (array_keys($this->_attributes) as $attrSetName) {
         $this->_addAttributeParams($attrSetName, array('id' => $attribute->getId(), 'code' => $attribute->getAttributeCode(), 'for_configurable' => $attribute->getIsConfigurable(), 'is_global' => $attribute->getIsGlobal(), 'is_required' => $attribute->getIsRequired(), 'is_unique' => $attribute->getIsUnique(), 'frontend_label' => $attribute->getFrontendLabel(), 'is_static' => $attribute->isStatic(), 'apply_to' => $attribute->getApplyTo(), 'type' => Mage_ImportExport_Model_Import::getAttributeType($attribute), 'default_value' => strlen($attribute->getDefaultValue()) ? $attribute->getDefaultValue() : null, 'options' => $this->_entityModel->getAttributeOptions($attribute, $this->_indexValueAttributes)));
     }
     return $this;
 }
Example #2
0
 /**
  * Initialize attributes parameters for all attributes' sets.
  *
  * @return Mage_ImportExport_Model_Import_Entity_Product_Type_Abstract
  */
 protected function _initAttributes()
 {
     // temporary storage for attributes' parameters to avoid double querying inside the loop
     $attributesCache = array();
     foreach (Mage::getResourceModel('eav/entity_attribute_set_collection')->setEntityTypeFilter($this->_entityModel->getEntityTypeId()) as $attributeSet) {
         foreach (Mage::getResourceModel('catalog/product_attribute_collection')->setAttributeSetFilter($attributeSet->getId()) as $attribute) {
             $attributeCode = $attribute->getAttributeCode();
             $attributeId = $attribute->getId();
             if ($attribute->getIsVisible() || in_array($attributeCode, $this->_forcedAttributesCodes)) {
                 if (!isset($attributesCache[$attributeId])) {
                     $attributesCache[$attributeId] = array('id' => $attributeId, 'code' => $attributeCode, 'for_configurable' => $attribute->getIsConfigurable(), 'is_global' => $attribute->getIsGlobal(), 'is_required' => $attribute->getIsRequired(), 'frontend_label' => $attribute->getFrontendLabel(), 'frontend_input' => $attribute->getFrontendInput(), 'is_static' => $attribute->isStatic(), 'apply_to' => $attribute->getApplyTo(), 'type' => Mage_ImportExport_Model_Import::getAttributeType($attribute), 'default_value' => strlen($attribute->getDefaultValue()) ? $attribute->getDefaultValue() : null, 'options' => $this->_entityModel->getAttributeOptions($attribute, $this->_indexValueAttributes));
                 }
                 $this->_addAttributeParams($attributeSet->getAttributeSetName(), $attributesCache[$attributeId]);
             }
         }
     }
     return $this;
 }
 /**
  * Initialize customer attributes.
  *
  * @return Mage_ImportExport_Model_Import_Entity_Customer
  */
 protected function _initAttributes()
 {
     $collection = Mage::getResourceModel('customer/attribute_collection')->addSystemHiddenFilterWithPasswordHash();
     foreach ($collection as $attribute) {
         $this->_attributes[$attribute->getAttributeCode()] = array('id' => $attribute->getId(), 'is_required' => $attribute->getIsRequired(), 'is_static' => $attribute->isStatic(), 'rules' => $attribute->getValidateRules() ? unserialize($attribute->getValidateRules()) : null, 'type' => Mage_ImportExport_Model_Import::getAttributeType($attribute), 'options' => $this->getAttributeOptions($attribute));
     }
     return $this;
 }
Example #4
0
 /**
  * Initialize attribute option values and types.
  *
  * @return Mage_ImportExport_Model_Export_Entity_Product
  */
 protected function _initAttributes()
 {
     foreach ($this->getAttributeCollection() as $attribute) {
         $this->_attributeValues[$attribute->getAttributeCode()] = $this->getAttributeOptions($attribute);
         $this->_attributeTypes[$attribute->getAttributeCode()] = Mage_ImportExport_Model_Import::getAttributeType($attribute);
     }
     return $this;
 }
Example #5
0
 /**
  * Initialize customer address attributes.
  *
  * @return Mage_ImportExport_Model_Import_Entity_Customer_Address
  */
 protected function _initAttributes()
 {
     $addrCollection = Mage::getResourceModel('customer/address_attribute_collection')->addSystemHiddenFilter()->addExcludeHiddenFrontendFilter();
     foreach ($addrCollection as $attribute) {
         $this->_attributes[self::getColNameForAttrCode($attribute->getAttributeCode())] = array('id' => $attribute->getId(), 'code' => $attribute->getAttributeCode(), 'table' => $attribute->getBackend()->getTable(), 'is_required' => $attribute->getIsRequired(), 'rules' => $attribute->getValidateRules() ? unserialize($attribute->getValidateRules()) : null, 'type' => Mage_ImportExport_Model_Import::getAttributeType($attribute), 'options' => $this->getAttributeOptions($attribute));
     }
     return $this;
 }
Example #6
0
 /**
  * Initialize entity attributes
  *
  * @return Mage_ImportExport_Model_Import_Entity_EavAbstract
  */
 protected function _initAttributes()
 {
     /** @var $attribute Mage_Eav_Model_Attribute */
     foreach ($this->_attributeCollection as $attribute) {
         $this->_attributes[$attribute->getAttributeCode()] = array('id' => $attribute->getId(), 'code' => $attribute->getAttributeCode(), 'table' => $attribute->getBackend()->getTable(), 'is_required' => $attribute->getIsRequired(), 'is_static' => $attribute->isStatic(), 'rules' => $attribute->getValidateRules() ? unserialize($attribute->getValidateRules()) : null, 'type' => Mage_ImportExport_Model_Import::getAttributeType($attribute), 'options' => $this->getAttributeOptions($attribute));
     }
     return $this;
 }
 /**
  * Initialize customer attributes.
  *
  * @return $this
  */
 protected function _initAttributes()
 {
     $collection = Mage::getResourceModel('catalog/category_attribute_collection');
     foreach ($collection as $attribute) {
         /** @var $attribute Mage_Eav_Model_Entity_Attribute */
         $this->_attributes[$attribute->getAttributeCode()] = array('id' => $attribute->getId(), 'is_required' => $attribute->getIsRequired(), 'is_static' => $attribute->isStatic(), 'rules' => $attribute->getValidateRules() ? unserialize($attribute->getValidateRules()) : null, 'type' => Mage_ImportExport_Model_Import::getAttributeType($attribute), 'options' => $this->getAttributeOptions($attribute), 'attribute' => $attribute);
     }
     return $this;
 }