Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Rishi Mehta

    (@rcreators)

    Hello,

    Can you provide any url to check. Or let me know more details on which theme you are using and which add-ons and plugin with woocommerce.

    Thread Starter n2nguyen

    (@n2nguyen)

    The site: lupdelup.com

    Using this theme: http://themeforest.net/item/leka-amazing-woocommerce-theme/13782976

    I have
    -woocommerce sponsor a friend
    -Stripe gateway
    -pre-orders
    -Drop cart
    – email customizer

    I’ve sent an email to theme developer but have not heard back so I’m trying to see if I can tackle this

    Thanks

    Thread Starter n2nguyen

    (@n2nguyen)

    When I look at console, I get this error:
    Uncaught TypeError: Cannot read property ‘parent’ of undefined

    and it’s referencing this line in the code:
    var $button_view_cart = $button.parent().find(‘.added_to_cart’),

    The full code for add to cart portion is


    /**
    * Add to cart
    */
    try {
    $(document)
    .on( 'adding_to_cart', function ( e, $button, data ) {
    var $loading = get_ajax_loading(),
    $overlay = get_overlay();
    if (arexworks.options.show_ajax_overlay)
    $overlay.show();
    $loading.show();
    } )
    .on( 'added_to_cart', function( e, fragments, cart_hash, $button ){
    var $button_view_cart = $button.parent().find('.added_to_cart'),
    $loading = get_ajax_loading(),
    $overlay = get_overlay(),
    $product_image = $button.closest('.product').find('.product_thumbnail img:eq(0)'),
    target_attribute = $('body').is('.woocommerce-yith-compare') ? ' target="_parent"' : '',
    product_name;

    if( $product_image.length == 0 ){
    $product_image = $button.closest('tr').find('.product-thumbnail img:eq(0)');
    }
    if( $product_image.length == 0 && $button.closest('table').is('.compare-list')){
    $product_image = $button.closest('table').find('tr.image .image-wrap img:eq(0)');
    }

    if ( $button.data('product_title') != '')
    product_name = $button.data('product_title');
    else
    product_name = $button.closest('.product').find('.product-title-link').first().text();

    if (product_name == '')
    product_name = 'Product';

    $overlay.hide();
    $loading.hide();

    var custom_view_cart_html = '<span>';
    custom_view_cart_html += '<span class="icon"><i class="fa fa-check"></i></span>';
    custom_view_cart_html += '<span class="text">' + $button_view_cart.text() + '</span>';
    custom_view_cart_html += '</span>';

    $button_view_cart.addClass('button').html(custom_view_cart_html);

    var html = '<div class="popup-icon"><i class="fa fa-check-circle-o"></i></div>';
    html += '<div class="popup-message">' + arexworks_global_message.addcart.success + '</div>';
    html += '<div class="popup-product">';
    if ($product_image.length){
    html += $('<div>').append($product_image.clone()).html();
    }
    html += '<h5>' + product_name + '</h5>';
    html += '</div>';
    html += '' + wc_add_to_cart_params.i18n_view_cart + '';

    $('.shopping-bag-button .cart-items').html(fragments.total_item_count);

    arexworks.helpers.show_message(html);

    } );
    } catch ( ex ) { log_js( ex ); }

    Plugin Author Rishi Mehta

    (@rcreators)

    Hello,

    Sorry for the late response. I checked your website. Ajax is working fine for pre-order button. Now i didn’t get any popup on website. So let me know on it. Also when website load, it default give error for $ not loading in console in signup.js and unsubscribe.js. So it can be possible that this error blocks other js to function which loads after it.

    But right now i can see product is adding in cart successfully with ajax. Didn’t find any issue in it.

    Thread Starter n2nguyen

    (@n2nguyen)

    Oops, sorry, I was modifying another script while you too a look at it. Errors are fixed.

    I couldn’t figure out the “hidden” on the pop up so I just used display:none on <div class=”popup-product”> element. It’s suppose to show the image and info of the product. It worked on single product though.

    no worries, not a big a deal. I can live with just hiding it. thx

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘undefine’ is closed to new replies.