type:
snippet
category:
checkout
name:
Making the the shipping and payment fields hidden until a valid selection is made for guest/login step of checkout
versions:
0.6.0, 0.7.0, 0.7.1, 0.7.2, 1.0
reference:
http://forum.foxycart.com/comments.php?DiscussionID=4022&page=1
tags:
snippets, checkout, advance
date:
2011-05-27

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(document).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