I have a magento site in which there are simple products having language videos attributes.

Currently there are two language video sections being maintained, each section containing six different videos & their thumbs.

Now I want to add three more sections of same number of video attributes, resulting into 18 attributes to be newly created.

So my question is, how can I clone all those attributes(video attributes which are textfields & thumb attributes which are WYSIWYG editors) by script, without doing the tedious task of manually creating each attribute ?

1 Answer 1


I haven't tested this, but I think it should work.

$attributeIdToClone = 'attribute_id_to_clone';
$attribute = Mage::getSingleton('eav/config')->getAttribute('catalog_product', $attributeIdToClone);
if ($attribute->getId()) {
    $attribute->setLabel('New label here');

if you need to clone multiple times, just use this in a for (foreach / while) loop.
please backup your db before trying this.

  • Tks Marius, the code does insert the attribute, but it somehow fails to set it's label in admin, so can you update your answer for that, also please include the line for assigning the attribute to particular attribute set by Id.
    – H.D.
    Sep 23, 2015 at 12:40
  • @H.D. I have no idea why it does not set the label. As I said, I didn't test the code. Also I don't know how you can assign the attribute to a group. I will test it and come back if I get a better result.
    – Marius
    Sep 23, 2015 at 13:24
  • Sure, no problem, I am also trying to find this. Thanks for your help.
    – H.D.
    Sep 24, 2015 at 4:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.