Added Extra service into CSV file, Fix Attendee Details hide issue
This commit is contained in:
parent
4dc1df03ee
commit
e4bafbd762
|
@ -17,13 +17,13 @@ function export_btn() {
|
||||||
<input type="submit" name='export' id="csvExport" value="<?php _e('Export to CSV','mage-eventpress'); ?>"/>
|
<input type="submit" name='export' id="csvExport" value="<?php _e('Export to CSV','mage-eventpress'); ?>"/>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function mep_get_event_user_fields($post_id){
|
function mep_get_event_user_fields($post_id){
|
||||||
|
global $woocommerce, $post;
|
||||||
$row = array(
|
$row = array(
|
||||||
'Order ID',
|
'Order ID',
|
||||||
'Event',
|
'Event',
|
||||||
|
@ -34,6 +34,8 @@ function mep_get_event_user_fields($post_id){
|
||||||
'Addresss',
|
'Addresss',
|
||||||
'Tee Size'
|
'Tee Size'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
$crow = array();
|
$crow = array();
|
||||||
$mep_form_builder_data = get_post_meta($post_id, 'mep_form_builder_data', true);
|
$mep_form_builder_data = get_post_meta($post_id, 'mep_form_builder_data', true);
|
||||||
if ( $mep_form_builder_data ) {
|
if ( $mep_form_builder_data ) {
|
||||||
|
@ -41,7 +43,16 @@ $mep_form_builder_data = get_post_meta($post_id, 'mep_form_builder_data', true);
|
||||||
$crow[] = $_field['mep_fbc_label'];
|
$crow[] = $_field['mep_fbc_label'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return array_merge($row, $crow);
|
|
||||||
|
|
||||||
|
$order = get_post_meta($post_id, 'mep_events_extra_prices', true);
|
||||||
|
$exs = array();
|
||||||
|
if($order){
|
||||||
|
foreach ($order as $_exs) {
|
||||||
|
$exs[] = $_exs['option_name'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return array_merge($row, $crow, $exs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -65,16 +76,74 @@ $values = get_post_custom( $post_id );
|
||||||
$vname = "ea_".$_field['mep_fbc_id'];
|
$vname = "ea_".$_field['mep_fbc_id'];
|
||||||
if(array_key_exists($vname, $values)){
|
if(array_key_exists($vname, $values)){
|
||||||
$crow[] = get_post_meta( $post_id, $vname , true );
|
$crow[] = get_post_meta( $post_id, $vname , true );
|
||||||
|
}else{
|
||||||
|
$crow[] = '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return array_merge($row, $crow);
|
|
||||||
|
$order = get_post_meta($event, 'mep_events_extra_prices', true);
|
||||||
|
$exs = array();
|
||||||
|
$order_extra_service_arr = mep_get_event_extra_service_items($post_id);
|
||||||
|
if($order_extra_service_arr){
|
||||||
|
foreach ($order as $_exs) {
|
||||||
|
// $exs[] = $_exs['option_name'];
|
||||||
|
$exs[] = mep_get_extra_service_order_qty($_exs['option_name'], $order_extra_service_arr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return array_merge($row, $crow, $exs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function mep_get_event_extra_service_items($post_id){
|
||||||
|
global $wpdb;
|
||||||
|
$order_id = get_post_meta($post_id, 'ea_order_id', true);
|
||||||
|
$item_table_name = $wpdb->prefix."woocommerce_order_items";
|
||||||
|
if($order_id){
|
||||||
|
$sql = "SELECT order_item_id FROM $item_table_name WHERE order_item_type = 'line_item' AND order_id=$order_id";
|
||||||
|
$results = $wpdb->get_results($sql); //or die(mysql_error());
|
||||||
|
|
||||||
|
if(!empty($results)){
|
||||||
|
$order_item_id = $results[0]->order_item_id;
|
||||||
|
|
||||||
|
$table_name = $wpdb->prefix."woocommerce_order_itemmeta";
|
||||||
|
|
||||||
|
$sql2 = "SELECT meta_value FROM $table_name WHERE order_item_id =$order_item_id AND meta_key='_event_service_info'";
|
||||||
|
$results2 = $wpdb->get_results($sql2);
|
||||||
|
|
||||||
|
if($results2){
|
||||||
|
return unserialize($results2[0]->meta_value);
|
||||||
|
}else{
|
||||||
|
return array();
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
return array();
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
return array();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function mep_get_extra_service_order_qty($name, $array) {
|
||||||
|
if(!empty($array)){
|
||||||
|
foreach ($array as $key => $val) {
|
||||||
|
if ($val['option_name'] === $name ) {
|
||||||
|
return $val['option_qty'];
|
||||||
|
// return $key;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Add action hook only if action=download_csv
|
// Add action hook only if action=download_csv
|
||||||
if ( isset($_GET['action'] ) && $_GET['action'] == 'download_csv' ) {
|
if ( isset($_GET['action'] ) && $_GET['action'] == 'download_csv' ) {
|
||||||
// Handle CSV Export
|
// Handle CSV Export
|
||||||
|
|
|
@ -1251,16 +1251,22 @@ $sts_msg = update_post_meta( $pid, '_stock_msg', 'new');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
add_action( 'add_meta_boxes', 'mep_meta_box_add' );
|
add_action( 'add_meta_boxes', 'mep_meta_box_add' );
|
||||||
function mep_meta_box_add(){
|
function mep_meta_box_add(){
|
||||||
add_meta_box( 'my-meta-box-id', 'Information', 'mep_meta_box_cb', 'mep_events_attendees', 'normal', 'high' );
|
add_meta_box( 'my-meta-box-id', 'Information', 'mep_meta_box_cb', 'mep_events_attendees', 'normal', 'high' );
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function mep_meta_box_cb($post){
|
function mep_meta_box_cb($post){
|
||||||
$values = get_post_custom( $post->ID );
|
$values = get_post_custom( $post->ID );
|
||||||
|
|
||||||
$event_meta = get_post_custom($values['ea_event_id'][0]);
|
$event_meta = get_post_custom($values['ea_event_id'][0]);
|
||||||
|
$ticket_type = get_post_meta( $post->ID, 'ea_ticket_type', true );
|
||||||
|
|
||||||
$mep_full_name = strip_tags($event_meta['mep_full_name'][0]);
|
$mep_full_name = strip_tags($event_meta['mep_full_name'][0]);
|
||||||
$mep_reg_email = strip_tags($event_meta['mep_reg_email'][0]);
|
$mep_reg_email = strip_tags($event_meta['mep_reg_email'][0]);
|
||||||
|
@ -1272,6 +1278,30 @@ $event_meta = get_post_custom($values['ea_event_id'][0]);
|
||||||
$mep_reg_company = strip_tags($event_meta['mep_reg_company'][0]);
|
$mep_reg_company = strip_tags($event_meta['mep_reg_company'][0]);
|
||||||
$mep_reg_gender = strip_tags($event_meta['mep_reg_gender'][0]);
|
$mep_reg_gender = strip_tags($event_meta['mep_reg_gender'][0]);
|
||||||
$mep_reg_tshirtsize = strip_tags($event_meta['mep_reg_tshirtsize'][0]);
|
$mep_reg_tshirtsize = strip_tags($event_meta['mep_reg_tshirtsize'][0]);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$order = wc_get_order( $values['ea_order_id'][0] );
|
||||||
|
|
||||||
|
foreach ( $order->get_items() as $item_id => $item_values ) {
|
||||||
|
$product_id = $item_values->get_product_id();
|
||||||
|
$item_data = $item_values->get_data();
|
||||||
|
$product_id = $item_data['product_id'];
|
||||||
|
$item_quantity = $item_values->get_quantity();
|
||||||
|
$product = get_page_by_title( $item_data['name'], OBJECT, 'mep_events' );
|
||||||
|
$event_name = $item_data['name'];
|
||||||
|
$event_id = $product->ID;
|
||||||
|
$item_id = $item_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
$extra_info_arr = wc_get_order_item_meta($item_id,'_event_service_info',true);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<div class="mep-attendee-sec-details">
|
<div class="mep-attendee-sec-details">
|
||||||
|
@ -1373,16 +1403,28 @@ $mep_form_builder_data = get_post_meta($values['ea_event_id'][0], 'mep_form_buil
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
foreach ($extra_info_arr as $_exs) {
|
||||||
|
if($_exs['option_qty']>0){
|
||||||
|
$rs[] = $_exs['option_name']." (".$_exs['option_qty'].")";
|
||||||
|
if($ticket_type != $_exs['option_name']){
|
||||||
|
?>
|
||||||
|
<div class='sec'>
|
||||||
|
<span class="ea-label"><?php $_exs['option_name']; ?> </span>
|
||||||
|
<span class="ea-value">
|
||||||
|
<?php echo $_exs['option_qty']; ?>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class='sec'>
|
|
||||||
<span class="ea-label"><?php _e('Ticket Type:','mage-eventpress'); ?> </span>
|
|
||||||
<span class="ea-value">
|
|
||||||
<?php echo $values['ea_ticket_type'][0]; ?>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div class='sec'>
|
<div class='sec'>
|
||||||
<span class="ea-label"><?php _e('Order ID:','mage-eventpress'); ?> </span>
|
<span class="ea-label"><?php _e('Order ID:','mage-eventpress'); ?> </span>
|
||||||
<span class="ea-value">
|
<span class="ea-value">
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
* Plugin Name: Woocommerce Events Manager
|
* Plugin Name: Woocommerce Events Manager
|
||||||
* Plugin URI: http://mage-people.com
|
* Plugin URI: http://mage-people.com
|
||||||
* Description: A Complete Event Solution for WordPress by MagePeople..
|
* Description: A Complete Event Solution for WordPress by MagePeople..
|
||||||
* Version: 2.5.6
|
* Version: 2.5.7
|
||||||
* Author: MagePeople Team
|
* Author: MagePeople Team
|
||||||
* Author URI: http://www.mage-people.com/
|
* Author URI: http://www.mage-people.com/
|
||||||
* Text Domain: mage-eventpress
|
* Text Domain: mage-eventpress
|
||||||
|
|
Loading…
Reference in New Issue