function __construct($id = '', $output = 'OBJECT') { $this->id = $id; $this->output = $output; $this->details = get_post($this->id, $this->output); $tickets = new TC_Orders(); $fields = $tickets->get_order_fields(); foreach ($fields as $field) { if (!isset($this->details->{$field['field_name']})) { $this->details->{$field['field_name']} = get_post_meta($this->id, $field['field_name'], true); } } }
} } } if (isset($_GET['page_num'])) { $page_num = (int) $_GET['page_num']; } else { $page_num = 1; } if (isset($_GET['s'])) { $orderssearch = $_GET['s']; } else { $orderssearch = ''; } $current_status = isset($_GET['post_status']) ? $_GET['post_status'] : 'any'; $wp_orders_search = new TC_Orders_Search($orderssearch, $page_num, '', $current_status); $fields = $orders->get_order_fields(); $columns = $orders->get_columns(); ?> <div class="wrap tc_wrap"> <h2><?php echo $orders->form_title; if (isset($_GET['action']) && $_GET['action'] == 'details') { ?> <a href="edit.php?post_type=tc_events&page=<?php echo $_GET['page']; ?> " class="add-new-h2"><?php _e('Back', 'tc'); ?> </a><?php }
function tc_get_order_details_buyer_custom_fields($order_id) { $orders = new TC_Orders(); $fields = $orders->get_order_fields(); $columns = $orders->get_columns(); $order = new TC_Order((int) $order_id); $post_id = (int) $order_id; ?> <p class="form-field form-field-wide"> <h4><?php _e('Buyer Extras', 'tc'); ?> </h4> <table class="order-table"> <tbody> <?php foreach ($fields as $field) { ?> <?php if ($orders->is_valid_order_field_type($field['field_type'])) { ?> <tr valign="top"> <?php if ($field['field_type'] !== 'separator') { ?> <th scope="row"><label for="<?php echo $field['field_name']; ?> "><?php echo $field['field_title']; ?> </label></th> <?php } ?> <td <?php echo $field['field_type'] == 'separator' ? 'colspan="2"' : ''; ?> > <?php do_action('tc_before_orders_field_type_check'); ?> <?php if ($field['field_type'] == 'ID') { echo $order->details->{$field['post_field_type']}; } ?> <?php if ($field['field_type'] == 'function') { eval($field['function'] . '("' . $field['field_name'] . '"' . (isset($post_id) ? ',' . $post_id : '') . (isset($field['id']) ? ',"' . $field['id'] . '"' : '') . ');'); ?> <?php } ?> <?php if ($field['field_type'] == 'text') { ?> <input type="text" class="regular-<?php echo $field['field_type']; ?> " value="<?php if (isset($order)) { if ($field['post_field_type'] == 'post_meta') { echo esc_attr(isset($order->details->{$field['field_name']}) ? $order->details->{$field['field_name']} : ''); } else { echo esc_attr($order->details->{$field['post_field_type']}); } ?> " id="<?php echo $field['field_name']; } ?> " name="<?php echo $field['field_name'] . '_' . $field['post_field_type']; ?> "> <?php } ?> <?php if ($field['field_type'] == 'separator') { ?> <hr /> <?php } ?> <?php do_action('tc_after_orders_field_type_check'); ?> </td> </tr> <?php } } do_action('tc_after_order_details_fields'); ?> </tbody> </table> </p> <?php }