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

2 Answers 2

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
  • 1
    Thank you for sharing this great tutorial man. :) Commented Nov 11, 2018 at 9:41
4

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 and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.