So I have an Attribute Set called Tractor Parts and in that set I have a group called Manufacturers.
Currently I have 3 attributes in the group
- allis_chalmers
- Case
- john_deere
What I am trying to do is list these attributes in a tab on the product view ONLY if the attribute has a value for this product. I can pull the value off the attributes individually but this is not elegant at all, not to mention cumbersome...
I can get the attribute names from the group and get those to show in the tab. I am not sure how to go about getting the value of the attribute for the current product.
Here is the code I have at the moment
<?php
require_once 'app/Mage.php';
Mage::app();
$attributeGroupCollection = Mage::getResourceModel('eav/entity_attribute_group_collection');
foreach ($attributeGroupCollection as $attributeGroup) {
$attributeGroup->getAttributeGroupId();
}
$attributeCollection = Mage::getResourceModel('eav/entity_attribute_collection')
->setAttributeGroupFilter($attributeGroup->getAttributeGroupId());
?>
<table class="data-table" id="product-attribute-specs-table">
<col width="25%" />
<col />
<tbody>
<?php foreach ($attributeCollection as $attribute): ?>
<tr>
<th class="label"><?php echo $attribute->getStoreLabel() ?></th>
<td class="data"><?php echo ***attribute value for product*** ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<script type="text/javascript">decorateTable('product-attribute-specs-table')</script>
The bold Italic part is what I can't figure out. I think I need to load the product but not sure how. Any help would be greatly appreciated!!