Skip to content

Commit

Permalink
#380: Correct browser pre-fill activates blocks that should be hidden
Browse files Browse the repository at this point in the history
  • Loading branch information
lat9 committed Aug 19, 2023
1 parent 8bfce33 commit eb2517b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 11 deletions.
1 change: 1 addition & 0 deletions docs/one_page_checkout/readme.html
Original file line number Diff line number Diff line change
Expand Up @@ -736,6 +736,7 @@ <h3>Template-specific &quot;jscript_framework.php&quot; is Required</h3>
<li>BUGFIX: Remove all but essential, i.e. interface errors, PHP user-error-exits, replacing with customer messaging and warning logs.</li>
<li>BUGFIX: Correct PHP Warnings when <var>ACCOUNT_STATE</var> is set to 'false'.</li>
<li>BUGFIX: Correct "Invalid form control, element is not visible" (square_webPay integration).</li>
<li>BUGFIX: Correct browser's pre-fill causes activation of hidden payment/shipping elements.</li>
<li>The following files were changed or <span class="added">added</span>:<ol>
<li>/includes/classes/OnePageCheckout.php</li>
<li>/includes/classes/ajax/zcAjaxOnePageCheckout.php</li>
Expand Down
24 changes: 14 additions & 10 deletions includes/modules/pages/checkout_one/jquery.checkout_one.js
Original file line number Diff line number Diff line change
Expand Up @@ -751,11 +751,13 @@ jQuery(document).ready(function(){

function changeBillingFields(event)
{
jQuery(this).addClass('opc-changed');
jQuery('#checkoutOneBillto .opc-buttons, #opc-bill-save, #opc-add-bill, #opc-add-bill+label').show();
jQuery('#opc-bill-edit').hide();
jQuery('#checkoutPayment > .opc-overlay').addClass('active');
jQuery('#checkoutOneGuestInfo, #checkoutOneBillto').addClass('opc-view');
if (jQuery('#address-form-bill').is(':visible')) {
jQuery(this).addClass('opc-changed');
jQuery('#checkoutOneBillto .opc-buttons, #opc-bill-save, #opc-add-bill, #opc-add-bill+label').show();
jQuery('#opc-bill-edit').hide();
jQuery('#checkoutPayment > .opc-overlay').addClass('active');
jQuery('#checkoutOneGuestInfo, #checkoutOneBillto').addClass('opc-view');
}
}
jQuery(document).on('focus', '#checkoutOneGuestInfo input, #checkoutOneBillto input, #checkoutOneBillto select:not(#select-address-bill)', changeBillingFields);

Expand Down Expand Up @@ -802,11 +804,13 @@ jQuery(document).ready(function(){

function changeShippingFields(event)
{
jQuery(this).addClass('opc-changed');
jQuery('#checkoutOneShipto .opc-buttons, #opc-ship-save, #opc-add-ship, #opc-add-ship+label').show();
jQuery('#checkoutPayment > .opc-overlay').addClass('active');
jQuery('#checkoutOneShipto').removeClass('visibleField');
jQuery('#checkoutOneShipto').addClass('opc-view');
if (jQuery('#address-form-ship').is(':visible')) {
jQuery(this).addClass('opc-changed');
jQuery('#checkoutOneShipto .opc-buttons, #opc-ship-save, #opc-add-ship, #opc-add-ship+label').show();
jQuery('#checkoutPayment > .opc-overlay').addClass('active');
jQuery('#checkoutOneShipto').removeClass('visibleField');
jQuery('#checkoutOneShipto').addClass('opc-view');
}
}
jQuery(document).on('focus', '#checkoutOneShipto input, #checkoutOneShipto select:not(#select-address-ship)', changeShippingFields);

Expand Down

0 comments on commit eb2517b

Please sign in to comment.