Jump to content

Blaise

Members
  • Content count

    5
  • Joined

  • Last visited


Reputation Activity

  1. Like
    Blaise got a reaction from CrazyCarzCustoms in [Contribution] Option Types v2   
    Hi there, firstly thanks for such a great contribution (after managing to get it to finally work). I thought I'd share a little script I added to catalog/includes/modules/option_types.php for the radio button attributes. I wanted to have the first radio button of a group checked by default when the product was first opened (well, as a radio group, one item should be selected at all times). It checked if anything is checked first as a customer might click on the product from the shopping chart.
     
    Add this just before end of the OPTION_TYPE_RADIO switch statement.

    // jscript to "check" the first radio button if nothing is checked - Chris 13/07/2012 $tmp_html .= '<script>' . ' $(function() {' . ' if ($(\'input:radio[name=id[' . $ProdOpt_ID . ']]:checked\').val() == undefined) {' . ' $(\'input:radio[name=id[' . $ProdOpt_ID . ']]:nth(0)\').prop(\'checked\',true);' . ' }' . ' });' . '</script>';
     
    Hope this is of use to others.
×