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:
- Transforming Karachi's Skylines with Fiber Shades
- Unveiling the Power of E911 Solutions Enhancing Caller Identification
- List of Top 10 Interior Designers in Pakistan
- buy registered drivers license online(legitcleandocs.com)passport,IELTS certific
- Malaysia Visit Visa from Dubai
- Buy Passport,Driver License,Age & ID Card,(Whatsapp:.......: +1 (551) 239-2904) Visas
- 슬롯사이트 추천 - 인터넷슬롯링크 2024 best 온라인슬롯
- Buy Passport,Driver License,Age & ID Card,(Whatsapp:.......: +1 (551) 239-2904) Visas
- Buy Passport,Driver License,Age & ID Card,Visas and Undetected Counterfeit Money. Ema
- Buy Passport,Driver License,Age & ID Card,(Whatsapp:.......: +1 (551) 239-2904) Visas
Bookmarks