Support » Plugin: Event Tickets » Event Calendar and Tickets JS conflict with WooCommerce

  • Merv

    (@mervforneyerolscom)



    After the last Tribe updates to Calendar and Tickets (free) there is a javascript conflict with Woocommnerce. The javascript error in admin when attempting to edit Woocommerce memberships or subscriptions is:

    Error: Option ‘ajax’ is not allowed for Select2 when attached to a <select> element.

    When I disable Calendar and Tickets, the error goes away. Screenshots here:
    https://drive.google.com/open?id=0B_PI5RZVOe0QSW96NXZzQ0hZSDg

    Why is tribe js being loaded when accessing woo admin functions?
    Is there a quick fix for this problem?

    All WordPress and plugins are up to date.

    Thanks in advance for your quick attention.
    Merv

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi @merv

    I spent about 6-7 hrs on trying to figures this out.

    Here is a quick fix

    find wp-plugins\event-tickets\common\vendor\select2\select2.js”
    line 928
    change
    $.each([“id”, “multiple”, “ajax”, “query”, “createSearchChoice”, “initSelection”, “data”,

    to
    $.each([“id”, “multiple”, “query”, “createSearchChoice”, “initSelection”, “data”,

    if your site is using select2.min.js just rename it to something else like select2.min.js78943

    Hope that helps

    Merv

    (@mervforneyerolscom)

    Here is what I found in wp-plugins\event-tickets\common\vendor\select2\select2.js starting at line 1834 (not 928):

    if ( select ) {
        // these options are not allowed when attached to a select because they are picked up off the element itself
        $.each( [ "id", "multiple", "ajax", "query", "createSearchChoice", "initSelection", "data", "tags" ], function () {
            if ( this in opts ) {
            throw new Error( "Option '" + this + "' is not allowed for Select2 when attached to a <select> element." );
            }
        } );
    }

    Also, your suggestion needs to be in select2.min.js.

    Taking ajax out of select2.min.js removed the error but the admin membership select fields were disabled. Therefore, Woo is somehow getting to event-tickets select2.

    I dumped the source of the admin page in question and found these references to select2:

    IN THE HEADER

    <link rel='stylesheet' id='custom-select2-css-css'  href='http://sellwithsoul.com/wp-content/themes/howes/inc/custom-select2/custom-select2.css?ver=1510658863' type='text/css' media='all' />
    
    <script type='text/javascript'>
    /* <![CDATA[ */
    var wc_memberships_admin = {"ajax_url":"http:\/\/sellwithsoul.com\/wp-admin\/admin-ajax.php","new_membership_url":"http:\/\/sellwithsoul.com\/wp-admin\/post-new.php?post_type=wc_user_membership","select2_version":"4.0.3","search_products_nonce":"970c8f35d0","search_posts_nonce":"95e2f0a885","search_terms_nonce":"9ccc486ef8","wc_plugin_url":"http:\/\/sellwithsoul.com\/wp-content\/plugins\/woocommerce","calendar_image":"http:\/\/sellwithsoul.com\/wp-content\/plugins\/woocommerce\/assets\/images\/calendar.png","user_membership_url":"http:\/\/sellwithsoul.com\/wp-admin\/edit.php?post_type=wc_user_membership","new_user_membership_url":"http:\/\/sellwithsoul.com\/wp-admin\/post-new.php?post_type=wc_user_membership","get_membership_date_nonce":"c2f94b400e","search_customers_nonce":"acfab841c7","add_user_membership_note_nonce":"3970e822b5","create_user_for_membership_nonce":"13b8033667","transfer_user_membership_nonce":"9b9d129b34","delete_user_membership_note_nonce":"288dd47909","delete_user_membership_subscription_nonce":"84facb7f07","restrictable_post_types":["post","page","product","portfolio","team_member","testimonial","client","tribe_events","tribe-ea-record","slide"],"i18n":{"delete_membership_confirm":"Are you sure that you want to permanently delete this membership?","delete_memberships_confirm":"Are you sure that you want to permanently delete these memberships?","please_select_user":"Please select a user."}};
    /* ]]> */
    </script>
    
    <script type='text/javascript' src='http://sellwithsoul.com/wp-content/plugins/woocommerce/assets/js/select2/select2.full.min.js?ver=4.0.3'></script>

    IN THE FOOTER

    <script type='text/javascript' src='http://sellwithsoul.com/wp-content/plugins/event-tickets/common/vendor/tribe-select2/select2.min.js?ver=4.7'>
    
    <script type='text/javascript' src='http://sellwithsoul.com/wp-content/themes/howes/inc/custom-select2/custom-select2.js?ver=1510658863'></script>

    I don’t see name conflicts. Do you?

    Thanks for your help.
    Merv

    Merv

    (@mervforneyerolscom)

    An added note:
    1. The Events Calendar also has select2 in common/vendor/tribe-select2 but is not getting loaded in my woo membership admin

    2. Is the solution to restrict when event-tickets enqueues JS. Don’t need it when the free version isn’t using ticket sales.

    Merv

    Merv

    (@mervforneyerolscom)

    Update ….
    I just determined event-tickets select2.js is impacting many WooCommerce admin functions using js. The latest is Products. Click to show hide admin functions do not work anywhere on a product edit page.

    Disabling event-tickets select2.js brings Woo admin back to life.

    When was select2.js added to the plugin? What is latest version that does not have it. I need to roll back to get my client site Woo admin working again!!

    HELP!!
    Merv

    Plugin Contributor patriciahillebrandt

    (@patriciahillebrandt)

    Hey @mervforneyerolscom,

    Thank you for reaching out to us!

    I hope you’re having a good week/day. Firstly, I’d like to apologize for the delay in response. Thank you for your patience all this while!

    Unfortunately, this is a known issue with the select2 library that causes conflicts with some plugins that also use it (including WooCommerce). The good news is we released a fix for this issue last week: please update The Events Calendar to version 4.6.5 and let us know if everything works as expected after that!

    Thanks for your understanding and patience and if you have any other questions, please let me know and I’ll be happy to assist!

    Best Regards,

    Patricia

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Event Calendar and Tickets JS conflict with WooCommerce’ is closed to new replies.