Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

[How do I] create custom fields and have them display on the product page? 
 
winzippy
Sr. Member
 
Avatar
Total Posts:  101
Joined:  2008-02-08
Rochester, NY, USA
 

I want be able to add height and width of a product in the admin section (which I can already to) and have those figures show up on the product page. Does anyone know how to do that?

 
Magento Community Magento Community
Magento Community
Magento Community
 
dan_w
Sr. Member
 
Total Posts:  290
Joined:  2008-01-04
 

I’m assuming that you added height and width via an attribute. If that is the case, than add those attributes to your attribute set for those products. If you have not created a specific attribute set for the product, then they should be added to the default attribute set if you want the height and width fields to show for all products.

 
Magento Community Magento Community
Magento Community
Magento Community
 
winzippy
Sr. Member
 
Avatar
Total Posts:  101
Joined:  2008-02-08
Rochester, NY, USA
 

I have the attribute part down pat, but my problem is I want that attribute to show up on the product page. I have some attachments showing what I mean.

 
Magento Community Magento Community
Magento Community
Magento Community
 
dan_w
Sr. Member
 
Total Posts:  290
Joined:  2008-01-04
 

Ok, now that I see that you want to put that attribute somewhere other than the “Additional Info” box that follows the product description, you can simply call the attribute info using the following:

<?=$_product->getAttributeText('width')?>
<?
=$_product->getAttributeText('height')?>
These go in the view.phtml template for products (template/product/view.phtml) wherever you want that value to showup. Now, remember, this will only output the values for that attribute, so you’ll need a label for the value as well.
 
Magento Community Magento Community
Magento Community
Magento Community
 
winzippy
Sr. Member
 
Avatar
Total Posts:  101
Joined:  2008-02-08
Rochester, NY, USA
 

Thanks for your help Dan grin. I decided to just use the same code in the Additional Info box (yay copy and paste). For some reason, the getAttributeText function gave me fatal errors.

 
Magento Community Magento Community
Magento Community
Magento Community
 
dan_w
Sr. Member
 
Total Posts:  290
Joined:  2008-01-04
 

Glad you got it sorted.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Punani
Sr. Member
 
Total Posts:  76
Joined:  2008-02-12
 

is it possible to add the group name where the attribute is placed in the attribute set?
for example:
in the attribute set i have a group PC Specs with several attributes
is it possible to show them seperatly in the product view (grouped by the group name) ??

 
Magento Community Magento Community
Magento Community
Magento Community
 
winzippy
Sr. Member
 
Avatar
Total Posts:  101
Joined:  2008-02-08
Rochester, NY, USA
 

Hmmm. I don’t know. That’s a really good question.

There’s probably a way to do it. It would be nice if Varien released a cheat sheet of variables and references.

 
Magento Community Magento Community
Magento Community
Magento Community
 
jiggliemon
Jr. Member
 
Total Posts:  18
Joined:  2008-08-27
 
Punani - 18 March 2008 02:50 AM

is it possible to add the group name where the attribute is placed in the attribute set?
for example:
in the attribute set i have a group PC Specs with several attributes
is it possible to show them seperatly in the product view (grouped by the group name) ??

I’ve been working on this for a few days now.  I’ll let you know when i figure it out.

 
Magento Community Magento Community
Magento Community
Magento Community
 
jiggliemon
Jr. Member
 
Total Posts:  18
Joined:  2008-08-27
 

This is really very complicated.  Magento has a very complex frame work and not so much for documentation on development.

 
Magento Community Magento Community
Magento Community
Magento Community
 
cff
Jr. Member
 
Total Posts:  27
Joined:  2008-08-29
 

I’ve been searching for a way to output the attribute set name of an attribute, mainly to customize the advanced search page… no luck as yet. I’ll post back if/when I do....

 
Magento Community Magento Community
Magento Community
Magento Community
 
Cole Geissinger
Sr. Member
 
Avatar
Total Posts:  174
Joined:  2008-12-23
Northern California
 

soooooooo I’m trying to add a custom attribute into my view.phtml file. I tried using the above code but I get nothing....can anyone supply the code they used to make this function work?? I have an idea of how to do it, it’s just calling it out correctly that seems to be my problem.

------------- here’s what I got - I have an attribute called “specs”, this attribute is showing up in the admin area but no ton the front-end. I want this attribute to only show when data has been entered into this text area.

<?php if ($_specs $this->getChildHtml('specs')):?>
            
<div class="collateral-box">
                <
div class="head">
                    <
h4><?php echo $this->__('Specifications'?></h4>
                </
div>
                
<?php echo $_product->getAttributeText('specs'?>
            
</div>
        
<?php endif;?>
- That’s what my code right now looks like.......
 
Magento Community Magento Community
Magento Community
Magento Community
 
MartinaL
Sr. Member
 
Total Posts:  82
Joined:  2008-03-31
 

How can I show the additional custom field on the grouped products page in the list of products?

I have added the extra column but i can;t get the values to display?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Cole Geissinger
Sr. Member
 
Avatar
Total Posts:  174
Joined:  2008-12-23
Northern California
 

I’m not sure if I fully understand what you are going for. What I got out of that was you wanted to display the “Additional” field (by the way, it is not a custom field, that was created by Magento so technically it is a default field.) in the product list page (list.phtml) of your catalog correct? This list page is the area where you view the list of products for a specific category.

 
Magento Community Magento Community
Magento Community
Magento Community
 
jonas73
Sr. Member
 
Total Posts:  97
Joined:  2009-04-24
 

<?php echo $_product->getAttributeText('xxxxx')?>

try this

 
Magento Community Magento Community
Magento Community
Magento Community
 
blossom88
Jr. Member
 
Avatar
Total Posts:  18
Joined:  2010-05-20
 

Actually the way people have suggested doesn’t work because when you pull the custom attribute, it is an array. So what you actually need to do is add something like this to the view.phtml:

<h2>Additional Info</h2>
        
<?php echo $_product->getResource()->getAttribute('addinfo')->getFrontend()->getValue($_product); ?>
 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top