Set default SKU of all tickets

Home Forums Ticket Products Event Tickets Plus Set default SKU of all tickets

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #1155806
    Frank
    Participant

    Hi,

    I have 260 tickets for all events (5 tickets per events).

    I would like to update SKU (UGS) of every ticket and name it like TITLE_OF_EVENT-START_DATE-START_TIME-TICKET_NAME

    Is anyone have a PHP or SQL snippet to do it? It would save me a LOT of time 😉

    Thanks,
    Frank

    #1156102
    Andras
    Keymaster

    Salut Frank,

    Thanks for reaching out! Let me try to help you with your question.

    What you want to achieve can be done with customization, however we are quite limited in providing support for that, but I can point you in the right direction.

    Please check this thread and the snippet provided at the end.

    Event Ticket Plus tags not goings to Woocommerce

    What this does is, it copies the category of the event to the WooCommerce ticket, if one is created.

    You could adjust this code to your needs to create the ticket SKUs.

    I think you will need these functions as well:

    https://theeventscalendar.com/function/tribe_get_events_title/
    https://theeventscalendar.com/function/tribe_get_start_date/
    https://theeventscalendar.com/function/tribe_get_start_time/

    You can also check WooCommerce documentation how to handle SKU names and where / how they are saved.

    Let me know if this helps or if you have any more questions.

    Cheers,
    Andras

    #1156225
    Frank
    Participant

    Hey Andras,

    Thanks for your message. The snippet you posted could do the trick, but I should review each ticket one by one to update the SKU. As there are 260 tickets, it will be a bit time consuming to me 😉

    Would you have any other functions (PHP or SQL) to update all SKU tickets in one shot?

    Thanks,
    Frank

    #1156285
    Andras
    Keymaster

    Hi Frank,

    Unfortunately I don’t have a handy function like that on hand, sorry. The 260 tickets can indeed be time consuming, however, you just need to re-save the tickets in the event, you don’t need to resave the event (unless you change something there as well).

    I will ask around in the team if someone has a script for that, but that will take a bit of time.

    Cheers,

    Andras

    #1156294
    Frank
    Participant

    Hey Andras,

    I wrote a PHP script which update the sku of all tickets. Use on a WordPress install with only Event Tickets Plus products, otherwise it could throw errors or break database.

    The script is a bit messy (while in while in while) but I don’t have time enough to make it cleaner. I could write a plugin to select which fields to generate the SKU if I would have time.

    https://gist.github.com/frankbergere/fc43602156f9065e895b2064700cfa1f

    Thanks again for your messages, it gave me ideas to release it 🙂

    Have a great day!
    Frank

    #1156335
    Andras
    Keymaster

    I keep my fingers crossed for you, Frank!

    Please let me know how it works out and would be great if you could share the code here. Might help some others with a similar problem.

    I will leave this ticket open so you can do that if you want to share.

    Have a great weekend!

    Cheers,
    Andras

    #1156346
    Frank
    Participant

    Hey Andras,

    The script works. Just put the file on your wp install root folder (same level than wp-config), customize the database parameters et change db_prefix_ by your own prefix and run the script via your browser http://yourdomain.com/event_tickets_plus_update_sku.php

    Have a nice week-end too!
    Frank

    • This reply was modified 9 years, 8 months ago by Frank.
    #1157279
    Andras
    Keymaster

    Hello Frank,

    Thanks a lot or posting this! I think when you changed the domain to yourdomain.com it also broke the link. Could you post the code in GitHub or BitBucket or something similar?

    Thanks,
    Andras

    #1157448
    Frank
    Participant
    #1157790
    Andras
    Keymaster

    That’s awesome Frank, thanks a bunch!

    I am going to close this ticket, but if you need anything else related to this topic or another please post a new topic on the forum and we can help you out.

    Thanks and cheers,
    Andras

Viewing 10 posts - 1 through 10 (of 10 total)
  • The topic ‘Set default SKU of all tickets’ is closed to new replies.