Question

In Magento 1.9, I am going to convert my drop-down attributes to text field without changing my current data

Below is the image of current attribute set

My current attribute to convert

enter image description here

No correct solution

OTHER TIPS

I have a couple of update statements that should change the data-type from int to varchar (should be the case for all non-numeric text fields), changes input-type from select to text, and migrates all of the existing data into the correct tables. You should be able to run these in either order, then just re-index and you're done!

Update attribute settings:

UPDATE eav_attribute
SET 
    backend_type = 'varchar',
    frontend_input = 'text'
WHERE attribute_id = [add the attribute id];

Insert values from the old table into the new table:

insert into catalog_product_entity_varchar
(entity_type_id, attribute_id, store_id, entity_id, value)
(
    select 
        cpei.entity_type_id, 
        cpei.attribute_id, 
        cpei.store_id, 
        cpei.entity_id, 
        eaov.value
    from eav_attribute_option eao
    join eav_attribute_option_value eaov
    on eao.option_id = eaov.option_id
    join catalog_product_entity_int cpei
    on eao.option_id = cpei.value
    where cpei.attribute_id = [one or more attribute_ids of your choosing]
)

hope its work for you

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top