Apologies if this is something of an elementary question. I've been trawling google and unable to find an answer to my query.

I need to add a few new fields to products for the admin to display more info on the product (video embed code (textarea), hero image (image upload) and strap line (text field)).

I thought this could be achieved using product attributes and followed this: http://www.pixafy.com/blog/2012/12/adding-a-fourth-image-position-to-the-admin-for-a-magento-product/ (for the hero image)

All I was able to achieve with this was to allow images to be set as type "hero" and the new hero image became just another product image in the product image switcher.

How can I specify these fields to the admin and then go on to display them in the template?

Thank you

2 Answers 2


If you want the attributes to display in the frontend in another position than the list (or wherever they are meant to be like the media gallery) you have to edit the product view phtml file of your theme.

the file you need to change is


if it doesn't exist copy it from


1. Image

As suggested in the link you provided, insert the line

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

in the above file replacing 'attribute_code' with your attribute's code and the dimensions with what you want. Save it, upload it or whatever, be sure to clear the cache before trying to view the changes.

Now for the rest of your attributes.

2. Text

There are many ways to call an attribute from the product view template. In your case, that you just have a textfield some of them are

<?php echo $_helper->productAttribute($_product, $_product->getAttributeCode(), 'attribute_code'); ?>


<?php echo $_product->getAttributeCode(); ?>


<?php echo $_product->attributeCode; ?>

I would suggest trying the first one. Notice that if the attribute's code has an underscore, you omit it and you capitalize the next letter.

2a. Example of youtube code attribute

  • Login to your backend and navigate to Catalog -> Attributes -> Manage Attributes
  • Press 'Add New Attribute' and create an attribute of type 'text' (For information of how you do that you can read this) Be sure that the attribute is assigned to any attribute sets you are using. Let's say the attribute code you choose is yt_viewcode

Now in the phtml file mentioned above add the following code wherever you want it to show up

<div class="youtube" align="center">
    <object width="640" height="400">
                value="http://www.youtube.com/v/<?php echo $product->getYtViewcode();?>?autoplay=0&rel=0&fs=1&loop=0">
            <param name="allowFullScreen" value="false"></param>
            <param name="allowscriptaccess" value="always"></param>
                src="http://www.youtube.com/v/<?php echo $product->getYtViewcode();?>?autoplay=0&rel=0&fs=1&loop=0" 
  • Thank you for this! In terms of adding the text fields into the CMS for the admin to populate, how do I achieve this?
    – Fraser
    Commented Mar 31, 2014 at 15:32
  • I'm sorry I don't quite understand what you're saying. Do you want to show the attributes in a CMS? Do you want nstructions on how to create the attributes and where they show in the backend? Commented Mar 31, 2014 at 15:48
  • I would like the store admin to be able to, for instance, specify a youtube embed code in the CMS which is then shown to the user of the website (customer) when they visit that product page. Thanks
    – Fraser
    Commented Mar 31, 2014 at 15:49
  • Truly sorry, you loose me on the CMS part. What do you mean by CMS? Commented Mar 31, 2014 at 15:51
  • Where you log in as an administrator to update the product details. ie siteground.com/img/knox/tutorials/uploaded_images/images/…
    – Fraser
    Commented Mar 31, 2014 at 15:54

To add an attribute into Magento Admin Panel -:

  1. Catalog -> Attribute -> Manage Attribute in Magento Admin Panel and Create the attribute which you want to show

  2. Add new attribute

  3. Fill data into fields according to your requirement

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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