Magento: export attributes

Is there a way to export attributes from Magento? I have dropdown attributes with several hundred options each, and you need to transfer them to another Magento installation. I found instructions on how to import attributes from CSV , but so far have not been able to export.

+3
source share
4 answers

Magento does not have (what I know) a competent way to export product attributes with large lists of values. If the second machine is a new Magento installation (or you don't mind editing a little SQL), I would suggest that you simply delete the database tables for eav_attributes and copy them to the new database.

Hope this helps!

,

+2

, sql/modulename_setup . , , "", , "". . . wiki.

$iAttributeId = $installer->getAttributeId($iProductEntityTypeId, 'class');
$iSetId = $profileAttrSet = Mage::getModel("eav/entity_attribute_set")
    ->getResourceCollection()
    ->addFieldToFilter("entity_type_id", Mage::getModel('catalog/product')->getResource()->getTypeId())
    ->addFieldToFilter("attribute_set_name", "Profiles")
    ->getFirstItem()
    ->getId();
$installer->addAttributeToSet($iProductEntityTypeId,$iSetId,'General',$iAttributeId);

$aClasses = array('TV','DVD','Home Theatre','Air Conditioner','Stereo/Hifi','Game Console','Camcorder','VCR','Set Top Box','PVR');
$aOption = array();
$aOption['attribute_id'] = $iAttributeId;

for($iCount=0;$iCount<sizeof($aClasses);$iCount++){
    $aOption['value']['option'.$iCount][0] = $aClasses[$iCount];
}
$installer->addAttributeOption($aOption);

API eav/entity_attribute , .

,
JD

+2
0

- ... SQL EAV. "color"

SELECT v.* FROM eav_attribute AS a
JOIN eav_attribute_option AS o ON a.attribute_id = o.attribute_id
JOIN eav_attribute_option_value AS v ON o.option_id = v.option_id
WHERE a.attribute_code = 'color';

Just make sure that if you intend to use SQL to load values ​​into a table eav_attribute_option_value, you first check to see if a value exists for this attribute and that you do not specify value_idhow it is an auto increment value.

0
source

All Articles