for ($i=0, $n=sizeof($values); $i<$n; $i++) {
$field .= '
if ($default == $values[$i]['id']) {
$field .= ' SELECTED';
}
$field .= '>' . tep_output_string($values[$i]['text'],
array('"' => '"', '\'' => ''',
'<' => '<', '>' => '>')) . '';
}
To the following:
// Criss - XES - altered the following:
foreach ($values as $i=>$value) {
$xes_values[$value['id']] = $value['text']; }
asort($xes_values);
foreach ($xes_values as $xes_id=>$xes_text) {
$field .= '
if ($default == $xes_id) {
$field .= ' SELECTED';
}
$field .= '>' . tep_output_string($xes_text,
array('"' => '"', '\'' => ''',
'<' => '<', '>' => '>')) . '';
}
Now when I can have product option "A - 9oz" and "B - 30oz" and count on option A being the default selected item if the customer doesn't change the option. Try as I might "B - 20oz" was the option selected. Whether I re-added the options in a different order, whether I took out A B C D, etc. If it were sorted in reverse order, I could have left out A B C D, because 9oz should sort to the top of the list. This wasn't the issue. I have no idea why the program was so stubborn about sort order, but now all drop-downs, like it or not, throughout the site, will be sorted alphabetically!
I hope people find this code snippet helpful!
No comments:
Post a Comment