I'm working on building a new Magento shop (this is my first with Magento).

I'm looking to replicate the look of an existing shop for my product pages, at least in terms of layout:



I've figured out that I need to use grouped products, with simple products to create the kind of thing I'm after.

In the examples above, each product has separate attributes, I assume these are done via different attribute sets in Magento.

However how do they go displaying those different table headings/values in the theme?

I know I can do ->getAttributeName() or ->getAttribute('attribute_code') in the grouped.phtml file, but this would result in a vast amount of if (->getAttributeName() != '')... and I'd need to change the template when adding more.

I'm sure there is a way of getting all attributes and looping over them, but then how would you differentiate between say the meta_description attribute (also returned by the $_product->getData() method) and an attribute I'd want listed in the table?

How could I achieve something akin to what they have?

I'm also concerned about performance the shop will have 5k products at launch, growing to perhaps 25k-30k as we add our remaining stock. Many of these will need different attributes, but I'm guessing I could share attributes between attribute sets without too many performance issues?


I've carried on playing around with this, I've found this to get all of a products attributes, however I still don't know of a simple way of showing on certain values on a grouped product table?

$attributes = Mage::getModel('catalog/product_attribute_api')->items($_product->getAttributeSetId());
foreach($attributes as $_attribute){
  • Why not use the "Visible on Product View Page on Front-end" property of the attribute to determine whether to show it on the product page?
    – BlueC
    May 26, 2016 at 20:26

2 Answers 2


This should be what you need:

  • But this would just get a single attribute, I need a way of showing different attributes for different products - as per the links I included in the OP?
    – Tom Green
    Mar 3, 2015 at 13:01

Why not create an attribute that tells it what attributes to show?

I ended up creating a module that loads the value of two text attributes for grouped products that are attribute code strings. Essentially a helper that Explodes that attribute list string and loops over it to load the associated products attribute data.

Create an attribute I called mine:


Add the attribute to the grouped product's design attribute set in the admin and then them as a semicolon separated field in the product data


I pulled this code from my module. It's doing some more loading or hiding of default attributes based on a an attribute value and the module is a little more complex. But to get the data shown in the table these are some of the core functions. Hopefully it gives you an idea to build on. This is using magento 1.9.2

The Module's Helper:

public function findAttributes($product, $attributes)
    //determined by attribute with id to add additional attributes to the table
    //string needs to be ; separated in ADMIN
    $strattributes = $product->getResource()->getAttribute('grouped_attr_array')->getFrontend()->getValue($product);
    if ($strattributes) {
        $strattributes = explode(';', $strattributes, 5);
        foreach ($strattributes as $additionAttribute) {
            //make sure these are valid attributes
            if ($product->getResource()->getAttribute($additionAttribute)) {
                array_push($attributes, $additionAttribute);

public function groupedAttrDump($groupedProduct, $attributes)
    $cells = [];
    foreach ($attributes as $attrCode) {
        $attrText = $groupedProduct->getResource()->getAttribute($attrCode);
            array_push($cells, $attrText->getFrontend()->getValue($groupedProduct));
    return $cells;

public function groupedAttrHeaders($currentProduct, $attributes)
    $theads = [];
    foreach ($attributes as $attrCode) {
        $headerText = $currentProduct->getResource()->getAttribute($attrCode);
            $headerText = $headerText->getStoreLabel();

    return $theads;

Getting Data from helper in groupedproduct.phtml

$attrrSetName = Mage::getModel("eav/entity_attribute_set")->load($_product->getAttributeSetId())->getAttributeSetName();
$tableAttributes = Mage::helper('groupedtable')->findAttributes($_product, $attrrSetName);


     <?php foreach (Mage::helper('groupedtable')->groupedAttrHeaders($_product, $tableAttributes) as $attrLabel ): ?>
        <th><?php echo $attrLabel ?> </th>
     <?php endforeach; ?>

TD's the table

<?php foreach (Mage::helper('groupedtable')->groupedAttrDump($_associatedProduct, $tableAttributes) as $attr ):?>
        <td><?php if($attr != 'No'){ echo $attr; } ?></td>
   <?php endforeach; ?>

I'd like to build out the way of choosing that attribute based on the store's available attributes. Maybe there'a much better way to do this too. Haven't gotten to that yet.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.