0){ if ( $names[$i] != '' ) : $ticket_type_arr[$i]['ticket_name'] = stripslashes( strip_tags( $names[$i] ) ); endif; if ( $price[$i] != '' ) : $ticket_type_arr[$i]['ticket_price'] = stripslashes( strip_tags( $price[$i] ) ); endif; if ( $qty[$i] != '' ) : $ticket_type_arr[$i]['ticket_qty'] = stripslashes( strip_tags( $qty[$i] ) ); endif; if ( $max_qty[$i] != '' ) : $ticket_type_arr[$i]['max_qty'] = stripslashes( strip_tags( $max_qty[$i] ) ); endif; if ( $mep_event_start_date[$i] != '' ) : $ticket_type_arr[$i]['event_date'] = stripslashes( strip_tags( $mep_event_start_date[$i] ) ); endif; $opttprice = ($price[$i]*$qty[$i]); $tp = ($tp+$opttprice); } } } $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(); if($extra_service_name){ for ( $i = 0; $i < count($extra_service_name); $i++ ) { if($extra_service_qty[$i] > 0){ if ( $extra_service_name[$i] != '' ) : $event_extra[$i]['service_name'] = stripslashes( strip_tags( $extra_service_name[$i] ) ); endif; if ( $extra_service_price[$i] != '' ) : $event_extra[$i]['service_price'] = stripslashes( strip_tags( $extra_service_price[$i] ) ); endif; if ( $extra_service_qty[$i] != '' ) : $event_extra[$i]['service_qty'] = stripslashes( strip_tags( $extra_service_qty[$i] ) ); endif; } $extprice = ($extra_service_price[$i]*$extra_service_qty[$i]); $tp = ($tp+$extprice); } } if(isset($_POST['mep_event_ticket_type'])){ $ttp = $_POST['mep_event_ticket_type']; $ttpqt = $_POST['tcp_qty']; $ticket_type = mep_get_order_info($ttp,1); $ticket_type_price = (mep_get_order_info($ttp,0)*$ttpqt); $cart_item_data['event_ticket_type'] = $ticket_type; $cart_item_data['event_ticket_price'] = $ticket_type_price; $cart_item_data['event_ticket_qty'] = $ttpqt; $tp = $tp+$ticket_type_price; } $form_position = mep_get_option( 'mep_user_form_position', 'general_attendee_sec', 'details_page' ); if($form_position=='details_page'){ $user = mep_save_attendee_info_into_cart($product_id); }else{ $user = ''; } $mep_event_ticket_type = get_post_meta($product_id, 'mep_event_ticket_type', true) ? get_post_meta($product_id, 'mep_event_ticket_type', true) : array(); $cnt = 0; $vald = 0; // $ticket_type_arr = array(); if(is_array($mep_event_ticket_type) && sizeof($mep_event_ticket_type) > 0){ // foreach($mep_event_ticket_type as $_type){ // $cart_arr = $new[$cnt]; // $name_key = array_search($_type['option_name_t'],$cart_arr); // $qty_key = array_search($_type['option_qty_t'],$cart_arr); // if(is_array($name_key)){ // $total_found = count($name_key); // }else{ // $total_found = 0; // } // if($cart_arr['option_qty'] > 0){ // $ticket_type_arr[$cnt]['ticket_name'] = stripslashes( strip_tags( $cart_arr[$name_key] ) ); // $ticket_type_arr[$cnt]['ticket_qty'] = stripslashes( strip_tags( $cart_arr['option_qty'] ) ); // $ticket_type_arr[$cnt]['ticket_price'] = stripslashes( strip_tags( $cart_arr['option_price'] ) ); // $ticket_type_arr[$cnt]['event_date'] = stripslashes( strip_tags( $cart_arr['event_data'] ) ); // $validate[$cnt]['ticket_qty'] = $vald + stripslashes( strip_tags( $cart_arr['option_qty'] ) ); // $validate[$cnt]['event_id'] = stripslashes( strip_tags( $product_id ) ); // } // $cnt++; // } } // print_r($ticket_type_arr); // die(); $cart_item_data['event_ticket_info'] = $ticket_type_arr; $cart_item_data['event_validate_info'] = $validate; $cart_item_data['event_extra_option'] = $new; $cart_item_data['event_user_info'] = $user; $cart_item_data['event_tp'] = $tp; $cart_item_data['line_total'] = $tp; $cart_item_data['line_subtotal'] = $tp; $cart_item_data['event_extra_service'] = $event_extra; $cart_item_data['event_cart_location'] = $event_cart_location; $cart_item_data['event_cart_date'] = $mep_event_start_date; $cart_item_data['event_recurring_date'] = array_unique($recurring_event_date); $cart_item_data['event_recurring_date_arr'] = $recurring_event_date; // $cart_item_data['event_cart_date'] = $event_cart_date; } $cart_item_data['event_id'] = $product_id; return $cart_item_data; } add_filter( 'woocommerce_add_cart_item_data', 'mep_add_custom_fields_text_to_cart_item', 90, 3); add_action( 'woocommerce_before_calculate_totals', 'mep_add_custom_price',90,1 ); function mep_add_custom_price( $cart_object ) { foreach ( $cart_object->cart_contents as $key => $value ) { $eid = $value['event_id']; if (get_post_type($eid) == 'mep_events') { $cp = $value['event_tp']; $value['data']->set_price($cp); $value['data']->set_regular_price($cp); $value['data']->set_sale_price($cp); $value['data']->set_sold_individually('yes'); $new_price = $value['data']->get_price(); } } } function mep_display_custom_fields_text_cart( $item_data, $cart_item ) { $mep_events_extra_prices = $cart_item['event_extra_option']; $eid = $cart_item['event_id']; if (get_post_type($eid) == 'mep_events') { $user_info = $cart_item['event_user_info']; $ticket_type_arr = $cart_item['event_ticket_info']; $event_extra_service = $cart_item['event_extra_service']; $event_recurring_date = $cart_item['event_recurring_date']; // echo '
'; // print_r($ticket_type_arr); $recurring = get_post_meta($eid, 'mep_enable_recurring', true) ? get_post_meta($eid, 'mep_enable_recurring', true) : 'no'; echo "