Skip to content

Commit

Permalink
Add possibility to import sku_type of bundle products (solves #355)
Browse files Browse the repository at this point in the history
  • Loading branch information
avstudnitz committed Feb 3, 2017
1 parent efd4ffd commit 569ece6
Showing 1 changed file with 24 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,31 +60,34 @@ public function _initAttributes()
parent::_initAttributes();

/*
* Price type does not live in an attribute set, so it is not picked up
* Price type and Sku 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');

$typeAttributes = array('price_type', 'sku_type');
foreach ($this->_attributes as $attrSetName => $attributes) {
$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)
)
);
}
foreach ($typeAttributes as $attributeCode) {
$attribute = Mage::getResourceModel('catalog/eav_attribute')->load($attributeCode, 'attribute_code');
$this->_addAttributeParams(
$attrSetName,
array(
'id' => $attribute->getId(),
'code' => $attribute->getAttributeCode(),
'for_configurable' => $attribute->getIsConfigurable(),
'is_global' => $attribute->getIsGlobal(),
'is_required' => false,
'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;
}
}

public function saveData()
Expand Down

0 comments on commit 569ece6

Please sign in to comment.