Magento 1.7 Configurable Product Export Fix

Magento 1.7 Configurable Product Export Fix

There is a configurable product export issue affecting both the Magento Community and Enterprise Edition export system. I have personally tested this fix on Magento Community v1.7.0.2 and Magento Enterprise v1.12.0.2, but I’m sure it will work on any version that is having the same symptoms.

The Issue

The issue is with the core Import/Export functionality found in System > Import/Export > Export menu item in the Magento backend. If you have configurable products that are configurable by only 1 attribute, you won’t experience difficulities. However, if you have a configurable product with multiple configurable attributes (i.e. a T-Shirt configurable by both size and color) then you will notice that your export file only contains data about one configurable attribute. This data can be found in the _super_attribute_code and _super_attribute_option columns. As in the case of my T-Shirt example, these columns would only contain data about the size attribute options, and nothing about color.

The Fix

To fix this issue we must override one of Magento’s core class files, at least until they come out with a newer patched version. We never touch core Magento files, so what we are going to do is replicate this file in the local code pool and make our changes there. From your root Magento install directory, copy the file

app/code/core/Mage/Catalog/Model/Resource/Product/Type/Configurable.php

to

app/code/local/Mage/Catalog/Model/Resource/Product/Type/Configurable.php

Now, open up the Configurable.php file you just copied to the local code pool and navigate to line 223. This line should read

$attributesOptionsData[$superAttribute->getAttributeId()] = $this->_getReadAdapter()->fetchAssoc($select);

You need to change this line to read

$attributesOptionsData[$superAttribute->getAttributeId()] = $this->_getReadAdapter()->fetchAll($select);

Now, clear your cache and try the export again. You should see all your configurable attribute data in the file now. And now, my T-Shirts have both the size and color attribute associations in the export file. Once Magento fixes this issue in a later release, just remember to delete your local copy of Configurable.php.

 

2016-10-06T09:10:17+00:00

Razoyo

Razoyo is an ecommerce consultancy and Magento Certified Developer serving the needs of small and medium-sized web stores. We help online merchants to create, manage, maintain and update their stores, and to solve both business and technology problems.

RECENT TWEETS

CONTACT US