I am trying to display attributes of simple products on a grouped product page. I have everything setup to pull the info. My issue is how to display it correctly. I have two foreach loops that display the data but I get:

Manufacturer: UPC: Manufacturer Part Number: X-Stream0100055PLV-A-B

When I want it to be

Manufacturer: X-Stream
UPC: 0100055
Manufacturer Part Number: PLV-A-B

The code used is

<?php foreach($gridattributes as $attrib){
echo '<b>'.$this->htmlEscape($attrib[label]).': </b>';} ?>

<?php foreach($gridattributes as $attribname=>$attribval){
echo ''.$this->htmlEscape($_item->getData($attribname)).'';} ?>  

How can I merge these to display as my second example?
Thank you for any help.

1 Answer 1


Have You tried as below ?

<?php foreach($gridattributes as $attribname=>$attribval):?>
    <b><?php echo $this->htmlEscape($attribval['label']);?></b>
    <?php echo $this->htmlEscape($_item->getData($attribname));?>
<?php endforeach;?>
  • That does it perfectly. Thank you very much!
    – jrl2222
    Dec 3, 2016 at 6:10
  • @jrl2222 you can accept and up vote then Dec 3, 2016 at 6:12
  • When I upvote it says Thanks for the feedback! Votes cast by those with less than 15 reputation are recorded, but do not change the publicly displayed post score.
    – jrl2222
    Dec 3, 2016 at 6:56
  • yes. it will show as up vote when you have 15+ reputation Dec 3, 2016 at 7:41

Your Answer

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

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