Skip to content

Instantly share code, notes, and snippets.

@peterjaap
Created July 3, 2013 08:09
Show Gist options
  • Save peterjaap/5916250 to your computer and use it in GitHub Desktop.
Save peterjaap/5916250 to your computer and use it in GitHub Desktop.
Convert select attribute to multiselect attribute SQL -- replace 'ATTRIBUTE_CODE' with your attribute code.
SELECT @ATTRIBUTE_ID := attribute_id FROM eav_attribute WHERE attribute_code = 'ATTRIBUTE_CODE';
UPDATE eav_attribute SET backend_model = 'eav/entity_attribute_backend_array', backend_type = 'varchar', frontend_input = 'multiselect' WHERE attribute_id = @ATTRIBUTE_ID;
INSERT INTO catalog_product_entity_varchar (entity_type_id, attribute_id, store_id, entity_id, value) SELECT entity_type_id, attribute_id, store_id, entity_id, value FROM catalog_product_entity_int WHERE attribute_id = @ATTRIBUTE_ID;
DELETE FROM catalog_product_entity_int WHERE attribute_id = @ATTRIBUTE_ID;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment