<?php
$attributes = $_product->getAttributes();
foreach ($attributes as $attribute) {
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 ($data) { ?>
<?php
$_helper = $this->helper('catalog/output');
$_category = null;
?>
<table class="data-table" id="product-attribute-specs-table">
<col width="25%" />
<col />
<tbody>
<?php foreach ($data as $_data): ?>
<?php if($_helper->productAttribute($_product, $_data['value'], $_data['code'])=="No" || $_helper->productAttribute($_product, $_data['value'], $_data['code']) =="Ei" | $_helper->productAttribute($_product, $_data['value'], $_data['code'])=="???"): ?>
<?php else: ?>
<?php if(strtolower($this->htmlEscape($this->__($_data['label']))) == 'manufacturer'): ?>
<?php $_category = Mage::getModel('catalog/category')->loadByAttribute('name', $_helper->productAttribute($_product, $_data['value'], $_data['code'])); ?>
<?php endif; ?>
<tr>
<th class="label"><?php echo $this->htmlEscape($this->__($_data['label'])) ?></th>
<td class="data">
<?php if($_category && $_category->getUrl() && strtolower($this->htmlEscape($this->__($_data['label']))) == 'manufacturer'): ?>
<a href="<?php echo $_category->getUrl(); ?>" title="<?php echo $_helper->productAttribute($_product, $_data['value'], $_data['code']); ?>">
<?php endif; ?>
<?php echo $_helper->productAttribute($_product, $_data['value'], $_data['code']) ?>
<?php if($_category && $_category->getUrl() && strtolower($this->htmlEscape($this->__($_data['label']))) == 'manufacturer'): ?>
</a>
<?php endif; ?>
</td>
</tr>
<?php endif; ?>
<?php endforeach; ?>
</tbody>
</table>
<?php } ?>
<?php
$attributes = $_product->getAttributes();
foreach ($attributes as $attribute) {
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 ($data) { ?>
<table class="data-table" id="product-attribute-specs-table">
<col width="25%" />
<col />
<tbody>
<?php foreach ($data as $_data): ?>
<?php if($_helper->productAttribute($_product, $_data['value'], $_data['code'])=="No" || $_helper->productAttribute($_product, $_data['value'], $_data['code']) =="Ei" | $_helper->productAttribute($_product, $_data['value'], $_data['code'])=="???"): ?>
<?php else: ?>
<?php if(strtolower($this->htmlEscape($this->__($_data['label']))) == 'manufacturer'): ?>
<?php $_category = Mage::getModel('catalog/category')->loadByAttribute('name', $_helper->productAttribute($_product, $_data['value'], $_data['code'])); ?>
<?php endif; ?>
<tr>
<th class="label"><?php echo $this->htmlEscape($this->__($_data['label'])) ?></th>
<td class="data">
<?php if($_category && $_category->getUrl() && strtolower($this->htmlEscape($this->__($_data['label']))) == 'manufacturer'): ?>
<a href="<?php echo $_category->getUrl(); ?>" title="<?php echo $_helper->productAttribute($_product, $_data['value'], $_data['code']); ?>">
<?php endif; ?>
<?php echo $_helper->productAttribute($_product, $_data['value'], $_data['code']) ?>
<?php if($_category && $_category->getUrl() && strtolower($this->htmlEscape($this->__($_data['label']))) == 'manufacturer'): ?>
</a>
<?php endif; ?>
</td>
</tr>
<?php endif; ?>
<?php endforeach; ?>
</tbody>
</table>
<?php } ?>
<?php
$attributes = $_product->getAttributes();
foreach ($attributes as $attribute) {
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 ($data) { ?>
<?php
$_helper = $this->helper('catalog/output');
$_category = null;
?>
<table class="data-table" id="product-attribute-specs-table">
<col width="25%" />
<col />
<tbody>
<?php foreach ($data as $_data): ?>
<?php if($_helper->productAttribute($_product, $_data['value'], $_data['code'])=="No" || $_helper->productAttribute($_product, $_data['value'], $_data['code']) =="Ei" | $_helper->productAttribute($_product, $_data['value'], $_data['code'])=="???"): ?>
<?php else: ?>
<?php if(strtolower($this->htmlEscape($this->__($_data['label']))) == 'manufacturer'): ?>
<?php $_category = Mage::getModel('catalog/category')->loadByAttribute('name', $_helper->productAttribute($_product, $_data['value'], $_data['code'])); ?>
<?php endif; ?>
<tr>
<th class="label"><?php echo $this->htmlEscape($this->__($_data['label'])) ?></th>
<td class="data">
<?php if($_category && $_category->getUrl() && strtolower($this->htmlEscape($this->__($_data['label']))) == 'manufacturer'): ?>
<a href="<?php echo $_category->getUrl(); ?>" title="<?php echo $_helper->productAttribute($_product, $_data['value'], $_data['code']); ?>">
<?php endif; ?>
<?php echo $_helper->productAttribute($_product, $_data['value'], $_data['code']) ?>
<?php if($_category && $_category->getUrl() && strtolower($this->htmlEscape($this->__($_data['label']))) == 'manufacturer'): ?>
</a>
<?php endif; ?>
</td>
</tr>
<?php endif; ?>
<?php endforeach; ?>
</tbody>
</table>
<?php } ?>
You can use the below code in your list.phtml file to get the product's attribute data.
<?php
$attributes = $_product->getAttributes();
foreach ($attributes as $attribute) {
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 ($data) { ?>
<table class="data-table" id="product-attribute-specs-table">
<col width="25%" />
<col />
<tbody>
<?php foreach ($data as $_data): ?>
<?php if($_helper->productAttribute($_product, $_data['value'], $_data['code'])=="No" || $_helper->productAttribute($_product, $_data['value'], $_data['code']) =="Ei" | $_helper->productAttribute($_product, $_data['value'], $_data['code'])=="???"): ?>
<?php else: ?>
<?php if(strtolower($this->htmlEscape($this->__($_data['label']))) == 'manufacturer'): ?>
<?php $_category = Mage::getModel('catalog/category')->loadByAttribute('name', $_helper->productAttribute($_product, $_data['value'], $_data['code'])); ?>
<?php endif; ?>
<tr>
<th class="label"><?php echo $this->htmlEscape($this->__($_data['label'])) ?></th>
<td class="data">
<?php if($_category && $_category->getUrl() && strtolower($this->htmlEscape($this->__($_data['label']))) == 'manufacturer'): ?>
<a href="<?php echo $_category->getUrl(); ?>" title="<?php echo $_helper->productAttribute($_product, $_data['value'], $_data['code']); ?>">
<?php endif; ?>
<?php echo $_helper->productAttribute($_product, $_data['value'], $_data['code']) ?>
<?php if($_category && $_category->getUrl() && strtolower($this->htmlEscape($this->__($_data['label']))) == 'manufacturer'): ?>
</a>
<?php endif; ?>
</td>
</tr>
<?php endif; ?>
<?php endforeach; ?>
</tbody>
</table>
<?php } ?>
Hope it helps!!!
default