Skip to main content
added 4 characters in body
Source Link
Marius
  • 198.5k
  • 55
  • 424
  • 833

weWe need to convert a dropdown attribute to multiselect

iI found a way here :

If attribute_code : age ,
entity_type_id = 10 ,
store_id = 1

If attribute_code : age , entity_type_id = 10 , store_id = 1


UPDATE eav_attribute SET
entity_type_id = '10',
attribute_model = NULL,
backend_model = 'eav/entity_attribute_backend_array',
backend_type = 'varchar',
backend_table = NULL,
frontend_model = NULL,
frontend_input = 'multiselect',
frontend_class = NULL
WHERE attribute_id = 'age';

Next, copy the attribute values from the old table to the new:

INSERT INTO catalog_product_entity_varchar ( 10, attribute_id, 1, entity_id, value)
SELECT entity_type_id, attribute_id, 1, entity_id, value
FROM catalog_product_entity_int
WHERE attribute_id = age;

Finally, remove the old values or they will conflict with the new setup (the old values will load, but Magento will save new values to the varchar table):

DELETE FROM catalog_product_entity_int
WHERE entity_type_id = 10 and attribute_id = age;

Credits :

http://swarminglabs.com/how-to-change-a-product-dropdown-attribute-to-a-multi-select/

but here i want to know how to find "attribute_id and entity_id" for an attribute. so i can replace those values in above queries

we need to convert a dropdown attribute to multiselect

i found a way here :

If attribute_code : age , entity_type_id = 10 , store_id = 1


UPDATE eav_attribute SET
entity_type_id = '10',
attribute_model = NULL,
backend_model = 'eav/entity_attribute_backend_array',
backend_type = 'varchar',
backend_table = NULL,
frontend_model = NULL,
frontend_input = 'multiselect',
frontend_class = NULL
WHERE attribute_id = 'age';

Next, copy the attribute values from the old table to the new:

INSERT INTO catalog_product_entity_varchar ( 10, attribute_id, 1, entity_id, value)
SELECT entity_type_id, attribute_id, 1, entity_id, value
FROM catalog_product_entity_int
WHERE attribute_id = age;

Finally, remove the old values or they will conflict with the new setup (the old values will load, but Magento will save new values to the varchar table):

DELETE FROM catalog_product_entity_int
WHERE entity_type_id = 10 and attribute_id = age;

Credits :

http://swarminglabs.com/how-to-change-a-product-dropdown-attribute-to-a-multi-select/

but here i want to know how to find "attribute_id and entity_id" for an attribute. so i can replace those values in above queries

We need to convert a dropdown attribute to multiselect

I found a way here :

If attribute_code : age ,
entity_type_id = 10 ,
store_id = 1

UPDATE eav_attribute SET
entity_type_id = '10',
attribute_model = NULL,
backend_model = 'eav/entity_attribute_backend_array',
backend_type = 'varchar',
backend_table = NULL,
frontend_model = NULL,
frontend_input = 'multiselect',
frontend_class = NULL
WHERE attribute_id = 'age';

Next, copy the attribute values from the old table to the new:

INSERT INTO catalog_product_entity_varchar ( 10, attribute_id, 1, entity_id, value)
SELECT entity_type_id, attribute_id, 1, entity_id, value
FROM catalog_product_entity_int
WHERE attribute_id = age;

Finally, remove the old values or they will conflict with the new setup (the old values will load, but Magento will save new values to the varchar table):

DELETE FROM catalog_product_entity_int
WHERE entity_type_id = 10 and attribute_id = age;

Credits :

http://swarminglabs.com/how-to-change-a-product-dropdown-attribute-to-a-multi-select/

but here i want to know how to find "attribute_id and entity_id" for an attribute. so i can replace those values in above queries

Source Link
Baby in Magento
  • 3k
  • 16
  • 84
  • 223

Find entity_id & attribute_id of an attribute

we need to convert a dropdown attribute to multiselect

i found a way here :

If attribute_code : age , entity_type_id = 10 , store_id = 1


UPDATE eav_attribute SET
entity_type_id = '10',
attribute_model = NULL,
backend_model = 'eav/entity_attribute_backend_array',
backend_type = 'varchar',
backend_table = NULL,
frontend_model = NULL,
frontend_input = 'multiselect',
frontend_class = NULL
WHERE attribute_id = 'age';

Next, copy the attribute values from the old table to the new:

INSERT INTO catalog_product_entity_varchar ( 10, attribute_id, 1, entity_id, value)
SELECT entity_type_id, attribute_id, 1, entity_id, value
FROM catalog_product_entity_int
WHERE attribute_id = age;

Finally, remove the old values or they will conflict with the new setup (the old values will load, but Magento will save new values to the varchar table):

DELETE FROM catalog_product_entity_int
WHERE entity_type_id = 10 and attribute_id = age;

Credits :

http://swarminglabs.com/how-to-change-a-product-dropdown-attribute-to-a-multi-select/

but here i want to know how to find "attribute_id and entity_id" for an attribute. so i can replace those values in above queries