Support

Home Forums Event Espresso Premium Remove Prices from Drop Down

Remove Prices from Drop Down

Posted: July 8, 2013 at 12:33 pm


Kimber

July 8, 2013 at 12:33 pm

Hello. I am trying to remove the prices from the dropdown menu on the registration page. http://thestarawards.com/register/wp-content/uploads/2013/07/espresso-issue.png

I want to remove the price but keep the text that is in front of the price.

Also any way to expand that drop down box to make everything appear on one line correctly?


Sidney Harrell

July 8, 2013 at 5:50 pm

What you want to do is this:
1. copy the files registration_page.php and registration_page_display.php from plugins/event-espresso/templates to uploads/espresso/templates
2. open the file includes/functions/pricing.php and copy the function event_espresso_price_dropdown from line 366 to 450.
3. paste the function that you copied into the end of the file registration_page.php that you copied into uploads/espresso/templates
4. change the name of the function to “my_custom_price_dropdown” and add the following line as the first line in the function:

remove_action('espresso_price_select', 'event_espresso_price_dropdown', 20, 2);

5. then add this line at the bottom of the file, right after the end of your new function:

add_action('espresso_price_select', 'my_custom_price_dropdown', 10, 2);

6. now you are free to customize the dropdown. I believe the line you are looking for is this one:

$html .= '<option' . $selected . ' value="' . $result->id . '|' . stripslashes_deep($result->price_type) . '">' . stripslashes_deep($result->price_type) . ' (' . $org_options['currency_symbol'] . number_format($result->event_cost, 2) . $message . ') ' . $surcharge . ' </option>';

and you’ll want to change it to:

$html .= '<option' . $selected . ' value="' . $result->id . '|' . stripslashes_deep($result->price_type) . '">' . stripslashes_deep($result->price_type) . ' </option>';


Kimber

July 9, 2013 at 7:51 am

Hi Sidney,

Thanks for this. I’ve done all the steps however I am still getting prices in the drop down menus. http://thestarawards.com/register/?ee=2


Josh

  • Support Staff

July 9, 2013 at 9:17 am

You could try a slightly simpler approach and copy the entire event_espresso_price_dropdown function to the end of your custom registration_page.php template (skipping steps 4&5). It’s a pluggable function so you can get away with just copying it and it seems to run fine without changing the name and adding/removing the actions.

screenshot of modified price dropdown where the price display is removed

As an aside, you will need to either enter a reCaptcha API key or disable reCaptcha or the registration page will continue to be broken for logged out visitors.


Kimber

July 9, 2013 at 9:49 am

Thanks Josh.

I did that and it seems to have made my entire drop down menu disappear. Any ideas? Here’s my code: http://thestarawards.com/register/wp-content/uploads/2013/07/registration_page.txt

The real file is php but in order to link it, I had to copy it to a txt file.

Thanks again guys!


Josh

  • Support Staff

July 9, 2013 at 10:16 am

I checked and what was copied over is missing the opening:

if (!function_exists('event_espresso_price_dropdown')) {

and the closing:

    add_action('espresso_price_select', 'event_espresso_price_dropdown', 20, 2);
}


Kimber

July 9, 2013 at 12:07 pm

That worked! Thanks for your help!


Josh

  • Support Staff

July 9, 2013 at 1:22 pm

You’re welcome. One thing to keep in mind is if the function that you’re overriding gets an update in a future release you will likely need to make the same update to your custom function so that it continues to work as expected. A good way to do that is use something like prettydiff.com and run a comparison between your custom function and the version of the same function that ships in future versions of Event Espresso.

The support post ‘Remove Prices from Drop Down’ 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