Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ticket selection when creating an order in the CP seems to be bugged #182

Open
mihob opened this issue Feb 5, 2025 · 5 comments
Open

Ticket selection when creating an order in the CP seems to be bugged #182

mihob opened this issue Feb 5, 2025 · 5 comments

Comments

@mihob
Copy link

mihob commented Feb 5, 2025

Describe the bug

If I want to create a new order as admin in the CP, the selection of the ticket looks very confused when adding an item.

There are considerably more tickets than there actually are in the system. I have two events with 10 different tickets each. One of these events is in the past. Somehow, however, I have over 40 tickets to choose from. You also can't recognise which ticket belongs to which event. The past event was also created with version 2, and somehow the legacy tickets also seem to be displayed here.

I would expect to be able to select only the tickets for the current event (regardless of whether they are deactivated or sold out)

This is a real problem for us right now, as our admins can't create orders manually.

Steps to reproduce

  1. Try create an order with tickets in the control panel

Craft CMS version

5.6.5.1

Plugin version

3.0.5

Multi-site?

Yes

Additional context

No response

@engram-design
Copy link
Member

So yes, legacy tickets are technically still purchasables, and are kept in the system. This is to not disrupt your previous Commerce orders where these would be otherwise missing and throw an error. That might explain the extra available tickets to pick from?

We're largely at the mercy of Commerce's "Add line item" interface, which loops through all available purchasales and lists them there. I don't believe there's a way to exclude certainly elements from appearing there, or change their look based on being in this list.

The title of the ticket will be identical to what you'd see in an event, but I agree that the event's name should be included. That's actually technically up to you to add, with the "Ticket Title Format" setting - set that to include {event.title}.

As for showing current/future events, that's the default behaviour for craft.events.events() is Twig, but I can look at extending that to the CP. The main concern I have is that there are time you need to be able to pick a previous event, and I don't want to enforce only being able to pick current/upcoming events from the modal-classed element select interface for Events Tickets. I'll probably have to introduce something specific to Commerce's orders, or even introduce a new dropdown filter to select currrent/old events tickets.

@mihob
Copy link
Author

mihob commented Feb 6, 2025

But do you really have to be able to select the legacy tickets there? They are not synchronised with the corresponding new tickets.

Here is my list, two events with 12 ticket types each. The legacy tickets are outlined in red. For some reason they are still available. Event 1 is in the past and is outlined in yellow. Event 2 is the current one and is circled in blue.

Image Image Image Image Image

My confusion probably came from the fact that the pagination is completely wrong, as you can see. The number of tickets is correct if you include the legacy tickets.

I have now changed the ticket title to this format:

Image

But when adding a new line item the title is not updated, everywhere else it is. It always shows the title that was set when the ticket was first generated.

Update:
The description of the associated purchasable is used there, which is never updated.

@engram-design
Copy link
Member

What I meant is that we have no control over the legacy tickets appearing there. They can’t be excluded.

I’ll look at excluding past events, but I can see the need for being able to select past events for new Commerce orders.

@mihob
Copy link
Author

mihob commented Feb 6, 2025

So, I actually achieved everything I wanted by manipulating the query in the EVENT_MODIFY_PURCHASABLES_TABLE_QUERY hook. This means hiding old and legacy tickets.

But I don't have a good solution for the purchasable description. Could you update it when the ticket title changes?

@engram-design
Copy link
Member

I've completely missed that EVENT_MODIFY_PURCHASABLES_TABLE_QUERY event. Still, I'm looking into adding the event information into ticket titles/description so that you've got a bit more context!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants