• Resolved 4alexandr

    (@4alexandr)


    Bug present in http://plugins.svn.wordpress.org/jigoshop/tags/1.15.5/assets/js/checkout.js

    You create AJAX request “jigoshop_update_order_review” and replace exists page content with response:
    Line 62
    $('#order_review_heading').after(response);

    Then you call click event on selected payment element
    $payment_method.click();
    Problem: $payment_method contains old DOM element, which was replaced with AJAX response.
    You must call click for new DOM element:
    jQuery('input[name=payment_method]:checked').click();

    Next
    Line 161
    $('.payment_methods').on('click', '.input-radio', function(){
    You bind event direct to .payment_methods DOM elements, which was replaced with response too.
    You must bind event to document element
    jQuery(document).on('click', '.payment_methods .input-radio', function(){

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hello @4alexandr,

    Unfortunately you are mistaken: the code you mention removes only div#order_review and adds another div#order_review from the jigoshop_update_order_review AJAX action. Nothing else is replaced thus $payment_method and everything else is still in the DOM as it was before calling this method.

    Please take a closer look at the code and code for jigoshop_update_order_review AJAX action.

    Thread Starter 4alexandr

    (@4alexandr)

    I looked at the code in more detail, you’re right.

    But code
    $('#order_methods, #order_review').remove();
    removes two elements.
    I saw #order_methods and it directed me in the wrong direction.

    My problem – someone change template and #payment now in #order_review element.

    I will fix it, thanks.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Bug in checkout.js’ is closed to new replies.