PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Javascript conflict with WooCommerce

  1. I'm getting an weird javascript error on the WooCommerce Reports section:

    'Uncaught TypeError: Cannot set property 'w' of undefined'

    It seems there is a conflict with the Gravity Forms Paypal Add-on. With version 1.3.1 it seems to work al fine... These issues came with the latest update (1.5). Can this be a conflict of using different versions of jquery.flot? If so, are these files loaded the right way?

    Does anyone got an idea how to fix this?

    Posted 11 years ago on Tuesday December 4, 2012 | Permalink
  2. Please provide a link to the site where we can see this conflict. Thank you.

    Posted 11 years ago on Thursday December 6, 2012 | Permalink
  3. We can't provide an link to an site with this problem. You can however easily reproduce this by installing the WooCommerce (http://wordpress.org/extend/plugins/woocommerce/) plugin. If we enabled the Gravity Forms PayPall Add-On we see the following error in Firebug on the WooCommerce reports page (/wp-admin/admin.php?page=woocommerce_reports):

    TypeError: e is undefined
    /wp-content/plugins/woocommerce/assets/js/admin/jquery.flot.resize.min.js?ver=1.0
    Line 1

    We are not sure why this error occures when the PayPall Add-On is activated. Maybe the problem can be solved by not adding the following scripts to other pages then Gravity Forms:

    <script type='text/javascript' src='http://rt.beta.pronamic.nl/wp-content/plugins/gravityforms/js/jquery.qtip-1.0.0-rc2.min.js?ver=1.6.9'></script>
    <script type='text/javascript' src='http://rt.beta.pronamic.nl/wp-content/plugins/gravityforms/js/qtip_init.js?ver=1.6.9'></script>
    <link rel='stylesheet' id='gf_tooltip-css'  href='http://rt.beta.pronamic.nl/wp-content/plugins/gravityforms/css/tooltip.css?ver=1.6.9' type='text/css' media='all' />
    Posted 11 years ago on Friday December 7, 2012 | Permalink
  4. In that last block of scripts, are those present in the source of the Woocommerce reports page?

    Posted 11 years ago on Monday December 10, 2012 | Permalink
  5. In that last block of scripts, are those present in the source of the Woocommerce reports page?

    Yes, if i comment the following line (#4) in plugins\gravityforms\tooltips.php i no longer see the error:

    // add_action("admin_print_scripts", 'print_tooltip_scripts');

    I can't find out why this problem only occures when the PayPal Add-On is enabled.

    Posted 11 years ago on Wednesday December 12, 2012 | Permalink
  6. I will bring this to the attention of the development team. Gravity Forms does not normally outputt its own scripts on other plugin's management pages.

    Posted 11 years ago on Wednesday December 12, 2012 | Permalink
  7. Hi pronamic,

    I am unable to recreate this issue. If you can recreate this issue on a site where you can provide us access, we'll be happy to dig in. Send the login details to us via our Contact Us form (or Priority Support if you have access).

    Posted 11 years ago on Thursday December 13, 2012 | Permalink
  8. We can also not reproduce this problem on an other environemt, but i have managed to get some more information. If i disable the PayPal Add-On we see the following changes on the admin page:

    -<script type='text/javascript' src='http://www.domainname.tld/wp-content/plugins/gravityforms/js/jquery.qtip-1.0.0-rc2.min.js?ver=1.6.11'></script>
    -<script type='text/javascript' src='http://www.domainname.tld/wp-content/plugins/gravityforms/js/qtip_init.js?ver=1.6.11'></script>
    -<link rel='stylesheet' id='gf_tooltip-css'  href='http://www.domainname.tld/wp-content/plugins/gravityforms/css/tooltip.css?ver=1.6.11' type='text/css' media='all' />

    Also if i comment the following line in te PayPal Add-On this problem is fixed:

    //loading Gravity Forms tooltips
    require_once(GFCommon::get_base_path() . "/tooltips.php");

    If you just can make sure the tooltip scripts are only loaded on the Gravity Forms and PayPal Add-On pages it would be fixed.

    //loading Gravity Forms tooltips
    require_once(GFCommon::get_base_path() . "/tooltips.php");
    add_filter('gform_tooltips', array('GFPayPal', 'tooltips'));
    
    if(self::is_paypal_page()){
    
        //enqueueing sack for AJAX requests
        wp_enqueue_script(array("sack"));
    
        //loading data lib
        require_once(self::get_base_path() . "/data.php");
    
        //loading upgrade lib
        if(!class_exists("RGPayPalUpgrade"))
            require_once("plugin-upgrade.php");
    
        //runs the setup when version changes
        self::setup();
    
    }

    I have changed this to:

    if(self::is_paypal_page()){
    
        //loading Gravity Forms tooltips
        require_once(GFCommon::get_base_path() . "/tooltips.php");
        add_filter('gform_tooltips', array('GFPayPal', 'tooltips'));
    
        //enqueueing sack for AJAX requests
        wp_enqueue_script(array("sack"));
    
        //loading data lib
        require_once(self::get_base_path() . "/data.php");
    
        //loading upgrade lib
        if(!class_exists("RGPayPalUpgrade"))
            require_once("plugin-upgrade.php");
    
        //runs the setup when version changes
        self::setup();
    
    }

    This seems to fix the issue....

    Posted 11 years ago on Tuesday February 5, 2013 | Permalink
  9. I'll send your comments to David to see if he has anything to add.

    Posted 11 years ago on Tuesday February 5, 2013 | Permalink
  10. @pronamic,
    Thanks for the heads up and for all the troubleshooting. Your change makes sense and will be included in the next PayPal Add-On release.

    Posted 11 years ago on Wednesday February 6, 2013 | Permalink

This topic has been resolved and has been closed to new replies.