This is an old revision of the document!


type:
snippet
name:
Making the the shipping and payment fields hidden until a valid selection is made for guest/login step of checkout
reference:
http://forum.foxycart.com/comments.php?DiscussionID=4022&page=1

Making the the shipping and payment fields hidden until a valid selection is made for guest/login step of checkout

Making the the shipping and payment fields hidden until a valid selection is made for guest/login step of checkout, adding the functionality that was present pre 050.

<script type="text/javascript" charset="utf-8">
  jQuery(document).ready(function() {
    jQuery("#fc_data_entry_container").hide();
 
    jQuery("#fc_data_entry_container").ajaxComplete(function(event, request, settings) {
      toggleDataEntry();
    });
 
    jQuery("#is_anonymous_0, #is_anonymous_1").click(function(){
      toggleDataEntry();
    });
  })
 
  function toggleDataEntry() {
    if (jQuery("#is_anonymous_0").is(":checked")) {
      if (jQuery("#customer_id").val() != "0") {
        jQuery("#fc_data_entry_container").show();
      } else {
        if ($("#customer_password2").is(":visible")) {
          jQuery("#fc_data_entry_container").show();
        } else {
          jQuery("#fc_data_entry_container").hide();
        }
      }
		} else {
      jQuery("#fc_data_entry_container").show();
		}
  }
</script>

Site Tools