How to modify product template for "tickets"

Home Forums Ticket Products Event Tickets Plus How to modify product template for "tickets"

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #735473
    Motorco
    Participant

    My question is, given that 90% of my tickets are the same and in cases like this where 100% of them will need to be “edit[ed] in WooCommerce” to have that “virtual” box unchecked, can you provide a cheat sheet on how to modify the defaults for tickets? The only thing that changes per event is the date and the ticket price. I also have items like Memberships and Parking Pass that I need to add and those will be “stock” products. They are essentially “tickets”, but I want different characteristics from the actual tickets (such as no handling fee, different price, different quantity available) So I’d like to be able to just add them from a drop down.
    I’m sure I could dig around and kluge this myself, but I’m guessing someone over at Tribe could divulge some details that would save me and others some time. Thanks!

    As an aside, I *really* do not understand why threads get closed. There was another thread with similar info and now I’m starting a new one, but that other info is relevant and it would be much more useful to keep it all together
    https://theeventscalendar.com/support/forums/topic/handling-fee-not-being-added-to-wootickets-purchase/

    #735602
    Brian
    Keymaster

    Hi Mike,

    I can help you out with your customizations and get you going to the next step.

    Unfortunately, we do not have a ‘cheat sheet’ to give you.

    I can tell you the process that creates the tickets is the ‘save_ticket’ function in wootickets/classes/class-wootickets.php on line 320 (in 3.7)

    That shows what fields we create, you could then hook into the ‘save_post’ hook and make changes to the meta fields or add your own defaults.

    Does that work?

    As for closing the tickets, we close topics as our system does not always pick up when new posts are made to older topics and we do not want to miss anyone’s post. Also, we encourage everyone to keep posts to single topics and leaving them open may lead to many different questions being asked that although related are separate questions that we can better handle in individual topics.

    #744020
    Motorco
    Participant

    Okay, So I’m slogging along. I managed to get things modified, but I’m running into some very strange and difficult to debug problems. I hit a point where the ajax callback isn’t returning correctly. So for instance, when you hit “Add Ticket” or any of the soft links (edit, delete), the db gets modified, the scroll up happens (bc that’s after the complete), but the UI doesn’t change. So if you’re adding a ticket, it looks like nothing happened (except the snapping of the scroll) and if you’re editing an existing ticket, nothing happens at all. But if you refresh the page (or update the event post), the changes are there (new ticket is there, or deleted ticket is gone – obviously nothing happens w/ Edit since there’s no UI). So something is getting caught somewhere in the ajax “action” sequence. No amount of tracing with console or error log is cluing me in. The callback inline function (param to $post) is simply not getting called.

    Weirder still, I have 2 setups, production and staging, totally separate, w/ separate DBs. Since it was all just so strange, I added some debug logging to production (which doesn’t have any code changes) so I could compare. Somewhere along the way I started seeing the same problem – “Add Ticket” adds a ticket to the DB, but the UI just pops back – still in the adding ticket mode. So I obliterated all my changes – just reverted to the downloaded binaries for wootickets, events-calendar-pro and the-events-calendar. But it’s still broken?!? Oh yes I did refresh, clear cache, use incognito and try a different browser. Any ideas?

    #744042
    Motorco
    Participant

    Just to add a bit more detail, in ticket.js, if I add this:
    /* “Edit Ticket” link action */
    $(‘#tribetickets’)
    .on(‘click’, ‘.ticket_edit’, function (e) {
    console.log(‘gonna try to edit ticket’);
    e.preventDefault();
    $(‘h4.ticket_form_title_edit’).show();
    $(‘h4.ticket_form_title_add’).hide();
    tickets_start_spin();

    var params = {
    action: ‘tribe-ticket-edit-‘ + $(this).attr(“attr-provider”),
    post_ID: $(‘#post_ID’).val(),
    ticket_id: $(this).attr(“attr-ticket-id”),
    nonce: TribeTickets.edit_ticket_nonce
    };
    console.log(‘params ‘ + params.ticket_id);
    $.post(
    ajaxurl,
    params,
    function (response) {
    console.log(‘editing ticket’);

    I can see the 1st 2 console log prints. But the one under “function (response) {” never gets printed. This is true of *ALL* of the call backs in that file (delete, add). That call back is just not getting called and I can’t figure out why.

    #744083
    Motorco
    Participant

    Ok – when I add error handlers to the callback I get
    error: parsererror text: SyntaxError: Unexpected token <
    This is for all of the callbacks (add, edit, delete). The only place I see the “<” is in the returned markup. But if I comment out those calls, I still see the same error. I’m stuck.

    #744094
    Motorco
    Participant

    Ok. This is semi-embarrassing, but my plight could help others. The problem was that I had WP_DEBUG set to true and therefore I was getting lots of enqueue errors from one of my plugins. It’s on my list to figure out which is the culprit. But it turns out that for some reason that error gets bundled up with the AJAX response and *that* is what was breaking. everything.

    #744629
    Brian
    Keymaster

    Hello Mike,

    Thanks for sharing the coding you added and the problem with having WP-DEBUG on…I think we have all done that in development 🙂

    From what I understand you have it working, correct? Would you like anymore help on this from us? Let me know.

    Thanks

    #932680
    Brian
    Keymaster

    Since I haven’t heard back from you here, I’m going to go ahead and close out this thread. Feel free to start a new thread if you have further issues. Thanks! 🙂

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘How to modify product template for "tickets"’ is closed to new replies.