1

how can I add a custom product image type in the image gallery?

e.g, see banner_landing type in the image below.

enter image description here

4

found a great tutorial for it. I'll paste it here since I didn't find any other reference on SO and might be useful to the community https://www.pixafy.com/blog/2012/12/adding-a-fourth-image-position-to-the-admin-for-a-magento-product/

  • 1
    Thank you for sharing this great tutorial man. :) – Monty Nabeel Nov 11 '18 at 9:41
3

You need create new install script.

$installer = $this;
$installer->startSetup();
$this->addAttribute('catalog_product','new_image_attribute',
    array (
        'group'             => 'Images',
        'type'              => 'varchar',
        'frontend'          => 'catalog/product_attribute_frontend_image',
        'label'             => 'New Image Attribute',
        'input'             => 'media_image',
        'global'            => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
        'visible'           => true,
        'default'           => '',
        'class'             => '',
        'source'            => ''
    )
);
$installer->endSetup();

To use this type of image in your product page, call the image like this:

<?php echo $this->helper('catalog/image')->init($_product, 'new_image_attribute')->resize(400,300); ?>

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.