Jump to content
  • Checkout
  • Login
  • Get in touch


The e-commerce.

OSC Product Attribute Radio Selection - default top problem!


Recommended Posts

Hello Everyone,


I have installed the following contributions:




(Sorting the order of the product's attributes based on price)






(Making it so that the attributes are radio buttons instead of a drop down selection)


However, it seems like the radio attribute automatically chooses the bottom first selection instead of the default top one. I know this is a simple fix in PHP, but Im a bit stumped.


I believe it lies somewhere in this code:

// Output a form radio menu for product info page maniac101
 function tep_draw_radio_menu($name, $values, $default = '', $parameters = '', $required = false) {
$field ='<table border="0" cellspacing="0" cellpadding="0"><tr><td class="main">';  
if (empty($default) && isset($GLOBALS[$name])) $default = stripslashes($GLOBALS[$name]);

for ($i=0, $n=sizeof($values); $i<$n; $i++) {
  $value = tep_output_string($values[$i]['id']);
  $field .= '<input type="radio" name="' . $name . '" value="' . $value . '"';
	$field .= ' checked';

  $field .= '>' . tep_output_string($values[$i]['text'], array('"' => '"', '\'' => ''', '<' => '<', '>' => '>')) . '</br>';
$field .= '</td></tr></table>';

if ($required == true) $field .= TEXT_FIELD_REQUIRED;

return $field;



Would anyone have a clue?

Link to comment
Share on other sites

Thanks Peter but that wasn´t any help unfortunately.

The issue here is not the sort problem which already has been taken care of.

Read his first post again and you´ll see that it is about the radio buttons and the default ticked/checked value.


Thanks for your answer though.


Kind regards.

Link to comment
Share on other sites

The quickest fix that I have found for this is to just change


$field .= ' checked';




$field .= ' unchecked';



This way the customer will have the option to make the selection, rather than it being auto selected.

From there, you can either make them mandatory fields, or hope the customer is aware enough to make a selection before checkout.


Not the greatest fix to a problem, but it does work.

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...