Hey Guys,

Please help me, I've been stuck with this all day...

I have this code:
Code:
                          <?php if($_product->isConfigurable()): ?>
                            <?php $attributes = $_product->getTypeInstance(true)->getConfigurableAttributes($_product) ?>
                            <?php if(count($attributes)): ?>
                              <div>
                              <?php foreach($attributes as $att): ?>
                                <?php $pAtt=$att->getProductAttribute();
                                  if ($pAtt->getFrontendLabel() != 'Color') continue;
                                  //get the child products
                                  $allProducts = $_product->getTypeInstance(true)->getUsedProducts(null, $_product);
                                  $frontValues =array() ?>
                                <div style="text-align:center;"><!--<?php echo $pAtt->getFrontendLabel() ?>-->
                                 <ul>
                                 <?php foreach($allProducts as $p): ?>
                                   <?php if(!$p->isSaleable()) continue; ?>
                                   <?php $out=$p->getAttributeText($pAtt->getName()); ?>
                                   <?php $frontValues[$out]=$out; ?>
                                   <?php $colors=$p->getData(strtolower($pAtt->getName()))?>
                                 <?php endforeach ?>
                                  <li><a id="a-<?php echo $colors ?>"><?php echo implode('</li><li>', $frontValues) ?></a></li>
                                 </ul>
                                </div>
                              <?php endforeach ?>
                              </div>
                            <?php endif ?>
                          <?php endif ?>
It works, get's the colors.

But to style them I'm adding ID to every <a> so it would be easy to target them.

But at the moment it add's the same color value to all the colors that it retreives... I'm new to this, so I can't figure out how to add this to the array.

Can anyone please help me!

Thanks,

View more threads in the same category: