The following is a setup script to create a product image attribute in Magento
The attribute is added to the Images group within Manage Products and behaves the same as the default product images in Magento.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
<?php $installer = $this; $installer->startSetup(); $setup = new Mage_Eav_Model_Entity_Setup('core_setup'); $setup->addAttribute( 'catalog_product', 'video_thumbnail', array ( 'group' => 'Images', 'type' => 'varchar', 'frontend' => 'catalog/product_attribute_frontend_image', 'label' => 'Video Thumbnail', 'input' => 'media_image', 'class' => '', 'source' => '', 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE, 'visible' => true, 'required' => false, 'user_defined' => false, 'default' => '', 'searchable' => false, 'filterable' => false, 'comparable' => false, 'visible_on_front' => true, 'unique' => false, ) ); $installer->endSetup(); |
Make sure that you don’t forget to add a placeholder image within System Configuration -> Catalog -> Product Image Placeholders