Support

Home Forums Event Espresso Premium Multiple Ticket Price display defaults…

Multiple Ticket Price display defaults…

Posted: June 20, 2013 at 3:10 pm

Viewing 8 reply threads


jungcenter

June 20, 2013 at 3:10 pm

1) So it seems that when there are multiple ticket prices for an event that the registration page “choose an option” dropdown defaults to the FIRST price entered. However, the event list page “price” defaults to the LAST price entered. So there is currently no way to get both to default to the same price? Will this be addressed in a future software upgrade?

2) Rather than default to either price on the registration page “choose an option” dropdown, would it be possible to customize the default text to something like “–select one–” ? We are having a problem with customers not selecting the correct price. That’s a user error, of course, but it could be minimized with the “–select one–” text in place.


Josh

  • Support Staff

June 20, 2013 at 4:11 pm

Hi there,

With question #1, you can make a small edit to the event_list_display.php template to force it to display the first price entered.

In event_list_display.php you can replace:

<?php echo  $org_options['currency_symbol'].$event->event_cost; ?>

with

<?php echo  $org_options['currency_symbol'].do_shortcode('[EVENT_PRICE event_id="'.$event_id.'" number="0"]'); ?>

The number=0 in the shortcode will grab first price choice and display it in the event list, you can adjust this to display the 2nd price by replacing the 0 with a 1.

With question #2, you can change the wording of any text string by using the WordPress gettext filter. There’s some sample code you can adapt and use in your custom functions file that’s posted in this gist:

https://gist.github.com/joshfeck/4962940


jungcenter

June 20, 2013 at 10:05 pm

Thanks for your response.

I was able to implement your solution to question #1, and it seems to work. I do think it would be useful to add an option to the backend interface on this for future releases.

On question 2,after looking at the link, I am not clear exactly what code to change where to add a default message to the dropdown. Can you break it down any more specifically?

Thank you.


Josh

  • Support Staff

June 21, 2013 at 10:20 am

If you look at the above linked gist on lines 6 and 7 there are two examples of text strings being changed. One is ‘Register’, which gets changed to ‘Sign up’. The other is ‘Confirm and go to payment page’ which gets changed to ‘Complete registration’.

For your use case, you can remove those two lines and replace with:

'Choose an Option: ' => '-select one-',


jungcenter

June 21, 2013 at 11:01 am

Okay, I think maybe I wasn’t clear. I don’t want to change the text that appears to the left of the price dropdown. Rather, I would like to insert a default value INTO the dropdown so the customer must choose a ticket price, rather than there being a default price selected as it is now. Does that make sense?


Dean

June 24, 2013 at 5:24 am

Without editing core files and rewriting some of the functions used, the only way to add a Please Select option to the dropdown menu would be with jQuery.

This would get you started but you would need more, as for example this doesnt stop the user from just perssing the button and going forward (the first ticket type is used)

jQuery("select[name='price_option']").prepend('<option value=1>My option</option>');
jQuery("select[name='price_option']").val('My option');


Josh

  • Support Staff

June 24, 2013 at 1:29 pm

I think if you add a default option value alone you’ll still have the problem of customers not choosing a price. They’ll end up choosing the non-price which will cause problems as well.

Instead of adding a selectable option that does not have a price where people can still ignore it and end up not selecting a price option, you could add a required class to the Select input and a blank option by default. This way if someone tries to submit the registration form without selecting a price, they’ll get a message in red text that will tell them they need to select something for that field.

Here’s some example code:

<script>
// add a blank option to the selectbox that will display by default, but cannot be selected
jQuery(".valid").prepend("<option value='' selected='selected' disabled></option>");
// make the select box a required input
jQuery(".valid").addClass("required");
</script>


jungcenter

June 24, 2013 at 3:19 pm

I am willing to try Josh’s solution. Can you tell me which file would need that script added?


Josh

  • Support Staff

June 24, 2013 at 4:02 pm

It could be added just about anywhere that code runs for the registration page. For example, if you wanted to hack it to the end of the registration_display_page.php template located in the /templates directory you could add this to the bottom of the file:

<script>
jQuery(document).ready(function($) {
	$("select[name='price_option']").prepend("<option value='' selected='selected' disabled></option>");
	$("select[name='price_option']").addClass('required');
});
</script>

If you wanted to add it into the /scripts/validation.js script since you’re tying into the form’s validation, you could add a few lines to what’s already there so the entire file would then look like:

$jaer = jQuery.noConflict();
	jQuery(document).ready(function($jaer) {
	jQuery(function(){
		//Registration form validation
		jQuery('#registration_form').validate();
		$jaer("select[name='price_option']").prepend("<option value='' selected='selected' disabled></option>");
		$jaer("select[name='price_option']").addClass('required');
	});
});
Viewing 8 reply threads

The support post ‘Multiple Ticket Price display defaults…’ 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.

Event Espresso