-
- fazy

-
Total Posts: 2
Joined: 2012-07-05
|
Hi,
I need to list bundled product attributes on product view page.
I have base product id-s, which bundled, and also have attribute sets names listed on my page, but I can’t get attribute labels and values.
This oode part works perfectly with simple product, but in bundle, the $_additional array will be empty.
Anyone can help me out on this?
if ($_product->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_BUNDLE) { ?> <table class="compare" style="font-size: 11px; " cellspacing="0"> <? $bp = $_product->getTypeInstance(true)->getChildrenIds($_product->getId(), false);
?> <? foreach ($bp[0] as $item) { //$item has product id-s which was bundled
$_AP = Mage::getModel('catalog/product')->load($item); $attributes_by_groups = array(); $group_names = array(); $group_ids = array();
$attributes = Mage::getModel('catalog/product')->load($item)->getAttributes(); $attribute_set = Mage::getModel('eav/entity_attribute_set')->load( $_AP->getAttributeSetId() ); $attribute_set_Id = $attribute_set->getAttributeSetId(); $attribute_set_Name = $attribute_set->getAttributeSetName(); foreach ($attributes as $attribute) { if ($attribute->getIsVisibleOnFront() && $attribute->getIsUserDefined()) { $group_id = $attribute->getData('attribute_set_info/' . $_AP->getAttributeSetId() . '/group_id'); if (!in_array($group_id, $group_ids)) { array_push($group_ids, $group_id); }
if ( !isset($group_names[$group_id]) ) { $group_model = Mage::getModel('eav/entity_attribute_group'); $group_model->load($group_id);
$group_names[$group_id] = $group_model->getAttributeGroupName(); } } } if($_additional = $this->getAdditionalData()): ?>
<?php foreach ($group_ids as $group_id): ?> <?php $group_name = $group_names[$group_id]; $exclAttr_Arr = array(); foreach ($attributes as $attribute){
if (!(($attribute->getAttributeGroupId()) == $group_id)){ array_push($exclAttr_Arr, ($attribute->getAttributeCode())); } } ?> <tr class="groupheader"><th colspan="2"><h4><?php echo $group_name;?></h4></th></tr>
<?php $_additional = $this->getAdditionalData($exclAttr_Arr); print_r($_additional); //THIS IS EMPTY ?> <?php foreach ($_additional as $_data): ?> <? if (strpos($_data['value'], 'Nem') === false) { ?> <? if ($this->htmlEscape($this->__($_data['label'])) != "Tesztek" ) : ?> <? if ( $this->htmlEscape($this->__($_data['label'])) != "Garancia") :?>
<tr> <th><?php echo $this->htmlEscape($_AP->__($_data['label'])) ?></th> <td style="text-align: center;" > <? if (strpos($_data['value'], 'Igen') !== false) { echo "<img src=\"".$this->getSkinUrl('images/check.gif') . "\" alt=\"Igen\" />"; } else { ?> <?php echo $_helper->productAttribute($_product, $_data['value'], $_data['code']) ?></td> <? } ?> </tr> <? endif; ?> <? endif; ?> <? } ?> <?php endforeach; ?> <?php endforeach; ?> <?php endif;
}
|