<?php use_class('jng_sp_customers_special'); $class_jcs = new jng_sp_customers_special(); $type = isset($_GET['type']) ? tep_db_prepare_input($_GET['type']) : ''; if ($type == '') { exit; } $typename = $class_jcs->getTypeName($type); //AJAX ACTION if (isset($_POST['me_action'])) { if ($_POST['me_action'] == 'SEARCHCUSTOMER') { $keywords = tep_db_prepare_input(utf8_decode($_POST['keywords'])); $keywords = strtolower(trim($keywords)); $result = ''; if ($keywords == '') { $result .= '<h3 class="red">Please enter keywords</h3>'; } else { $customers = $class_jcs->getCustomersToAdd($keywords); if (count($customers) == 0) { $result .= '<h3 class="red">No Customers found for this keywords</h3>'; } else { $table = array(); $t = array(); $t['r'] = 'Partner'; $t['d'] = 'J&G ID'; $t['c'] = 'Name'; $t['a'] = 'Action'; $table[] = $t; $keywords_array = explode(' ', $keywords); foreach ($customers as $c) {
<?php use_class('jng_sp_customers_special'); $class_jcs = new jng_sp_customers_special(); //AJAX ACTION if (isset($_GET['type'])) { $type = tep_db_prepare_input($_GET['type']); $list = $class_jcs->retrieveList($type); $result = ''; $result .= '<h2>'; $result .= $class_jcs->getTypeSymbol($type) . ' '; $result .= $class_jcs->getTypeName($type) . ' Customers'; $result .= '</h2>'; $result .= '<div style="margin:10px 0 20px 0;">'; if ($type != 'N') { $result .= '<a href="?open=sp-customers-special-list-add&type=' . $type . '&hidemenu=true" class="view_webpage"></a>'; $result .= '<input type="button" class="button" name="addnew" value="Add Customer" onclick="$(this).siblings(\'a\').click();" />'; } else { $result .= '<span class="notice">When removed from Blacklist/VIP list, customer will be moved here so all historical information is not lost</span>'; } $result .= '</div>'; if (count($list) == 0) { $result .= '<h3 class="red">No customer is found</h3>'; } else { $table = array(); $t = array(); $t['r'] = 'Partner'; $t['d'] = 'J&G ID'; $t['c'] = 'Name'; $t['a'] = 'Action'; $table[] = $t;
$submit = tep_db_prepare_input($_POST['submit']); $type = strpos($submit, 'VIP') === false ? 'B' : 'V'; $customers_id = tep_db_prepare_input($_POST['customer_id']); $class_jcs->addCustomer($type, $customers_id); $openspeciallistdetail = true; } } //START TEMPLATE $customer = $class_jcust->retrieveDetail($customers_id); $customer_special = $class_jcs->getCustomerDetail($customers_id); $order_sl_type = ''; $order_sl_icon = ''; if (!is_null($customer_special)) { $crown_img = $class_jcs->getTypeSymbol($customer_special['list_type'], $customers_id); $order_sl_icon = $crown_img . ' '; $order_sl_type = $class_jcs->getTypeName($customer_special['list_type']); if ($order_sl_type != '') { $order_sl_type = ' (' . $order_sl_type . ')'; } } $sp_detail = $class_sp->retrieveDetail($customer['jng_sp_id']); $addresses = $class_jcust->getAddresses($customers_id); $phones = $class_jcust->getPhones($customers_id); $fullname = $customer['customer_firstname']; if ($customer['customer_lastname'] != '') { $fullname .= ' ' . $customer['customer_lastname']; } $order_count = '1' . '<a href="">(View Order List)</a>'; $formtitle = $fullname; $form = ''; $form .= '<div style="margin:10px 0 15px 0;text-align:center;">';
$text_alert = tep_db_prepare_input(utf8_decode($_POST['text_alert'])); $result = $class_jcs->updateCustomer($jng_sp_customers_id, 'text_alert', $text_alert); exit; } elseif ($_POST['me_action'] == 'CHANGELISTTYPE') { $new_type = tep_db_prepare_input(utf8_decode($_POST['new_type'])); $result = $class_jcs->updateCustomer($jng_sp_customers_id, 'list_type', $new_type); exit; } } //START TEMPLATE $customer = $class_jcust->retrieveDetail($jng_sp_customers_id); $sp_detail = $class_sp->retrieveDetail($customer['jng_sp_id']); $total_orders = $class_jcust->retrieveTotalOrders($jng_sp_customers_id); $total_products_ordered = $class_jcust->retrieveTotalProductsOrdered($jng_sp_customers_id); $typeimg = $class_jcs->getTypeSymbol($detail['list_type']); $typename = $class_jcs->getTypeName($detail['list_type']); $content = ''; $content .= '<div style="float:left;width:330px;">'; $content .= '<table border="0" cellpadding="0" cellspacing="0">'; $content .= '<tr><td colspan="2"><h2 style="margin:0;"><a href="?open=sp-customer&id=' . $jng_sp_customers_id . '" title="View Customer Detail">' . $customer['customer_firstname'] . ' ' . $customer['customer_lastname'] . '</a></h2></td></tr>'; //$content .= '<tr><td width="110">Partner</td><td>'.$sp_detail['name'].'</td></tr>'; //$content .= '<tr><td width="110">Email Address</td><td>'.$customer['customer_email'].'</td></tr>'; $content .= '<tr><td colspan="2"><div id="btn-mover">'; if ($detail['list_type'] == 'N') { $content .= '<input type="button" class="red" name="B" Value="Add to Blacklist" title="Add Customer to Blacklist" />'; $content .= '<input type="button" class="red" name="V" Value="Upgrade as VIP" title="Upgrade Customer as VIP" />'; } else { $content .= '<input type="button" class="red" name="N" Value="Remove ' . $typename . ' Status" title="Remove customer from ' . $typename . '" />'; } $content .= '</div></td></tr>'; //Text Alert
//$comments = array($comment); //$result = $class_jo->drawComments($comments, true); $result = drawSingleComment($comment_id, $comment_by, time(), $comment); echo utf8_encode($result); exit; } elseif ($_POST['me_action'] == 'DELETECOMMENT') { $order_id = tep_db_prepare_input($_POST['order_id']); $comment_id = tep_db_prepare_input($_POST['comment_id']); $class_jo->deleteComment($order_id, $comment_id); echo utf8_encode($comment_id); exit; } elseif ($_POST['me_action'] == 'UPDATECUSTOMERSPECIALLIST') { $customers_id = tep_db_prepare_input($_POST['customers_id']); $status = tep_db_prepare_input($_POST['status']); $class_jcs->addCustomer($status, $customers_id); $messagebox->add('Successfully set this customer as a ' . $class_jcs->getTypeName($status) . ' Customer', 'green'); $openspeciallistdetail = true; } elseif ($_POST['me_action'] == 'CHANGEEMAILADDRESS') { $order_id = tep_db_prepare_input($_POST['order_id']); $old_email = tep_db_prepare_input($_POST['old_email']); $new_email = tep_db_prepare_input($_POST['new_email']); if (tep_validate_email($new_email)) { $class_jo->updateEmailAddress($order_id, $old_email, $new_email, $session_userinfo['username']); $result = 'OK'; } else { $result = 'FAIL'; } echo utf8_encode($result); exit; } }