本文整理汇总了PHP中EE_Transaction::get_many_related方法的典型用法代码示例。如果您正苦于以下问题:PHP EE_Transaction::get_many_related方法的具体用法?PHP EE_Transaction::get_many_related怎么用?PHP EE_Transaction::get_many_related使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EE_Transaction
的用法示例。
在下文中一共展示了EE_Transaction::get_many_related方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
/**
* generates HTML for the Attendees Transaction main meta box
* @access private
* @return void
*/
function _txn_attendees_meta_box($post, $metabox = array('args' => array()))
{
global $wpdb;
extract($metabox['args']);
// process items in cart
$line_items = $this->_transaction->get_many_related('Line_Item', array(array('LIN_type' => 'line-item')));
$this->_template_args['event_attendees'] = array();
if (!empty($line_items)) {
foreach ($line_items as $item) {
$ticket = $item->ticket();
if (empty($ticket)) {
continue;
}
//right now we're only handling tickets here. Cause its expected that only tickets will have attendees right?
$registrations = $ticket->get_many_related('Registration', array(array('TXN_ID' => $this->_transaction->ID())));
$event = $ticket->get_first_related('Registration')->get_first_related('Event');
foreach ($registrations as $registration) {
$attendee = $registration->get_first_related('Attendee');
$this->_template_args['event_attendees'][$registration->ID()]['att_num'] = $registration->get('REG_count');
$this->_template_args['event_attendees'][$registration->ID()]['event_ticket_name'] = $event->get('EVT_name') . ' - ' . $item->get('LIN_name');
$this->_template_args['event_attendees'][$registration->ID()]['attendee'] = $attendee->full_name();
$this->_template_args['event_attendees'][$registration->ID()]['ticket_price'] = EEH_Template::format_currency($item->get('LIN_unit_price'));
$this->_template_args['event_attendees'][$registration->ID()]['email'] = $attendee->email();
$this->_template_args['event_attendees'][$registration->ID()]['address'] = implode(',<br>', $attendee->full_address_as_array());
$this->_template_args['event_attendees'][$registration->ID()]['att_id'] = $attendee->ID();
}
}
$this->_template_args['transaction_form_url'] = add_query_arg(array('action' => 'edit_transaction', 'process' => 'attendees'), TXN_ADMIN_URL);
$template_path = TXN_TEMPLATE_PATH . 'txn_admin_details_main_meta_box_attendees.template.php';
echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
}
}
示例2: txn_attendees_meta_box
/**
* txn_attendees_meta_box
* generates HTML for the Attendees Transaction main meta box
*
* @access public
* @param WP_Post $post
* @param array $metabox
* @return void
*/
public function txn_attendees_meta_box($post, $metabox = array('args' => array()))
{
extract($metabox['args']);
$this->_template_args['post'] = $post;
$this->_template_args['event_attendees'] = array();
// process items in cart
$line_items = $this->_transaction->get_many_related('Line_Item', array(array('LIN_type' => 'line-item')));
if (!empty($line_items)) {
foreach ($line_items as $item) {
if ($item instanceof EE_Line_Item) {
switch ($item->OBJ_type()) {
case 'Event':
break;
case 'Ticket':
$ticket = $item->ticket();
if (empty($ticket)) {
continue;
//right now we're only handling tickets here. Cause its expected that only tickets will have attendees right?
}
$ticket_price = EEH_Template::format_currency($item->get('LIN_unit_price'));
$event = $ticket->get_first_related('Registration')->get_first_related('Event');
$event_name = $event instanceof EE_Event ? $event->get('EVT_name') . ' - ' . $item->get('LIN_name') : '';
$registrations = $ticket->get_many_related('Registration', array(array('TXN_ID' => $this->_transaction->ID())));
foreach ($registrations as $registration) {
$this->_template_args['event_attendees'][$registration->ID()]['att_num'] = $registration->get('REG_count');
$this->_template_args['event_attendees'][$registration->ID()]['event_ticket_name'] = $event_name;
$this->_template_args['event_attendees'][$registration->ID()]['ticket_price'] = $ticket_price;
// attendee info
$attendee = $registration->get_first_related('Attendee');
if ($attendee instanceof EE_Attendee) {
$this->_template_args['event_attendees'][$registration->ID()]['att_id'] = $attendee->ID();
$this->_template_args['event_attendees'][$registration->ID()]['attendee'] = $attendee->full_name();
$this->_template_args['event_attendees'][$registration->ID()]['email'] = '<a href="mailto:' . $attendee->email() . '?subject=' . $event->get('EVT_name') . __(' Event', 'event_espresso') . '">' . $attendee->email() . '</a>';
$this->_template_args['event_attendees'][$registration->ID()]['address'] = implode(',<br>', $attendee->full_address_as_array());
} else {
$this->_template_args['event_attendees'][$registration->ID()]['att_id'] = '';
$this->_template_args['event_attendees'][$registration->ID()]['attendee'] = '';
$this->_template_args['event_attendees'][$registration->ID()]['email'] = '';
$this->_template_args['event_attendees'][$registration->ID()]['address'] = '';
}
}
break;
}
}
}
$this->_template_args['transaction_form_url'] = add_query_arg(array('action' => 'edit_transaction', 'process' => 'attendees'), TXN_ADMIN_URL);
echo EEH_Template::display_template(TXN_TEMPLATE_PATH . 'txn_admin_details_main_meta_box_attendees.template.php', $this->_template_args, TRUE);
} else {
echo sprintf(__('%1$sFor some reason, there are no attendees registered for this transaction. Likely the registration was abandoned in process.%2$s', 'event_espresso'), '<p class="important-notice">', '</p>');
}
}