Written by Giles Bennett
Magento bug - product import resets attribute values
This Magento product import error has been plaguing a couple of clients for a while now. When importing existing products via CSV to mass update them, attributes were being changed even though no changes were being specified in the CSV file. In fact, the opposite - none of the columns in the CSV related to the attributes in question, so nothing should have been changed at all.
A little digging revealed the source of the problem. In
[php]app/code/core/Mage/ImportExport/Model/Import/Entity/Product/Type/Abstract.php[/php]
there's a function called prepareAttributesForSave. Within this function (lines 303 - 304) there's an elseif clause which looks like this :
[php]} elseif (null !== $attrParams['default_value']) {
$resultAttrs[$attrCode] = $attrParams['default_value'];
}[/php]
What that's doing is setting the attribute to its default value if it's not contained in the CSV being processed. So resetting everything - great.

About the author
Giles Bennett built his first website in 1996, and is old enough to miss Netscape Navigator. Initially a lawyer, he jumped ship to IT in 2008, and after 5 years as a freelancer, he founded HummingbirdUK in 2013. He can be reached by email at giles@hummingbirduk.com.