You need to go into template configuration product option file “configurable.phtml” and made changes below:

Comment code:-

<dt><label class=”requiredA”><?php echo $_attribute->getLabel() ?></label></dt>
<dd<?php if ($_attribute->decoratedIsLast){?> class=”last”<?php }?>>
<div class=”input-box”>
<select name=”super_attribute[<?php echo $_attribute->getAttributeId() ?>]” id=”attribute<?php echo $_attribute->getAttributeId() ?>” class=”required-entry super-attribute-select”>
<option><?php echo $this->__(‘Choose an Option…’) ?></option>
</select>
</div>
</dd>

Add New Code:-

<?php

if (!$_rendered):

$labAtt = $_attribute->getLabel();
$idAtt = $_attribute->getAttributeId();
$islastattr = $_attribute->decoratedIsLast;

$array_attr[$m][‘label’] = $labAtt;
$array_attr[$m][‘id’] = $idAtt;
$array_attr[$m][‘last’] = $islastattr;
endif;
$m++;
?>
<?php endforeach; ?>

<?php
//sorting
$j=0;
$flag = true;
$temp=0;
$countattr = count($array_attr)-1;

while ( $flag )
{
$flag = false;
for( $j=0; $j < $countattr; $j++)
{
//echo $j;
//

if ( $array_attr[$j][“label”] > $array_attr[$j+1][“label”] )
{
$temp = $array_attr[$j];
//swap the two between each other
$array_attr[$j] = $array_attr[$j+1];
$array_attr[$j+1]=$temp;
$flag = true; //show that a swap occurred
}
}
}

//sorting end
if(count($array_attr) >0){
$k=1;
foreach($array_attr as $array_attr_attrnew){
?>

<dt><label class=”requiredA”><?php echo $array_attr_attrnew[‘label’]; ?></label></dt>
<dd<?php if ($array_attr_attrnew[‘last’]){?> class=”last”<?php }?>>
<div class=”input-box”>
<select name=”super_attribute[<?php echo $array_attr_attrnew[‘id’]; ?>]” id=”attribute<?php echo $array_attr_attrnew[‘id’]; ?>” class=”required-entry super-attribute-select <?if($k==count($array_attr)){ echo’nonefromlabel’; }else if($k==1){ echo ‘firstbook’; } ?>”>
<option><?php echo $this->__(‘Choose an Option…’) ?></option>
</select>
</div>
</dd>

<?
$k++;
}

}

//print_r($array_attr);
?>

 

Your Answer
Sign In
Enter email and password to comment or answer
Not the answer you are looking for? Browse other questions tagged or ask your own question.