Events is Hijacking product

Home Forums Ticket Products Event Tickets Plus Events is Hijacking product

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #1111848
    Philip Macaulay
    Participant

    Before I updated to Events Ticket Plus I was obviously using Wootickets – Now that I have installed Events Ticket Plus I seem to have a problem that existed previously when Events was Hijacking a Product/Ticket. I have a website that sells individual tickets for small events – one click BUY TICKET – quantities etc.. removed. I require that the BUT TICKET redirects to a gravity form so that more information can be supplied before going to the cart.

    I had this code in my functions.php and it worked fine previously with wootickets what do I need to do to prevent the Events software hijacking the ticket/product now???


    add_action( 'init', 'wootix_no_hijack' );

    function wootix_no_hijack() {
    if ( ! class_exists( 'TribeWooTickets' ) ) return;
    remove_filter( 'post_type_link', array( TribeWooTickets::get_instance(), 'hijack_ticket_link' ), 10, 4 );
    }

    #1111889
    George
    Participant

    Hey @Philmacaulay,

    Thanks for reaching out. Our “no_hijack” code does not necessarily support the Gravity Forms step that you mention here:

    I require that the BUT TICKET redirects to a gravity form so that more information can be supplied before going to the cart.

    So this may require additional tinkering on your end for that; but for the basic reworking of the snippet you posted here so that it will work with Event Tickets Plus, try replacing the wootix_no_hijack() function so that it looks like this:


    function wootix_no_hijack() {

    if ( ! class_exists( 'Tribe__Tickets_Plus__Commerce__WooCommerce__Main' ) )
    return;

    remove_filter( 'post_type_link', array( Tribe__Tickets_Plus__Commerce__WooCommerce__Main::get_instance(), 'hijack_ticket_link' ), 10, 4 );
    }

    Cheers,
    George

    #1111895
    Philip Macaulay
    Participant

    Thanks for getting back to me George.

    To be honest I haven’t had to deal with any serious issues before until the upgrade. In fact – I had forgotten a lot about the process as I had quite a few functions in my functions.php and it seems only one specific one was causing a problem, which I removed – OK that’s by and by.

    But here’s the single biggest issue for me. I need to use Gravity forms, so I effectively need to go to the woocommerce product page, but after the update all my products/tickets are /events/aticket/ instead of /product/aticket/ which they were previously and I assumed it was that the wootix_no_hijack() function that remedied this???
    I’m not sure if your code will do the trick, but I have left it there for now.

    This is the simple tickets.php I was using previously in my child theme, which worked perfectly before upgrade:

    <?php
    $count = 0;
    echo '<div class="ticketregister"><ul>';
    
    foreach ( $tickets as $ticket ) {
    	if ( class_exists( 'WC_Product_Simple' ) ) $product = new WC_Product_Simple( $ticket->ID );
    	else $product = new WC_Product( $ticket->ID );
    
    	if ( ! $product->is_in_stock() ) continue;
    	$count++;
    	
    	$price = $product->get_price_html();
    	$link = '<div class="registerevent"><a href="' . $product->get_permalink() . '">Register for Course</a></div>';
    	echo "<li class='ticketavailable'> $ticket->name  $price $link <em> $ticket->description </em> </li>";
    	echo "<li class='tickets_stock'>";
    echo $ticket->stock . ' places available';
    echo '</li>';
    }
    
    if ( 0 === $count )
    	echo '<li class="sorry">This course is fully booked!</li>';
    
    echo '</ul>';
    

    Can you see an issue with this?

    Really appreciate any help you can give me on this…. I have another 4 sites running the old setup and I will need to resolve this to fix all the others.

    #1111900
    George
    Participant

    Hey @philmacaulay,

    Thank you for the follow-up.

    The “No hijack” code would not, on its own, alter the URLs in that way. I reviewed the code you posted briefly but did not spot any outright errors. There is unfortunately little we can do to assist with your custom Gravity Forms/WooCommerce integrating with tickets purchases, because we cannot help with custom coding and modifications.

    I am sorry about the limitations arising from this and am happy to try and answer any other questions you might have. I would recommend reading this page so that you can know what to expect in terms of depth of assistance with customization-related questions, but am happy to at least try and help within the limits elaborated upon here → https://theeventscalendar.com/knowledgebase/what-support-is-provided-for-license-holders/

    I did not spot a problem with the code you’ve posted thus far.

    Thank you,
    George

    #1111905
    Philip Macaulay
    Participant

    I hear what you are saying George, but I have had help over previous years, I have just spent over $100 updating my licenses and I am not expecting very much from you guys just that you help me to restore the fuctionality I had previously with your software – with code snippets supplied by you guys – it is not an issue of integrating your software with a third party software just that the event page point to the product page – it is difficult for me to understand how to fix this issue – is it really that difficult to resolve. All I need is to stop Event Tickets from hijacking the product URL.

    Your no-hijack code does not seem to function like the old version did. As you guys provided this code previously I think it only fair that you at least provide the same working functionality this time around.

    Can someone else help me with this? Or are you saying that’s it from support.

    #1111914
    Philip Macaulay
    Participant

    So thanks for NOT GETTING BACK TO ME GEORGE!
    You clearly don’t know much about the product you’re providing support for do you?? – do you know that this page even exists ? With a link to the actual anti-hijacking code??? ::

    Sell Tickets From the WooCommerce Products Page

    The clue is in the page title…! Had you known that the page existed and included exactly what I needed I could have saved a great deal of time and you could have provided me with the correct code or pointed me to said page.

    Sometimes it is very hard to find answers to problems on this site as you can end up reading through a lot of stuff that is not relevant to your specific problem – not a direct criticism, as I understand there are multiple layers of complexity in this software, but you would expect someone providing support to have more in-depth knowledge of the product they are supporting – rather than simply saying, you can’t help any further and assuming my request was customization-related – which it was not.

    I have fixed the problem without your help, although had you been a bit more knowledgeable I would have got there a lot sooner! Have a nice weekend!

    #1111929
    George
    Participant

    Our no-hijack code is a snippet we share to try and help folks; it only relates to the functioning of the checkout process that lets you skip over the WooCommerce product page right to the cart.

    To alter this behavior, and add other pages in between that process, like stopping at a Gravity Form along the way instead, this is a customization and, like all customizations, one you have to shoulder the responsibility of implementing and maintaining over time as other code changes.

    I have tested the no-hijack snippet and it works fine for me in the same way the older version did.

    I’m glad you’ve resolved the issue.

    Best of luck with your site,
    George

Viewing 7 posts - 1 through 7 (of 7 total)
  • The topic ‘Events is Hijacking product’ is closed to new replies.