Posted: February 14, 2022 at 5:23 pm
Hi there! |
|
Hi there, You can’t delete a ticket if it has registrations assigned to it as you’ll break the relationship, however what you can do is delete the registrations assigned to it and then remove the archived ticket. Your archived ticket shows 1 registration assigned to it, what is that registration?
Can you not just adjust the code to not pull in archived tickets? |
|
Hi Tony! So, we had removed that registration and moved it to the new price. Is there another way we can delete this registration if we have moved it? Is it holding itself in the system because it was a registration to that price at some point? I can speak to our developer about adjusting the code as well. |
|
Hi Tony, Here is how we are getting the ticket price, how do you recommend we get the price to avoid this in the future. if ( $post->EE_Event instanceof EE_Event ) { $ticket_array = $post->EE_Event->first_datetime()->tickets(); $first_ticket = array_shift($ticket_array); $ticket_price = $first_ticket->pretty_price(); } else { $ticket_price = ""; } |
|
Moved it with the Attendee mover add-on?
You’re removing data here so we always recommend creating a database backup first just in case you need it. Depends where it’s from, you can usually delete them if you find them in Event Espresso -> Registrations. Then hover over the registration and click Trash link that appears. Then go to the ‘Trash’ filter: https://monosnap.com/file/K98iZ9dET3aTJh9H4iAYsgvLeXuz6w Hover over the registration and click Delete to perm delete. That should remove it.
The registration won’t really ‘hold a space’, it’s showing as a registration because it is liked that ticket. When a registration is created it stores the ID of the EE_Contact and the ID of Ticket it is linked to, it does NOT store the price of the registration at the time. That means that if you were to change the price on a specific ticket it would change the price of ANY registration links to that ticket, not just new registrations. So, when a Ticket has registrations linked to it, Event Espresso will not let you change the price of the ticket, when it detects a price change it archives the original ticket and created a duplicate with the new price. Meaning registrations linked to the ‘old’ ticket still show the original price, new registrations get the new price and so on. You can’t then just delete the archived ticket as you’ll break the relationship to the old registrations and get fatal errors when it tries to pull the ticket it is related to but if you remove the regs first, then you can delete that ticket.
You could do with battle hardening your code there, check you have an instance of the objects you’re expecting before you use them. As for the change needed, your using our models, so you can pass the query params to the method call, so this:
With an additional where condition so it doesn’t pull deleted/archive tickets, becomes:
You could also add
|
|
The support post ‘Price Locked on old price’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.