Support

Home Forums Event Espresso Premium EE4 – Prices to a ticket

EE4 – Prices to a ticket

Posted: August 16, 2016 at 4:01 pm

Viewing 5 reply threads


JacquesMivi

August 16, 2016 at 4:01 pm

Hello,

I’m not sure to understand the price system of EE.
You can have multiple price for a ticket, that right ? At each new ticket you create a default price, right ? And you have to associate a type price at each ticket ?

I try to implement an easy front-end form for user to manage their tickets.
For this easy form, should I create a price for each new ticket, and associate it type price 1 (its the base price, right) ?

For information when I check on my database, the “esp_price” table is not updated when I delet an event.

Thanks for your help, if you have documenation I take it.


Josh

  • Support Staff

August 17, 2016 at 2:39 pm

You can have multiple price for a ticket, that right ?

No, one price per ticket, but a ticket can have price modifiers. In the end though, it’s one totaled price per ticket.

At each new ticket you create a default price, right ?

No.

And you have to associate a type price at each ticket ?

Yes.

Your way forward in your endeavor to build a front-end ticket price editor will be to study the code that’s used to make the back-end ticket editor.


JacquesMivi

August 18, 2016 at 1:42 am

One yes for two no, I progress ! Thanks for your answer.

Your way forward in your endeavor to build a front-end ticket price editor will be to study the code that’s used to make the back-end ticket editor.

Yes exactly, I study your core-code to associate the price to a ticket. And I have generated this following code, I want to use it for each new ticket, but its seems wrong now, if I understand your answer ?

function vivi_add_prices_to_ticket($prices, EE_Ticket $ticket, $new_prices = FALSE) {

//Variables utilisées
$EVT_ID = $_POST[‘EVT_ID’];
$TKT_ID = $_POST[‘$TKT_ID’];
$PRC_ID = 0; // Create new default price
$PRT_ID = 1; // (1,’Base Price’,1,0,0,1,0)
$PRC_amount = $prices;
$PRC_name = $_POST[‘TKT_name’];
$PRC_desc = ”;

$PRC_values = array(
‘PRC_ID’ => $PRC_ID,
‘PRT_ID’ => $PRT_ID = 1,
‘PRC_amount’ => !empty($PRC_amount) ? $PRC_amount : 0,
‘PRC_name’ => !empty($PRC_name) ? $PRC_name : ”,
‘PRC_desc’ => !empty($PRC_desc) ? $PRC_desc : ”,
‘PRC_is_default’ => 0 //make sure prices are NOT set as default from this context
//’PRC_order’ => $row
);

// Viviarto – On crée un nouveau prix pour chaque ticket
$PRC_values[‘PRC_ID’] = 0;
$PRC = EE_Registry::instance()->load_class(‘Price’, array($PRC_values), FALSE, FALSE);
$PRC->save();

$ticket->_add_relation_to($PRC, ‘Price’);
return $ticket;
}


Josh

  • Support Staff

August 18, 2016 at 9:08 am

Hi there,

I should let you know that the support forums are not intended to be used for code reviews. It will be best if you can team up with another PHP developer, preferably one that has a strong background in OOP, that can help you with your code reviews.


JacquesMivi

August 18, 2016 at 9:32 am

Hi,

if you have documenations I take it.

I d’ont have find good documentations to understand the way that EE4 manage ticket, datetimes, prices, price type. So that explain why I open this post, then my code.

It will be best if you can team up with another PHP developer, preferably one that has a strong background in OOP, that can help you with your code reviews.

I wish ! I have contacted your list available on : https://eventespresso.com/developers/event-espresso-pros/
But I don’t have lot of news. If you have others contacts, especially “strong background in OOP” I will be glad to contact them.


Josh

  • Support Staff

August 18, 2016 at 9:55 am

The best place for developer-centric documentation is the code itself. The development team has worked very hard to make sure that Event Espresso’s classes and methods are well-documented with PHP DocBlocks as well as inline. There are also development-specific documentation articles posted here:
https://github.com/eventespresso/event-espresso-core/tree/master/docs

Viewing 5 reply threads

The support post ‘EE4 – Prices to a ticket’ 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