file update

This commit is contained in:
magepeopleteam 2020-11-26 04:53:40 +00:00
parent 8957dee55e
commit eaeb45859c
2 changed files with 58 additions and 19 deletions

View File

@ -30,18 +30,16 @@ function mep_add_custom_fields_text_to_cart_item($cart_item_data, $product_id, $
$recurring_event_date = $recurring == 'yes' && isset($_POST['recurring_event_date']) ? $_POST['recurring_event_date'] : array();
$ticket_type_arr = mep_cart_ticket_type('ticket_type', $total_price,$product_id);
$total_price = mep_cart_ticket_type('ticket_price', $total_price,$product_id);
$event_extra = mep_cart_event_extra_service('event_extra_service', $total_price);
$total_price = mep_cart_event_extra_service('ticket_price', $total_price);
$event_extra = mep_cart_event_extra_service('event_extra_service', $total_price,$product_id);
$total_price = mep_cart_event_extra_service('ticket_price', $total_price,$product_id);
$user = $form_position == 'details_page' ? mep_save_attendee_info_into_cart($product_id) : array();
$validate = mep_cart_ticket_type('validation_data', $total_price,$product_id);
// echo '<pre>';
// // print_r($user);
// print_r($ticket_type_arr);
// echo '</pre>';
// die();
// echo '<pre>';
// // print_r($user);
// print_r($ticket_type_arr);
// echo '</pre>';
// die();
/**
* Now Store the datas into Cart Session
@ -105,8 +103,8 @@ function mep_display_custom_fields_text_cart($item_data, $cart_item)
$eid = array_key_exists('event_id', $cart_item) ? $cart_item['event_id'] : 0; //$cart_item['event_id'];
if (get_post_type($eid) == 'mep_events') {
$hide_location_status = mep_get_option('mep_hide_location_from_order_page', 'general_setting_sec', 'no');
$hide_date_status = mep_get_option('mep_hide_date_from_order_page', 'general_setting_sec', 'no');
$hide_location_status = mep_get_option('mep_hide_location_from_order_page', 'general_setting_sec', 'no');
$hide_date_status = mep_get_option('mep_hide_date_from_order_page', 'general_setting_sec', 'no');
$user_info = $cart_item['event_user_info'];
$ticket_type_arr = $cart_item['event_ticket_info'];
$event_extra_service = $cart_item['event_extra_service'];

View File

@ -2790,21 +2790,38 @@ function mep_apply_custom_css(){
}
function mep_get_ticket_type_price_by_name($name,$event_id){
$ticket_type_arr = get_post_meta($event_id,'mep_event_ticket_type',true) ? get_post_meta($event_id,'mep_event_ticket_type',true) : [];
foreach($ticket_type_arr as $price){
if($price['option_name_t'] === $name){
$p = $price['option_price_t'];
}
}
return $p;
}
function mep_get_ticket_type_price_arr($ticket_type,$event_id){
$price = [];
foreach($ticket_type as $ticket){
$price[] = mep_get_ticket_type_price_by_name($ticket,$event_id);
}
return $price;
}
if (!function_exists('mep_cart_ticket_type')) {
function mep_cart_ticket_type($type,$total_price,$product_id){
$mep_event_start_date = isset($_POST['mep_event_start_date']) ? $_POST['mep_event_start_date'] : array();
$names = isset($_POST['option_name']) ? $_POST['option_name'] : array();
$qty = isset($_POST['option_qty']) ? $_POST['option_qty'] : array();
$max_qty = isset($_POST['max_qty']) ? $_POST['max_qty'] : array();
$price = isset($_POST['option_price']) ? $_POST['option_price'] : array();
$max_qty = isset($_POST['max_qty']) ? $_POST['max_qty'] : array();
$price = mep_get_ticket_type_price_arr($names,$product_id);
$count = count( $names );
$ticket_type_arr = [];
// echo '<pre>';
// print_r($names);
// // print_r($mep_event_start_date);
// // print_r($qty);
// echo '</pre>';
$vald = 0;
if(sizeof($names) > 0){
for ( $i = 0; $i < $count; $i++ ) {
@ -2832,12 +2849,36 @@ function mep_cart_ticket_type($type,$total_price,$product_id){
}
}
function mep_get_event_extra_price_by_name($name,$event_id){
$ticket_type_arr = get_post_meta($event_id,'mep_events_extra_prices',true) ? get_post_meta($event_id,'mep_events_extra_prices',true) : [];
foreach($ticket_type_arr as $price){
if($price['option_name'] === $name){
$p = $price['option_price'];
}
}
return $p;
}
function mep_get_extra_price_arr($ticket_type,$event_id){
$price = [];
foreach($ticket_type as $ticket){
$price[] = mep_get_event_extra_price_by_name($ticket,$event_id);
}
return $price;
}
if (!function_exists('mep_cart_event_extra_service')) {
function mep_cart_event_extra_service($type,$total_price){
function mep_cart_event_extra_service($type,$total_price,$product_id){
$mep_event_start_date_es = isset($_POST['mep_event_start_date_es']) ? $_POST['mep_event_start_date_es'] : array();
$extra_service_name = isset($_POST['event_extra_service_name']) ? mage_array_strip($_POST['event_extra_service_name']) : array();
$extra_service_qty = isset($_POST['event_extra_service_qty']) ? mage_array_strip($_POST['event_extra_service_qty']):array();
$extra_service_price = isset($_POST['event_extra_service_price']) ? mage_array_strip($_POST['event_extra_service_price']):array();
$extra_service_price = mep_get_extra_price_arr($extra_service_name,$product_id);
$event_extra = [];
if($extra_service_name){