Fragmented Thought

Mass updating magento product weights from a csv

By

Published:

Lance Gliser

Heads up! This content is more than six months old. Take some time to verify everything still works as expected.

Assume you've created a local table from your csv with two columns: sku, weight.

SELECT cped.value, cpe.sku, update.\* FROM catalog_product_entity_decimal cped INNER JOIN eav_attribute ea ON ea.attribute_id = cped.attribute_id AND ea.attribute_code = 'weight' INNER JOIN catalog_product_entity cpe ON cpe.entity_id = cped.entity_id INNER JOIN \_product_weight_updates update ON update.sku = cpe.sku LIMIT 20 UPDATE catalog_product_entity_decimal cped INNER JOIN eav_attribute ea ON ea.attribute_id = cped.attribute_id AND ea.attribute_code = 'weight' INNER JOIN catalog_product_entity cpe ON cpe.entity_id = cped.entity_id INNER JOIN \_product_weight_updates update ON update.sku = cpe.sku SET cped.value = update.weight WHERE cpe.sku = update.sku