Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

OSC Product Attribute Radio Selection - default top problem!


Eprime

Recommended Posts

Posted

Hello Everyone,

 

I have installed the following contributions:

 

http://www.oscommerce.com/forums/index.php?showtopic=123629

 

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

 

and

 

http://www.oscommerce.com/community/contri...ll/search,radio

 

(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?

Posted

I´m with you here Eprime and hoping someone could help us out with this. Can´t be hard for all you skilled people out there.

 

Please give us a hand..

 

Kind regards

Posted

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.

Posted

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

 

$field .= ' checked';

 

to

 

$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.

Archived

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

×
×
  • Create New...