function wc2_send_ordermail_admin() { $_POST = wc2_stripslashes_deep_post($_POST); $general_options = wc2_get_option('general'); $name = sprintf(__('Mr/Mrs %s', 'wc2'), trim(urldecode($_POST['name']))); $message = trim(urldecode($_POST['message'])); $wc2_mail = WC2_Mail::get_instance(); $wc2_mail->clear_column(); $wc2_mail->set_customer_para_value('to_name', $name); $wc2_mail->set_customer_para_value('to_address', trim(urldecode($_POST['mailaddress']))); $wc2_mail->set_customer_para_value('from_name', get_option('blogname')); $wc2_mail->set_customer_para_value('from_address', $general_options['sender_mail']); $wc2_mail->set_customer_para_value('return_path', $general_options['sender_mail']); $wc2_mail->set_customer_para_value('subject', trim(urldecode($_POST['subject']))); $wc2_mail->set_customer_para_value('message', $message); do_action('wc2_action_send_ordermail_admin_parameter_to_customer', $_POST['checked']); $res = $wc2_mail->send_customer_mail(); if ($res) { wc2_update_order_check($_POST['order_id'], $_POST['checked']); $wc2_mail->set_admin_para_value('to_name', 'Shop Admin'); $wc2_mail->set_admin_para_value('to_address', $general_options['order_mail']); $wc2_mail->set_admin_para_value('from_name', 'Welcart Auto BCC'); $wc2_mail->set_admin_para_value('from_address', $general_options['sender_mail']); $wc2_mail->set_admin_para_value('return_path', $general_options['sender_mail']); $wc2_mail->set_admin_para_value('subject', trim(urldecode($_POST['subject'])) . ' to ' . $name); $wc2_mail->set_admin_para_value('message', $message); do_action('wc2_action_send_ordermail_admin_parameter_to_manager', $_POST['checked']); $res = $wc2_mail->send_admin_mail(); return 'OK'; } else { return 'NG'; } }
function order_edit_ajax() { //wc2_log(print_r($_POST,true),"test.log"); if ($_POST['action'] != 'order_edit_ajax') { die(0); } $res = false; $_POST = WC2_Utils::stripslashes_deep_post($_POST); switch ($_POST['mode']) { case 'add2cart': $slug = apply_filters('wc2_filter_cart_slug', 'cart'); $general_options = wc2_get_option('general'); $add_cart = array(); $item_id = isset($_POST['item_id']) ? $_POST['item_id'] : 0; $sku_id = isset($_POST['sku_id']) ? $_POST['sku_id'] : 0; $quantity = isset($_POST['quantity']) ? $_POST['quantity'] : 1; $cart_row = isset($_POST['cart_row']) ? $_POST['cart_row'] : 1; $item_sku_data = wc2_get_item_sku_data($item_id, $sku_id); $price = $item_sku_data['sku_price']; $price = apply_filters('wc2_filter_admin_order_add2cart_price', $price, $quantity, $item_id, $sku_id, $slug); if (empty($general_options['tax_rate'])) { $tax = 0; } else { $materials = array('total_price' => $price * $quantity, 'discount' => 0, 'shipping_charge' => 0, 'cod_fee' => 0); $tax = wc2_internal_tax($materials); } $add_cart['group_id'] = 0; $add_cart['row_index'] = $cart_row; $add_cart['post_id'] = $item_sku_data['item_post_id']; $add_cart['item_id'] = $item_id; $add_cart['item_code'] = $item_sku_data['item_code']; $add_cart['item_name'] = $item_sku_data['item_name']; $add_cart['sku_id'] = $sku_id; $add_cart['sku_code'] = $item_sku_data['sku_code']; $add_cart['sku_name'] = $item_sku_data['sku_name']; $add_cart['price'] = $price; $add_cart['cprice'] = $item_sku_data['sku_costprice']; $add_cart['quantity'] = $quantity; $add_cart['unit'] = $item_sku_data['sku_unit']; $add_cart['tax'] = $tax; $add_cart['destination_id'] = 0; $add_cart['meta_type'] = apply_filters('wc2_filter_admin_order_add2cart_meta_type', array(), $quantity, $item_id, $sku_id, $slug); $add_cart['meta_key'] = apply_filters('wc2_filter_admin_order_add2cart_meta_key', array(), $quantity, $item_id, $sku_id, $slug); $add_cart = apply_filters('wc2_filter_admin_order_add2cart', $add_cart, $slug); $res = wc2_add_order_cart_data($_POST['order_id'], $add_cart); if (!$res) { die($res); } $cart = wc2_get_order_cart_data($_POST['order_id']); //*** LI CUSTOMIZE >>> //$res = wc2_get_admin_order_cart_row( $_POST['order_id'], $cart ); $cart_row = wc2_get_admin_order_cart_row($_POST['order_id'], $cart); $order_history_form = li_get_order_history_form($_POST['order_id']); $res = 'OK' . WC2_SPLIT . $cart_row . WC2_SPLIT . $order_history_form; $shipping_charge = li_get_delivery_shipping_charge($_POST['delivery_method'], $_POST['delivery_pref'], $cart); $order_modified = wc2_get_today_datetime_format(); $update_query = " shipping_charge = " . $shipping_charge . ", order_modified = '" . $order_modified . "'"; wc2_update_order_data_value($_POST['order_id'], $update_query); //*** LI CUSTOMIZE <<< break; case 'cart_remove': $res = wc2_remove_order_cart_data($_POST['order_id'], $_POST['cart_id']); if (!$res) { die($res); } $cart = wc2_get_order_cart_data($_POST['order_id']); //*** LI CUSTOMIZE >>> //$res = wc2_get_admin_order_cart_row( $_POST['order_id'], $cart ); $cart_row = wc2_get_admin_order_cart_row($_POST['order_id'], $cart); $order_history_form = li_get_order_history_form($_POST['order_id']); $res = 'OK' . WC2_SPLIT . $cart_row . WC2_SPLIT . $order_history_form; $shipping_charge = li_get_delivery_shipping_charge($_POST['delivery_method'], $_POST['delivery_pref'], $cart); $order_modified = wc2_get_today_datetime_format(); $update_query = " shipping_charge = " . $shipping_charge . ", order_modified = '" . $order_modified . "'"; wc2_update_order_data_value($_POST['order_id'], $update_query); //*** LI CUSTOMIZE <<< break; case 'mail_completion': case 'mail_order': case 'mail_change': case 'mail_receipt': case 'mail_estimate': case 'mail_cancel': case 'mail_other': $res = wc2_ordermail_admin($_POST['order_id']); break; case 'sendmail': $res = wc2_send_ordermail_admin(); break; case 'get_add_item': $res = wc2_get_add_item($_POST['item_code']); break; case 'get_select_item': $res = wc2_get_select_item($_POST['cat_id']); break; case 'checkpost': $res = wc2_update_order_check($_POST['order_id'], $_POST['checked']); break; case 'get_member': $res = wc2_get_member_neworder($_POST['email']); break; case 'recalculation': $res = wc2_order_recalculation($_POST['order_id'], $_POST['member_id'], $_POST['item_ids'], $_POST['skus'], $_POST['prices'], $_POST['quantities'], $_POST['usedpoint'], $_POST['shipping_charge'], $_POST['cod_fee']); break; } $res = apply_filters('wc2_filter_admin_order_edit_ajax', $res); //wc2_log($res,"test.log"); die($res); }