1

I'm trying to add an image attribute by the following code:

<?php
$installer = Mage::getResourceModel('catalog/setup', 'catalog_setup');
$installer->startSetup();

$installer->addAttribute('catalog_product','my_image_attribute_1',
    array (
        'group'             => 'General',
        'type'              => 'varchar',
        'frontend'          => 'catalog/product_attribute_frontend_image',
        'label'             => 'Additional product image',
        'input'             => 'media_image',
        'global'            => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
        'visible'           => true,
        'required'          => false,
        'user_defined'      => false,
        'configurable'      => false,
        'visible_on_front'  => true,
        'default'           => '',
        'class'             => '',
        'source'            => ''
    )
);

$installer->endSetup();

The attribute is created but I can't see it on product edit page.

UPDATE:

Ok this code adds only a radio Button to default image gallery. Hm I wanted to create a custom upload form for a single image...

1

Did you added in attribute set? catalog->attributes->manage attribute sets -> select your set name then drag and drop from right to left in attribute group like "general"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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