Magento – Additional Attributes of current product

productproduct-attribute

how to get all additional attributes name and value for current product

i wrote below code but its not working

    <?php
    $_helper = $this->helper('catalog/output');
    $_product = $this->getProduct()
?>
<?php if($_additional = $this->getAdditionalData()): ?>
<?php foreach ($_additional as $_data): ?>
<?php echo $_helper->productAttribute($_product, $_data['value'], $_data['code']) ?>
<?php endforeach;?>
<?php endif; echo "ssss";?>

Best Answer

<?php

     (array) $excludeAttr = array();
     (array) $data = array();
        $product = $this->getProduct();
        $attributes = $product->getAttributes();
        foreach ($attributes as $attribute) {
//            if ($attribute->getIsVisibleOnFront() && $attribute->getIsUserDefined() && !in_array($attribute->getAttributeCode(), $excludeAttr)) {
            if ($attribute->getIsVisibleOnFront() && !in_array($attribute->getAttributeCode(), $excludeAttr)) {
                $value = $attribute->getFrontend()->getValue($product);

                if (!$product->hasData($attribute->getAttributeCode())) {
                    $value = Mage::helper('catalog')->__('N/A');
                } elseif ((string)$value == '') {
                    $value = Mage::helper('catalog')->__('No');
                } elseif ($attribute->getFrontendInput() == 'price' && is_string($value)) {
                    $value = Mage::app()->getStore()->convertPrice($value, true);
                }

                if (is_string($value) && strlen($value)) {
                    $data[$attribute->getAttributeCode()] = array(
                        'label' => $attribute->getStoreLabel(),
                        'value' => $value,
                        'code'  => $attribute->getAttributeCode()
                    );
                }
            }
        }

    ?>

<?php if($_additional = $data): ?>
<?php foreach ($_additional as $_data): ?>
<?php echo $_helper->productAttribute($_product, $_data['value'], $_data['code']) ?>
<?php endforeach;?>
<?php endif; echo "ssss";?>

Please try this