0

Adding Product Image Attributes

As standard Magneto ships with three Image attributes for products, these are: image, small_image and thumbnail. Though these are quite ample for most Magento stores, there may come a time when you need to add extra image attributes. Recently we had to add a extra image attribute to allow the client to add a swatch sample image to their products, they were already defining the image, small_image, thumbnail so we had to add a new attribute for the swatch.

To add the new attribute we amended our local custom module for the site and added a extra MySQL installation file to the module that would add the new attribute. If you are unsure about how to add MySQL setup files to your local module then it is worth reading the Magento Custom Module tutorials to get the basics.

Once inside your custom module you will have a folder called: sql which would contain another folder called yourmodule_setup, replacing yourmodule with the name of your custom module. Inside this folder will be your MySQL intallation/upgrade files for your custom magento module.

Inside the MySQL file you will need to add code to setup a new attribute, this can be done as follows:

You will be able to customise the attribute code and label, changing “new_image_attribute” and “New Image Attribute” to values of your choosing.

Unknown source

 

Leave a reply