Support

Home Forums Event Espresso Premium Add price as separate column in the Events table view?

Add price as separate column in the Events table view?

Posted: March 27, 2015 at 12:41 pm


Lorenzo


Oguzhan Altun

March 27, 2015 at 12:41 pm

Hello,
Is there a possibility to add price as a separate column in the events table view?
Regards,
Oguzhan


Dean

March 30, 2015 at 1:09 am

Hi,

Yes it is, but you will need to create a custom template for it. The documentation (https://eventespresso.com/wiki/events-table-view-template-add-on/) discusses a parameter called template_file where you can link to a new custom template. You can use either of the two templates bundled with the addon as a basis for your own.


Oguzhan Altun

March 30, 2015 at 3:03 am

Hello,
Yes I’ve been working on this template quite a lot over the weekend. I know HTML to manipulate the table, but I don’t know PHP. Would it be possible to provide the PHP code to add to display the price?
Regards


Lorenzo Orlando Caum

  • Support Staff

March 31, 2015 at 2:40 pm

Hi Ozguzhan, please take a look at this tutorial:

https://gist.github.com/lorenzocaum/ef6afefd07c9c5f6f681

Let us know if you are able to get it working.


Lorenzo


Oguzhan Altun

March 31, 2015 at 2:54 pm

Hi Lorenzo,
Managed to add the price, but the currency symbol repeats two times:
http://www.genevaphotoclub.com/dates-prices/
I like the superscript light version, how do I get rid of the first “CHF” sign?


Lorenzo Orlando Caum

  • Support Staff

March 31, 2015 at 3:09 pm

Hi, try removing it with CSS:

.espresso-table-row .currency-code {display:none;}


Lorenzo


Oguzhan Altun

March 31, 2015 at 3:16 pm

it worked, but removed the wrong “CHF” :/ If it’s too difficult to fix, it’s ok we can leave it there.


Dean

April 1, 2015 at 5:49 am

You can’t do it with CSS. You could change the pretty_price function in the code to ticket_price instead, but this will give a very basic result – instead of $10.00 (usd) it would show 10, so it would need more code to make it look pretty.

This might work OK:

$ticket_price = $ticket instanceof EE_Ticket ? sprintf("%0.2f",$ticket->ticket_price()) . '<span class="currency-code"> (CHF)</span>' : '';

The above code replaces

$ticket_price = $ticket instanceof EE_Ticket ? $ticket->pretty_price() : '';


Oguzhan Altun

April 1, 2015 at 8:24 am

Hello,
This worked, now I have the CHF in the format I need. However now I have two decimals in price: 99.00 (CHF); even though in the main preferences I should have no decimals. How can I remove the .00 from the price?


Lorenzo Orlando Caum

  • Support Staff

April 1, 2015 at 9:31 am

Hi, try this:

  $tickets_price_free_check = $ticket_price_data_value == 0 ? __('Free','event_espresso') : (float)$ticket_price_data_value . ' (CHF)';

The above should replace the existing $tickets_price_free_check.

Then use this to display the updated function (step 11 here https://gist.github.com/lorenzocaum/ef6afefd07c9c5f6f681):

    


Oguzhan Altun

April 1, 2015 at 10:07 am

Perfect, this worked:) Thanks a lot for your support on this!!

The support post ‘Add price as separate column in the Events table view?’ 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