• Home
  • Magento
  • Contact
KEEP IN TOUCH

How to get custom attributes value in Magento Frontend

Facebook Twitter Google + Share Reddit Digg Stumble Delicious More

In Magento, you can create unlimited number of custom attributes to show different type of information about your product. These attributes can be different type as Text Field, Text Area, Date, Yes/No, Multiple Select, Dropdown, Price, Gallery, Media Image etc. Sometimes you need to get these attributes value to show in different places. There are different way to get different type of attributes.

you can get almost type of attribute value by using the following code:

  1. <?php
  2.     echo $_product->getAttributeName();
  3. ?>
<?php
	echo $_product->getAttributeName();
?>

For example, suppose you are selling computer monitor in your web store and you created a attribute by using ‘screen_resolution‘ as its attribute code. Then You can get this attribute value by using the following code:

  1. <?php
  2.     echo $_product->getScreenResolution();
  3. ?>
<?php
	echo $_product->getScreenResolution();
?>

If it not work you can also try following code:

  1. <?php
  2.     echo $this->htmlEscape($_product->getData('screen_resolution'));
  3. ?>
<?php
	echo $this->htmlEscape($_product->getData('screen_resolution'));
?>

If you want to get any “Dropdown or a Multiple Select” type attribute’s value, then you should use following code to to get their value:

  1. <?php
  2.     echo $_product->getAttributeText('screen_resolution');
  3. ?>
<?php
	echo $_product->getAttributeText('screen_resolution');
?>

Here i used screen_resolution which is my attribute code. You must use your attribute code.

Note: Make sure your attribute field “Visible on Product View Page on Front-end” is set as Yes. otherwise that attribute value don’t show on forntend.

Related Topics

  • Hide Attributes from frontend which values are not given from backend in Magento
  • Create Accordion Menu for Magento Layered Navigation
  • Creating and Showing a static block in Magento Frontend
  • How to add a Custom field in Contact Us form of Magento
  • How to remove auto added break (<br />) tag from product description of magento
Posted in Magento- Tagged Magento Attributes Value
4 CommentsWritten by Admin

4 Comments

  1. Dani
    March 22, 2013 at 9:54 AM | Permalink

    thanks!

    Reply
  2. Thomus
    December 28, 2012 at 2:24 AM | Permalink

    Great post about getting Magento attributes values!! Thanks

    Reply
  3. John
    August 8, 2012 at 1:55 PM | Permalink

    It is still working in 1.7.x.x . Thanks for share about getting Magento attribute value

    Reply
  4. Jhonny jonas
    January 30, 2012 at 6:25 AM | Permalink

    Amazing!!! I showed my custom attribute’s value in front-end by following this post. thanks.

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *


− 4 = zero

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code lang=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" extra="">

E-mail Subscription

Enter your email address:

Recent Posts

BPL Fixture 2013 | Download Bangladesh Premier League Time-Table

BPL Fixture 2013 | Download Bangladesh Premier League Time-Table

Bangladesh Premier League BPL 2013 All Teams and Players List

Bangladesh Premier League BPL 2013 All Teams and Players List

National University Result | Get Bangladesh NU Result

National University Result | Get Bangladesh NU Result

JSC (Junior School Certificate) And JDC Exam Result Bangladesh

JSC (Junior School Certificate) And JDC Exam Result Bangladesh

Primary Somapony Result | PSC (Primary School Certificate) BD

Primary Somapony Result | PSC (Primary School Certificate) BD

Download pdf 33rd BCS written exam routine and Seat Plan 2012

Download pdf 33rd BCS written exam routine and Seat Plan 2012

Degree 1st Year Final Routine of National University (NU) BD

Degree 1st Year Final Routine of National University (NU) BD

JSC (Junior School Certificate) Exam Routine 2012 Download PDF

JSC (Junior School Certificate) Exam Routine 2012 Download PDF

National University (NU) Honours Final (4th) Year Routine Download

National University (NU) Honours Final (4th) Year Routine Download

NU (National University) Honours 1st Year Routine PDF Download

NU (National University) Honours 1st Year Routine PDF Download

How to get oDesk money directly on Bank account from Bangladesh

How to get oDesk money directly on Bank account from Bangladesh

Dhaka University (DU) Admission Test Routine for 2012-2013

Dhaka University (DU) Admission Test Routine for 2012-2013

Recent Comments

  • chayan on National University Result | Get Bangladesh NU Result
  • Stan on Creating and Showing a static block in Magento Frontend
  • Stan on Creating and Showing a static block in Magento Frontend
  • Dani on How to get custom attributes value in Magento Frontend
  • Kiran on How to show products on Magento Homepage from specific Category
  • Bryan on How to Remove Callout section from left / right side of Magento
  • Sawon on Installing Magento on Localhost using WAMP Server
  • Keyur Shah on Installing Magento on Localhost using WAMP Server

Categories

  • Bangladesh Xpress
  • Magento
  • Sports
  • Tips and Tricks

EvoLve theme by Theme4Press  •  Powered by WordPress XpressBangla

Copyright © 2012 XpressBangla. All rights reserved.
You might also likeclose
  • Tuesday, 27/12/2011 12:50 AM
    How to get Previous & Next Product Buttons on Product view Page in Magento