/** * Get vip status of customer from an order * @param String $type * @param Int $orders_id * @return Boolean */ function checkCustomerIsVIP($type, $orders_id) { $type = strtoupper($type); $is_vip = false; if ($type == 'SP') { use_class('jng_sp_orders'); use_class('jng_sp_customers'); use_class('jng_sp_customers_special'); $class_jo = new jng_sp_orders(); $class_jc = new jng_sp_customers(); $class_jcs = new jng_sp_customers_special(); $o = $class_jo->retrieveDetail($orders_id); //GET CUSTOMER DETAIL VIP OR NOT $cust_data = $class_jc->retrieveDetail(null, $o['jng_sp_id'], $o['customer_billing_id']); if (is_array($cust_data) && $cust_data['jng_sp_customers_id'] > 0) { $cust_detail = $class_jcs->getCustomerDetail($cust_data['jng_sp_customers_id']); } $is_vip = $cust_detail['list_type'] == 'V'; } elseif ($type == 'JG') { use_class('orders'); use_class('customers_special_list'); $class_o = new orders(); $class_csl = new customers_special_list(); $o = $class_o->retrieveDetail($orders_id); //GET CUSTOMER DETAIL VIP OR NOT $cust_detail = $class_csl->getCustomerDetail($o['customers_id']); $is_vip = $cust_detail['list_type'] == 'V'; } elseif ($type == 'DP') { use_class('depot_orders'); $class_do = new depot_orders(); $do = $class_do->retrieveDetail($orders_id); if ($do['trans_type'] == 'SP' || $do['trans_type'] == 'JG') { if ($do['trans_type'] == 'SP') { use_class('jng_sp_orders'); $class_jo = new jng_sp_orders(); $it = $class_jo->retrieveItemDetail($do['trans_id']); $orders_id = $it['jng_sp_orders_id']; } elseif ($do['trans_type'] == 'JG') { use_class('orders'); $class_o = new orders(); $it = $class_o->retrieveProductDetail($do['trans_id']); $orders_id = $it['orders_id']; } $is_vip = checkCustomerIsVIP($do['trans_type'], $orders_id); } } return $is_vip; }
$date_filter = date('Y-m-d', strtotime("-{$search_days} day")); $orders = $class_o->searchBanktransferOrders($search_field, $search_keywords, "o.date_purchased>DATE('{$date_filter}')"); $result = ''; $table = array(); if (count($orders) > 0) { $t = array(); $t['d'] = 'Date'; $t['c'] = 'Customer'; $t['o'] = 'Order No'; $t['i'] = 'Bank Info'; $t['p'] = 'Order Value'; $t['t'] = 'Withdrawal Date'; $table[] = $t; foreach ($orders as $row) { $order_date = strtotime($row['date_purchased']); $customer_special = $class_csl->getCustomerDetail($row['customers_id']); $crown_img = is_null($customer_special) ? '' : $class_csl->getTypeSymbol($customer_special['list_type'], $row['customers_id']); $t = array(); $t['d'] = date('d-M-y', $order_date); $t['c'] = $crown_img . ' <a href="?open=customer&id=' . $row['customers_id'] . '" target="_blank" title="View Customer Detail" >' . $row['customers_name'] . '</a> <sup>' . $row['customers_order_count'] . '</sup>'; $t['o'] = '<a href="?open=order&id=' . $row['orders_id'] . '" target="_blank" title="View Order Detail">' . $row['orders_no'] . '</a>'; $bank_name = $row['banktransfer_bankname']; $max_bank_chars = 40; if (strlen($bank_name) > $max_bank_chars) { $bank_name = substr($bank_name, 0, $max_bank_chars - 3) . '...'; } $bank_info = array(); $bank_info[] = 'No: ' . $row['banktransfer_number']; $bank_info[] = '<strong>Owner: ' . $row['banktransfer_owner'] . '</strong>'; $bank_info[] = 'Bank: ' . $bank_name; $t['i'] = implode('<br />', $bank_info);
<?php use_class('customers_special_list'); $class_csl = new customers_special_list(); use_class('minierp_customers'); $class_mc = new minierp_customers(); $customers_id = isset($_GET['id']) ? tep_db_prepare_input($_GET['id']) : ''; if ($customers_id == '') { exit; } $detail = $class_csl->getCustomerDetail($customers_id); if (is_null($detail)) { exit; } //AJAX ACTION if (isset($_POST['me_action'])) { if ($_POST['me_action'] == 'ADDNEWCOMMENT') { $customer_id = tep_db_prepare_input($_POST['customer_id']); $comment = tep_db_prepare_input(utf8_decode($_POST['comment'])); $comment = trim($comment); if ($comment != "") { $comment_by = $session_userinfo['username']; $comment_id = $class_csl->insertComment($customer_id, $comment, $comment_by); // $comment = $class_csl->retrieveCommentDetail($comment_id); // $comments = array($comment); // $result = $class_csl->drawComments($comments, true); $result = drawSingleComment($comment_id, $comment_by, time(), $comment); echo utf8_encode($result); } exit; } elseif ($_POST['me_action'] == 'DELETECOMMENT') {
$class_jcs->addCustomer('B', $jng_sp_customers_id); } else { $class_jcs->updateCustomer($jng_sp_customers_id, 'list_type', 'B'); } } } break; case 'J': use_class('customers_special_list'); $class_cs = new customers_special_list(); if (isset($request['userid']) && $request['userid'] != '') { $q = tep_db_query("SELECT customers_id FROM customers WHERE payone_userid=" . $request['userid']); if (tep_db_num_rows($q) > 0) { $cust = tep_db_fetch_array($q); $customers_id = $cust['customers_id']; if (is_null($class_cs->getCustomerDetail($customers_id))) { $class_cs->addCustomer('B', $customers_id); } else { $class_cs->updateCustomer($customers_id, 'list_type', 'B'); } } } break; } } break; default: $response = ""; } if ($payi->detail['sequencenumber'] < $request['sequencenumber']) { $payi->saveUsedSequenceNumber($request['sequencenumber']);
$customer = $class_mc->retrieveDetail($customer_id); if (is_null($customer)) { $messagebox->add('Customer ID: <strong>' . $customer_id . '</strong> not found'); $content = $idform; } else { $orders_query = tep_db_query("SELECT COUNT(o.orders_id) AS count, SUM(ot.value) AS total FROM orders o INNER JOIN orders_total ot ON ot.orders_id=o.orders_id AND ot.class='ot_total' WHERE o.customers_id={$customer_id} GROUP BY o.customers_id"); $orders = tep_db_fetch_array($orders_query); $has_orders = is_array($orders) && isset($orders['count']); if ($customer['customers_dob'] != '') { $dob = $customer['customers_dob']; $customer['customers_dob'] = substr($dob, 8, 2) . '.' . substr($dob, 5, 2) . '.' . substr($dob, 0, 4); } if ($customer['customers_dob'] == '00.00.0000' || $customer['customers_dob'] == '') { $customer['customers_dob'] = 'dd.mm.yyyy'; } $customer_special = $class_csl->getCustomerDetail($customer_id); $order_sl_type = ''; $order_sl_icon = ''; if (!is_null($customer_special)) { $crown_img = $class_csl->getTypeSymbol($customer_special['list_type'], $customer_id); $order_sl_icon = $crown_img . ' '; $order_sl_type = $class_csl->getTypeName($customer_special['list_type']); if ($order_sl_type != '') { $order_sl_type = ' (' . $order_sl_type . ')'; } } $customer_info = $class_mc->retrieveDetailInfo($customer_id); $customer_profile = $class_mc->retrieveProfile($customer_id); $customer_addresses_query = tep_db_query("SELECT ab.*, c.countries_name FROM address_book ab LEFT JOIN countries c ON c.countries_id=ab.entry_country_id WHERE ab.customers_id={$customer_id}"); $customer_addresses = array(); while ($row = tep_db_fetch_array($customer_addresses_query)) {