Support

Home Forums Event Espresso Premium Accessing event tickets from EED_Promotions.module.php

Accessing event tickets from EED_Promotions.module.php

Posted: March 30, 2016 at 10:12 am


Akseli Olavi Ahopelto

March 30, 2016 at 10:12 am

Hello,
Seeing as development for specific ticket promotions hasn’t started yet and is still being voted on (from what I could see on the Trello board), I’m considering implementing a quick-and-easy solution that would work for us temporarily.

We have multiple ticket types for each event (Basic, Basic + Dinner, etc.etc.) and would like the percentage discount to be applied only to the Basic ticket type. Also, ideally, because every ticket includes the Basic ticket, I was thinking of simply using the get_object_line_items_from_cart() function in EED_Promotions.module.php to pick up the first ticket (basic) for the given event and using the price of that ticket to calculate the discount.

If anyone has any quick tips on accessing the ticket array for the given event from the cart and it’s associated price, I would greatly appreciate it.

Obviously, if we manage to work out the solution I’ll be posting it here for others who may be having the same issue!!


Josh

  • Support Staff

March 30, 2016 at 12:24 pm

One way to get the cart’s ticket contents is from the get_cart_from_txn() method that’s declared in the EE_Cart class.


Akseli Olavi Ahopelto

March 30, 2016 at 12:42 pm

Yeah, I figured that out, but it doesn’t really help in our case, as I would like to be able to get a specific ticket associated to the Event.
This ticket wouldn’t necessarily be in the cart at the moment of purchase. Is this possible even possible?


Josh

  • Support Staff

March 30, 2016 at 12:56 pm

You should be able to get the ticket from the cart object there. e.g.

$cart = EE_Cart::get_cart_from_txn($transaction);
if ( $cart instanceof EE_Cart ) {
$tickets = $cart->get_tickets();
}

The support post ‘Accessing event tickets from EED_Promotions.module.php’ 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