Magento – Grouped product add additional attribute columns to table

As sometimes happens, the associated products table that displays on a grouped product isn’t showing enough information. You want to add more info.
Here is the default table.
Maybe you also need to show the sku number. Or a position number that matches with a schematic drawing of the product.
Here is what we are shooting for as finished table.
Regardless of what you are trying to output in the table, the process is the same.
Add attribute name to table head, and then output value inside the table, in the corresponding column.
Here is a bit of code that does just that:[download id=”2086″].
A few key points to remember:

  1. You will want to assign widths to each column, ie: width=5% so that the additional columns don’t break the table layout. If you want a wider column for the name, use a larger percentage value for width.
  2. To output your additional attributes, make sure to use getAttribute, ie: getSku. This will output the sku number inside your column. You can also insert custom attributes as needed.
  3. Adding a position value can be done by declaring a variable named ‘count’, then adding 1 to it each time through the foreach loop. This will assign a sequential number to each item in the table, starting with 1.

Good luck!

This entry was posted in Magento. Bookmark the permalink.