示例#1
0
/**
 * 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;
}
 case 'reminder':
     $level = $request['reminderlevel'];
     $payi->addReminder($tx_time, $level, $received);
     $black_lists = array('5', 'A');
     //BLACK LIST FOR CUSTOMERS THAT ALREADY RECEIVE reminder_level 5 and A
     if (in_array($level, $black_lists)) {
         switch ($payi->detail['invoice_order_type']) {
             case 'S':
                 use_class('jng_sp_customers_special');
                 $class_jcs = new jng_sp_customers_special();
                 if (isset($request['userid']) && $request['userid'] != '') {
                     $q = tep_db_query("SELECT jng_sp_customers_id FROM jng_sp_customers WHERE payone_userid=" . $request['userid']);
                     if (tep_db_num_rows($q) > 0) {
                         $cust = tep_db_fetch_array($q);
                         $jng_sp_customers_id = $cust['jng_sp_customers_id'];
                         if (is_null($class_jcs->getCustomerDetail($jng_sp_customers_id))) {
                             $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'];
示例#3
0
if ($customers_id == '') {
    exit;
}
//SUBMIT ACTION
if (isset($_POST['me_action'])) {
    if ($_POST['me_action'] == 'SETSPECIALLIST') {
        $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'] != '') {
<?php

use_class('jng_sp');
$class_sp = new jng_sp();
use_class('jng_sp_customers_special');
$class_jcs = new jng_sp_customers_special();
use_class('jng_sp_customers');
$class_jcust = new jng_sp_customers();
$jng_sp_customers_id = isset($_GET['id']) ? tep_db_prepare_input($_GET['id']) : '';
if ($jng_sp_customers_id == '') {
    exit;
}
$detail = $class_jcs->getCustomerDetail($jng_sp_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_jcs->insertComment($customer_id, $comment, $comment_by);
            //          $comment = $class_jcs->retrieveCommentDetail($comment_id);
            //          $comments = array($comment);
            //          $result = $class_jcs->drawComments($comments, true);
            $result = drawSingleComment($comment_id, $comment_by, time(), $comment);
            echo utf8_encode($result);
        }
示例#5
0
    $javascript .= '
            $("input.iwbutton:eq(0)").focus();
    ';
    $title = 'Sales Partner Order Detail';
} else {
    $order = $class_jo->retrieveDetail($order_id);
    $buttons = '';
    if (count($order) > 1) {
        $order_int_comments = $class_jo->retrieveComments($order_id);
        $sp_detail = $class_sp->retrieveDetail($order['jng_sp_id']);
        $customer = $class_jcust->retrieveDetail(null, $order['jng_sp_id'], $order['customer_billing_id']);
        if (is_null($customer)) {
            $customer_ids = $class_jcust->getFromOrder($order['jng_sp_orders_id']);
            $customer = $class_jcust->retrieveDetail($customer_ids['customer_billing_id']);
        }
        $customer_sl = $class_jcs->getCustomerDetail($customer['jng_sp_customers_id']);
        $order_sl_type = '';
        $order_sl_icon = '';
        if ($customer_sl['list_type'] != '') {
            $crown_img = $class_jcs->getTypeSymbol($customer_sl['list_type'], $customer['jng_sp_customers_id']);
            $order_sl_icon = $crown_img . ' ';
            $order_sl_type = $class_jcs->getTypeName($customer_sl['list_type']);
            if ($order_sl_type != '') {
                $order_sl_type = ' (' . $order_sl_type . ')';
            }
        }
        //GET ORDER DETAIL
        $sp_order_id = $order['order_id'];
        if ($sp_order_id == '') {
            $sp_order_id = '<span style="color:#ccc;">Not online order</span>';
        }