Posted: May 16, 2019 at 9:17 am
|
Hello, For all our events, we have 2 types of tickets: The strange thing is for some events (not all), the member price shows in the pricing table even when browsing at incognito window. E.g.: https://zurich.swissphotoclub.com/en/courses/beginners-intensive-photography-course/ Normal price 390, member price 331.5 When the user enters the event, then the user sees the correct price 390. I’m assuming something is wrong with the tableview code, so I copy pasted it here: **Removed **
|
|
sorry for the long code, here you can see it on github: |
Hi there, I’ve removed the code from your opening post as its much easier to read on the gist, so no need for both. The reason your getting different ticket prices is this code:
Pulls all of the tickets from the event and then you use the ‘first’ ticket from the array, but that won’t necessarily be the ticket you want. IIRC the ticket will be pulled based on the ticket ID ordered ASC. EE doesn’t include a price in the table by default, so this is custom and not something we can support, but I can point you in the direction I would go. When you pull Side note, anywhere you have this:
Will be using a fair amount of resources as the second condition is recalulating if the sold values have changed, you can generally swap that out for:
Which will reduce the load on the server when loading that page. |
|
|
Hi Tony, For the pricing question, would it be possible for you to suggest the code to replace? The ticket should be easily identifiable – the one that doesn’t have any wp-user capability condition or the one without a discount. Thank you for the tip for the server, it’s indeed very slow loading. However when I did swap the code with yours, it broke the site: The site is experiencing technical difficulties. Any idea why? Thanks a lot in advance. |
Yeah, my apologies, its my bad. This:
Needs to be:
I missed removing the additional bracket.
That sounds like 2 conditions? The second isn’t as easy to detemine as the first. Using a ticket that doesn’t have a capability set on it:
The loops over the tickets and the first it find that does not have a capability set on it will be the ticket the template uses, put that in place of:
|
|
|
Hi Tony, for the server code – it worked, thank you. For the ticket code, didn’t work, I got N/A or empty prices for all events? |
Not my day today! Please try again with the code above (I’ve updated the post) |
|
|
it worked perfectly now, thank you Tony 🙂 |
The support post ‘Member prices for some events in the pricing table’ 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.