4

I am new to Magento Go, I want to have two custom fields in the product description page: features and specifications. It seems like I need to use "Custom Attribute" to achieve this, so I did so, but the custom attribute wouldn't show up in the product page? How do I make it so that it would appear in the product page?

Bonk
  • 1,859
  • 9
  • 28
  • 46

4 Answers4

3

while you creating the custom attribute "Visible on Product View Page on Front-end" set this option to YES it will show the attribute on product page...

Jim
  • 70
  • 8
2

There are few ways you can print products custom attribute as follows :

1. $getPrdocutData = $_product->getData();

this will give you an array of all products attributes, so you can use it.

2. $attributes = $product->getAttributes();
   foreach ($attributes as $attribute) {
      if ($attribute->getIsVisibleOnFront()) {
         $value = $attribute->getFrontend()->getValue($product);
        // do something with $value here
      }
   }

and

3. $productAttrs = Mage::getResourceModel('catalog/product_attribute_collection');
    foreach ($productAttrs as $productAttr) { 
        /** $productAttr Mage_Catalog_Model_Resource_Eav_Attribute */
        var_dump($productAttr->getAttributeCode());
    }

Please try above piece of code to display product attributes.

Sunil Verma
  • 2,490
  • 1
  • 14
  • 15
  • Since I am using Magento Go, I don't think I can modify the PHP code, can I? – Bonk Oct 20 '13 at 17:59
  • you can use one of the above code inside your theme template, product detail page is located at app/design/frontend/default/your_theme/template/catalog/product/view.phtml also make sure attribute is set to show on frontend from add/edit attribute section in admin – Sunil Verma Oct 21 '13 at 06:33
2

To display the contents of attribute on product page you need to add following code in view.phtml file.

<?php echo $_product->getResource()->getAttribute('brand_info')->getFrontend()->getValue($_product); ?>
Swapna Taru
  • 688
  • 5
  • 6
1

Add code on product page to display All Attribute of the product define attribute must apply option product view on front page set yes:

<?php echo $this->getLayout()->
      createBlock('catalog/product_view_attributes', '', 
      array('template'=> 'catalog/product/view/attributes.phtml'))->toHtml(); 
?>

You may be difine selected attribute to use this code:

$Designer = Mage::getModel('catalog/product')->load($_product->getId())->
getAttributeText('manufacturer'); 


<?php if($Designer): ?>
        <div class="details"><p><span>Designer:</span> 
<?php echo Mage::getModel('catalog/product')->load($_product->getId())->
       getAttributeText('manufacturer');
?></p></div>
<?php endif; ?>
Ravi Patel
  • 5,121
  • 2
  • 25
  • 44