Skip to main content
added 14 characters in body
Source Link

Not sure if I understand your issue correctly but try

$ct = 0;
foreach($allProducts as $p){
  if(!$p->isSaleable()) continue; 
  $out = $p->getAttributeText($pAtt->getName());
  $frontValues[$ct]=$out;$frontValues[$out]=$out; 
  $colors=$p->getData(strtolower($pAtt->getName()));
  $colorValues[$ct]=$colors; 
  $colorValues[$out]=$colors; $ct++;
}


<?php foreach($frontValues  as $key => $value) : ?>
   <li><a id="a-<?php echo $colorValues[$key] ?>"><?php echo $value ?></li> 
<?php endforeach; ?>

or

$output = array();
foreach($allProducts as $p){
  if(!$p->isSaleable()) continue; 
  $output[]$output[$p->getAttributeText($pAtt->getName())] = array(
                'out' => $p->getAttributeText($pAtt->getName()),
                'color' => $p->getData(strtolower($pAtt->getName()))
              );
}

<?php foreach($output  as $key => $value) : ?>
   <li><a id="a-<?php echo $value['color'] ?>"><?php echo $value['out'] ?></li> 
<?php endforeach; ?>

Not sure if I understand your issue correctly but try

$ct = 0;
foreach($allProducts as $p){
  if(!$p->isSaleable()) continue; 
  $out = $p->getAttributeText($pAtt->getName());
  $frontValues[$ct]=$out; 
  $colors=$p->getData(strtolower($pAtt->getName()));
  $colorValues[$ct]=$colors; 
   $ct++;
}


<?php foreach($frontValues  as $key => $value) : ?>
   <li><a id="a-<?php echo $colorValues[$key] ?>"><?php echo $value ?></li> 
<?php endforeach; ?>

or

$output = array();
foreach($allProducts as $p){
  if(!$p->isSaleable()) continue; 
  $output[] = array(
                'out' => $p->getAttributeText($pAtt->getName()),
                'color' => $p->getData(strtolower($pAtt->getName()))
              );
}

<?php foreach($output  as $key => $value) : ?>
   <li><a id="a-<?php echo $value['color'] ?>"><?php echo $value['out'] ?></li> 
<?php endforeach; ?>

Not sure if I understand your issue correctly but try

foreach($allProducts as $p){
  if(!$p->isSaleable()) continue; 
  $out = $p->getAttributeText($pAtt->getName());
  $frontValues[$out]=$out; 
  $colors=$p->getData(strtolower($pAtt->getName()));
  $colorValues[$out]=$colors; 
}


<?php foreach($frontValues  as $key => $value) : ?>
   <li><a id="a-<?php echo $colorValues[$key] ?>"><?php echo $value ?></li> 
<?php endforeach; ?>

or

$output = array();
foreach($allProducts as $p){
  if(!$p->isSaleable()) continue; 
  $output[$p->getAttributeText($pAtt->getName())] = array(
                'out' => $p->getAttributeText($pAtt->getName()),
                'color' => $p->getData(strtolower($pAtt->getName()))
              );
}

<?php foreach($output  as $key => $value) : ?>
   <li><a id="a-<?php echo $value['color'] ?>"><?php echo $value['out'] ?></li> 
<?php endforeach; ?>
added 469 characters in body
Source Link

Not sure if I understand your issue correctly but try

$ct = 0;
foreach($allProducts as $p){
  if(!$p->isSaleable()) continue; 
  $out = $p->getAttributeText($pAtt->getName());
  $frontValues[$ct]=$out; ?>
  $colors=$p->getData(strtolower($pAtt->getName()));
  $colorValues[$ct]=$colors; 
  $ct++;
}


<?php foreach($frontValues  as $key => $value) : ?>
   <li><a id="a-<?php echo $colorValues[$key] ?>"><?php echo $value ?></li> 
<?php endforeach; ?>

or

$output = array();
foreach($allProducts as $p){
  if(!$p->isSaleable()) continue; 
  $output[] = array(
                'out' => $p->getAttributeText($pAtt->getName()),
                'color' => $p->getData(strtolower($pAtt->getName()))
              );
}

<?php foreach($output  as $key => $value) : ?>
   <li><a id="a-<?php echo $value['color'] ?>"><?php echo $value['out'] ?></li> 
<?php endforeach; ?>

Not sure if I understand your issue correctly but try

$ct = 0;
foreach($allProducts as $p){
  if(!$p->isSaleable()) continue; 
  $out = $p->getAttributeText($pAtt->getName());
  $frontValues[$ct]=$out; ?>
  $colors=$p->getData(strtolower($pAtt->getName()));
  $colorValues[$ct]=$colors; 
  $ct++;
}


<?php foreach($frontValues  as $key => $value) : ?>
   <li><a id="a-<?php echo $colorValues[$key] ?>"><?php echo $value ?></li> 
<?php endforeach; ?>

Not sure if I understand your issue correctly but try

$ct = 0;
foreach($allProducts as $p){
  if(!$p->isSaleable()) continue; 
  $out = $p->getAttributeText($pAtt->getName());
  $frontValues[$ct]=$out; 
  $colors=$p->getData(strtolower($pAtt->getName()));
  $colorValues[$ct]=$colors; 
  $ct++;
}


<?php foreach($frontValues  as $key => $value) : ?>
   <li><a id="a-<?php echo $colorValues[$key] ?>"><?php echo $value ?></li> 
<?php endforeach; ?>

or

$output = array();
foreach($allProducts as $p){
  if(!$p->isSaleable()) continue; 
  $output[] = array(
                'out' => $p->getAttributeText($pAtt->getName()),
                'color' => $p->getData(strtolower($pAtt->getName()))
              );
}

<?php foreach($output  as $key => $value) : ?>
   <li><a id="a-<?php echo $value['color'] ?>"><?php echo $value['out'] ?></li> 
<?php endforeach; ?>
Source Link

Not sure if I understand your issue correctly but try

$ct = 0;
foreach($allProducts as $p){
  if(!$p->isSaleable()) continue; 
  $out = $p->getAttributeText($pAtt->getName());
  $frontValues[$ct]=$out; ?>
  $colors=$p->getData(strtolower($pAtt->getName()));
  $colorValues[$ct]=$colors; 
  $ct++;
}


<?php foreach($frontValues  as $key => $value) : ?>
   <li><a id="a-<?php echo $colorValues[$key] ?>"><?php echo $value ?></li> 
<?php endforeach; ?>