I want to show the Attribute Group names, not only the attributes in additional tab of product page. It means that before every group attributes, the name of that group is show.
I also try this solution but it is not eorking for me!!!
I know that I should make changes in app\design\frontend\default\celebrity\template\catalog\product\view in attributes.phtml file but I don't know how.
How can I do this?
after the for loop in attributes.phtml
<?php if ($_setId = $_product->getAttributeSetId()):?> <?php $_set = Mage::getModel('eav/entity_attribute_set')->load($_setId);?> <tr> <th class="label"><?php echo $this->__('Attribute Set') ?></th> <td class="data"><?php echo $this->escapeHtml($set->getAttributeSetName()) ?></td> </tr> <?php endif;?>
never mind, I misread it
Please use this for your purpose.
Hope this helps.
Thanks!
It doesn't install on my store.
Go to magento root directory and follow below steps:
Step 1:
\app\code\core\Mage\Catalog\Block\Product\View\Attributes.php copy Attributes.php file and paste
\app\code\local\Mage\Catalog\Block\Product\View\Attributes.php here and Edit Attributes.php file
Add this code after Line number 82
public function getAdditionalDataCustom(array $excludeAttr = array()) { $data = array(); $product = $this->getProduct(); $attributes = $product->getAttributes(); foreach ($attributes as $attribute) { if ($attribute->getIsVisibleOnFront() && !in_array($attribute->getAttributeCode(), $excludeAttr)) { $value = $attribute->getFrontend()->getValue($product); if (is_string($value)) { if (strlen($value) && $product->hasData($attribute->getAttributeCode())) { if ($attribute->getFrontendInput() == 'price') { $value = Mage::app()->getStore()->convertPrice($value,true); } $group = 0; if( $tmp = $attribute->getData('attribute_group_id') ) { $group = $tmp; } $data[$group]['items'][ $attribute->getAttributeCode()] = array( 'label' => $attribute->getStoreLabel(), 'value' => $value, 'code' => $attribute->getAttributeCode() ); $data[$group]['attrid'] = $attribute->getId(); } } } } foreach( $data AS $groupId => &$group ) { $groupModel = Mage::getModel('eav/entity_attribute_group')->load( $groupId ); $group['title'] = $groupModel->getAttributeGroupName(); } return $data; }
step 2:
app\design\frontend\MyPakage\MyTheme\template\catalog\product\view\attributes.phtml Edit attribute.phtml file replace the Old code
<?php $_helper = $this->helper('catalog/output'); $_product = $this->getProduct() ?> <?php if($_additionalgroup = $this->getAdditionalDataCustom()): ?> <div class="box-collateral box-additional"> <h2><?php echo $this->__('Additional Information') ?></h2> <?php $i=0; foreach ($_additionalgroup as $_additional): $i++; ?> <h3><?php echo $this->__( $_additional['title'] )?></h3> <table class="data-table" id="product-attribute-specs-table-<?php echo $i?>"> <col width="25%" /> <col /> <tbody> <?php foreach ($_additional['items'] as $_data): ?> <tr> <th class="label"><?php echo $this->htmlEscape($this->__($_data['label'])) ?></th> <td class="data"><?php echo $_helper->productAttribute($_product, $_data['value'], $_data['code']) ?></td> </tr> <?php endforeach; ?> </tbody> </table> <script type="text/javascript">decorateTable('product-attribute-specs-table-<?php echo $i?>')</script> <?php endforeach; ?> </div> <?php endif;?>
As per the Atribute group name the structure may change which easily can be managed by css.
Hope this helps!
Worked like a charm Thank you
But now i have another problem. My attributes used to be like :
-cpu model
-cpu series
-cpu cores
But now it is :
CPU
-model
-series and so on
On layered navigation on gpu model and cpu model it is only model so you don't know which is which. Is there a way to implement this in the layered navigation to group attributes there as well ? Thank you
Hi @triti
You are welcome
We are not getting, issues you are facing from your details.
Sorry my english is realy bad, perhaps i did not explain well. Is there a way to group the attributes in the layered navigation where you filter products ? Thank you for the quick responce