Example #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;
}
         //UPDATE PAYONE SALDO
         $payi->payoneSaldo($request['balance']);
     } else {
         $response = "";
     }
     break;
 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');
<?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&amp;type=' . $type . '&amp;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;
 function drawOrderDisplay($order_type, $order_id, $displaypart = 'ALL', $excludecurrentorderinhistory = true)
 {
     //$displaypart = 'ALL' / 'NEW' / 'HISTORY'
     global $class_do, $class_pm, $class_pa, $class_mc, $class_jo, $class_jc, $class_o, $sp_list;
     //ORDERED PRODUCTS DISPLAY SETTING
     $col_limit = 5;
     //max no of columns
     $row_limit = 5;
     //max no of rows
     $border = '1';
     //border width
     $imgsize = '80';
     //image size
     $padding = '5';
     //box padding
     $margin = '10';
     //box margin
     $po_limit = $col_limit * $row_limit;
     //max no of products - auto calc
     $powidth = ceil($col_limit * ($imgsize + 2 * ($border + $padding) + $margin) / 10) * 10;
     $total_price = 0;
     if ($order_type == 'SP') {
         use_class('jng_sp_customers_special');
         $csl = new jng_sp_customers_special();
         $order = $class_jo->retrieveDetail($order_id);
         $order_source = $sp_list[$order['jng_sp_id']]['name'];
         $order_products = $class_jo->retrieveItems($order_id);
         $customer = $class_jc->retrieveDetail(null, $order['jng_sp_id'], $order['customer_billing_id']);
         $list_type = $csl->getListType($customer['jng_sp_customers_id']);
         $cust_crown = $csl->getTypeSymbol($list_type, $customer['jng_sp_customers_id']);
         $customer_name = $cust_crown . $order['customer_billing_firstname'] . ' ' . $order['customer_billing_lastname'];
         $customer_address = $order['customer_billing_address'];
         if ($order['customer_billing_address2'] != '') {
             $customer_address .= ', ' . $order['customer_billing_address2'];
         }
         $customer_address .= ', ' . $order['customer_billing_postcode'];
         $customer_address .= ' ' . $order['customer_billing_city'];
         $customer_address .= ', ' . $order['customer_billing_country'];
         $products_ordered = $class_jc->retrieveOrdersItems($customer['jng_sp_customers_id']);
         $colname_order_id = 'jng_sp_orders_id';
         $colname_items_id = 'jng_sp_orders_items_id';
         $colname_order_date = 'order_date';
         $colname_order_qty = 'order_quantity';
         $colname_return_qty = 'return_quantity';
         $colname_products_id = 'products_id';
         $colname_products_code = 'article_number';
         $colname_articles_id = 'products_articles_id';
         $colname_custom_text1 = null;
         $colname_custom_text2 = null;
         $colname_custom_image = null;
         $order_history_display = null;
         $total_price = getTotalOrderAmount('S', $order_id);
     } elseif ($order_type == 'JG') {
         use_class('customers_special_list');
         $csl = new customers_special_list();
         $order = $class_o->retrieveDetail($order_id);
         $order_source = 'JULIE&amp;GRACE';
         $total_price = getTotalOrderAmount('J', $order_id, $order['currency']);
         $order_products = $class_o->retrieveProducts($order_id);
         //$customer = $class_mc->retrieveDetail($order['customers_id']);
         $list_type = $csl->getListType($order['customers_id']);
         $cust_crown = $csl->getTypeSymbol($list_type, $order['customers_id']);
         $customer_name = $cust_crown . $order['customers_name'];
         $customer_address = '';
         if ($order['customers_company'] != '') {
             $customer_address .= $order['customers_company'] . ', ';
         }
         $customer_address .= $order['customers_street_address'];
         $customer_address .= ', ' . $order['customers_postcode'];
         $customer_address .= ' ' . $order['customers_city'];
         $customer_address .= ', ' . $order['customers_country'];
         $products_ordered = $class_mc->retrieveOrdersProducts($order['customers_id'], 'op.status>0');
         $colname_order_id = 'orders_id';
         $colname_items_id = 'orders_products_id';
         $colname_order_date = 'date_purchased';
         $colname_order_qty = 'products_quantity';
         $colname_return_qty = 'return_quantity';
         $colname_products_id = 'products_id';
         $colname_products_code = 'products_model';
         $colname_articles_id = 'products_articles_id';
         $colname_custom_text1 = 'customers_text_line1';
         $colname_custom_text2 = 'customers_text_line2';
         $colname_custom_image = 'customers_image';
         $order_history_display = null;
     } elseif ($order_type == 'DP') {
         $order = $class_do->retrieveDetail($order_id);
         $product_detail = $class_pm->retrieveDetail($order['products_id'], 'p');
         $order['products_image'] = $product_detail['p']['products_image'];
         $order['products_model'] = $product_detail['p']['products_model'];
         $order['order_item_count'] = '1';
         $order['order_item_total'] = '1';
         $order_products = array();
         $order_products[] = $order;
         $colname_order_id = 'depot_orders_id';
         $colname_items_id = 'depot_orders_id';
         $colname_order_date = 'order_date';
         $colname_order_qty = 'quantity';
         $colname_return_qty = '';
         $colname_products_id = 'products_id';
         $colname_products_code = 'products_model';
         $colname_articles_id = 'articles_id';
         $colname_custom_text1 = null;
         $colname_custom_text2 = null;
         $colname_custom_image = null;
         if ($order['trans_type'] == 'SP' || $order['trans_type'] == 'JG') {
             if ($order['trans_type'] == 'SP') {
                 $item = $class_jo->retrieveItemDetail($order['trans_id']);
                 //if ($item['jng_sp_id'] != '2') {
                 //echo "<pre>";
                 //var_dump($item);
                 //die("ttt");
                 if ($item['stock_status'] == '0') {
                     $order_history_display = drawOrderDisplay($order['trans_type'], $item['jng_sp_orders_id'], 'HISTORY', false);
                 }
                 $total_price = getTotalOrderAmount('S', $item['jng_sp_orders_id']);
                 //}
             } else {
                 //die("test");
                 $item = $class_o->retrieveProductDetail($order['trans_id']);
                 $total_price = getTotalOrderAmount('J', $item['orders_id']);
                 if ($item['stock_status'] == '0') {
                     $order_history_display = drawOrderDisplay($order['trans_type'], $item['orders_id'], 'HISTORY', false);
                 }
             }
         }
     }
     $result = '';
     if ($displaypart == 'ALL' || $displaypart == 'NEW') {
         //NEW ORDER
         $result .= '<h2 style="position:fixed;top:0;left:0;line-height:20px;width:480px;padding:5px 10px;background:#ccc;border-right:1px inset #666;">New ' . $order_type . ' Order ' . $order_id . ' (' . $total_price . ')</h2>';
         //$result .= '<div style="position:fixed;top:30;bottom:0;left:0;width:480px;padding:10px;background:#efefef;border-right:1px inset #666;overflow:auto;">';
         $result .= '<div id="box-order-items" style="position:fixed;top:30;bottom:0;height:93%;left:0;width:480px;padding:10px;background:#efefef;border-right:1px inset #666;overflow:auto;">';
         $neworder = array();
         $no = array();
         $no['l'] = 'No';
         $no['d'] = 'Image';
         $no['t2'] = 'Info';
         $no['q'] = 'Order<br/>Qty.';
         $no['r'] = 'Stock Status<br /> and Actions';
         $neworder[] = $no;
         foreach ($order_products as $op) {
             if ($op[$colname_articles_id] > 0) {
                 $article = $class_pa->retrieveDetail($op[$colname_articles_id]);
                 $prolength = $article['length'];
             } else {
                 $product_detail = $class_pm->retrieveDetail($op[$colname_products_id], 'pnc');
                 $prolength = $product_detail['pnc']['products_length'];
             }
             $customize_info = '';
             if (!is_null($colname_custom_text1) && !is_null($colname_custom_text2)) {
                 if ($op[$colname_custom_text1] != '' || $op[$colname_custom_text2] != '') {
                     $customize_info .= '<div style="margin-top:10px;">';
                     if ($op[$colname_custom_text1] != '') {
                         $customize_info .= $op[$colname_custom_text1];
                     }
                     if ($op[$colname_custom_text2] != '') {
                         $customize_info .= '<br />' . $op[$colname_custom_text2];
                     }
                     $customize_info .= '</div>';
                 }
             }
             if (!is_null($colname_custom_image) && $op[$colname_custom_image] != '') {
                 $customize_info .= webImage($op[$colname_custom_image], '80', '80', 'Custom Image');
             }
             $length_text = $prolength > 0 ? 'Length: ' . textLength($prolength) : '<span class="notice">No Length</span>';
             //$tooltip_data = getTooltipThumbData($op[$colname_products_id], $op[$colname_articles_id], 0);
             $pdata = $class_pm->retrieveDetail($op[$colname_products_id], 'pl,sp');
             $tooltip_text = '<table class="tiny" border="0" cellpadding="0" cellspacing="0" align="center">';
             $tooltip_text .= '<tr><td width="80" title="Sold Last 30 Days">Sold L30D</td><td>' . intval($pdata['pl']['sold_monthly_1']) . ' products</td></tr>';
             $tooltip_text .= '<tr><td>Total sold</td><td>' . intval($pdata['sp']['0']['total_sold']) . ' products</td></tr>';
             $tooltip_text .= '<tr><td>Return Rate</td><td>' . number_format($pdata['sp']['0']['returned_rate'], 1) . '%</td></tr>';
             $tooltip_text .= '<tr><td>Product Age</td><td>' . $pdata['sp']['0']['active_age'] . ' days</td></tr>';
             $tooltip_text .= '</table>';
             $info = array();
             //var_dump($order_type);
             $info[] = $order_type . '-' . $op[$colname_items_id];
             $info[] = $op['products_ean'];
             $info[] = $op[$colname_products_id] . ' / ' . $op[$colname_products_code];
             $info[] = $length_text;
             $info[] = '&nbsp;';
             $info[] = '<strong>All SP Summary</strong>';
             $info[] = $tooltip_text;
             $action_hidden = '<input type="hidden" id="' . $order_type . '-' . $op[$colname_items_id] . '" name="oiid" value="' . $op[$colname_items_id] . '" />';
             $action_hidden .= '<input type="hidden" name="type" value="' . $order_type . '" />';
             $action = array();
             $action[] = stockStatusDisplay($op['stock_status'], $op['status'], $op[$colname_products_id], $op[$colname_articles_id], $op[$colname_order_qty], null);
             $action[] = '&nbsp;';
             if ($op['stock_status'] == 'S') {
                 $action[] = '<input type="button" name="2" value="&raquo; Sourcing" class="bl green" />';
             } elseif ($op['stock_status'] == 'R' || $op['stock_status'] == 'P' || $op['stock_status'] == 'W') {
                 $action[] = '<input type="button" name="3" value="&raquo; Ready" class="bl green" />';
                 //$action[] = '<input type="button" name="test" value="&raquo; Sourcing" class="bl red" />';
             }
             $action[] = '<input type="button" name="10" value="&times; Cancel" class="bl red" />';
             $no = array();
             $no['l'] = $op['order_item_count'] . '/' . $op['order_item_total'];
             $no['d'] = webImage($op['products_image'], '80', '80', 'Product Image') . $customize_info;
             $no['t2'] = implode('<br />', $info);
             if (isset($op['order_quantity'])) {
                 $order_quantity = $op['order_quantity'];
             } elseif (isset($op['products_quantity'])) {
                 $order_quantity = $op['products_quantity'];
             } else {
                 $order_quantity = $op['quantity'];
             }
             $no['q'] = $order_quantity;
             $no['r'] = $action_hidden . implode('<br />', $action);
             $neworder[] = $no;
         }
         $result .= tep_draw_table('spo', $neworder);
         $result .= '<div class="buttons"><input type="button" name="nextorder" value="Next Order" class="button" /></div>';
         $result .= '</div>';
         //NEW ORDER - CLOSER
     }
     if (!is_null($order_history_display)) {
         $result .= $order_history_display;
     } elseif ($displaypart == 'ALL' || $displaypart == 'HISTORY') {
         $result .= '<div style="margin-left:510px;color:#666;" >';
         //HISTORICAL INFO
         if ($order_type == 'DP') {
             $result .= '<h2>DEPOT ' . ($order['trans_type'] == 'AR' ? 'REFILL' : 'MANUAL ORDER') . '</h2>';
         } else {
             //var_dump($order_type);
             $result .= '<h2>Customer Detail</h2>';
             //                    $result .= '<table border="0" cellpadding="0" cellspacing="0">';
             //                    $result .= '<tr><td width="150">Customer From</td><td>'.$order_source.'</td></tr>';
             //                    $result .= '<tr><td>Customer Name</td><td>'.$customer_name.'</td></tr>';
             //                    $result .= '<tr><td>Customer Address</td><td>'.$customer_address.'</td></tr>';
             //                    $result .= '<tr><td></td><td></td></tr>';
             //                    $result .= '</table>';
             $result .= '<div class="bold">' . $order_source . '</div>';
             $result .= '<div>' . $customer_name . '</div>';
             $result .= '<div>' . $customer_address . '</div>';
             $result .= '<div>&nbsp;</div>';
             $orders_collection = array();
             $products_ordered_total = 0;
             $products_returned_total = 0;
             $products_canceled_total = 0;
             $products_inprocess_total = 0;
             foreach ($products_ordered as $pok => $pov) {
                 if ($excludecurrentorderinhistory && $pov[$colname_order_id] == $order[$colname_order_id]) {
                     unset($products_ordered[$pok]);
                 } else {
                     if (!in_array($pov[$colname_order_id], $orders_collection)) {
                         $orders_collection[] = $pov[$colname_order_id];
                     }
                     $products_ordered_total += $pov[$colname_order_qty];
                     $products_returned_total += $pov[$colname_return_qty];
                     if (statusIsCancelled($pov['status'])) {
                         $products_canceled_total += $pov[$colname_order_qty];
                     }
                     if ($pov['status'] < 9) {
                         $products_inprocess_total += $pov[$colname_order_qty];
                     }
                 }
             }
             $result .= '<h2>Customer Historical Info</h2>';
             if ($products_ordered_total > 0) {
                 $products_success_total = $products_ordered_total - ($products_inprocess_total + $products_canceled_total);
                 $return_rate = $products_returned_total == 0 ? 0 : $products_returned_total / $products_success_total * 100;
                 $process_class = $products_inprocess_total > 0 ? 'red' : 'green';
                 $success_class = $products_success_total > 0 ? 'green' : 'red';
                 $return_class = $products_returned_total > 0 ? 'red' : 'green';
                 $return_rate_class = $return_rate <= 10 ? 'green' : 'red';
                 $prevtext = $excludecurrentorderinhistory ? 'Previous' : '';
                 $result .= '<h3>&raquo; Customer ' . $prevtext . ' Orders Total = ' . count($orders_collection) . '</h3>';
                 $result .= '<h3>&raquo; Ordered Products Total = ' . $products_ordered_total . '</h3>';
                 $result .= '<h3>&raquo; Ordered Products Canceled = ' . $products_canceled_total . '</h3>';
                 $result .= '<h3 class="' . $process_class . '">&raquo; Ordered Products in Progress = ' . $products_inprocess_total . '</h3>';
                 $result .= '<h3 class="' . $success_class . '">&raquo; Ordered Products Received = ' . $products_success_total . '</h3>';
                 $result .= '<h3 class="' . $return_class . '">&raquo; Ordered Products Returns = ' . $products_returned_total . '</h3>';
                 $result .= '<h3 class="' . $return_rate_class . '">&raquo; Customer Return Rate = ' . number_format($return_rate, 1) . '%</h3>';
                 $result .= '<h3>&raquo; Recent Ordered Products List (Showing Max ' . $po_limit . ' Products): ' . '</h3>';
                 $result .= '<div style="width:' . $powidth . 'px;">';
                 $pocount = 0;
                 foreach ($products_ordered as $po) {
                     $pocount++;
                     if ($pocount <= $po_limit) {
                         if ($po[$colname_articles_id] > 0) {
                             $article = $class_pa->retrieveDetail($po[$colname_articles_id]);
                             $prolength = $article['length'];
                         } else {
                             $product_detail = $class_pm->retrieveDetail($po[$colname_products_id], 'pnc');
                             $prolength = $product_detail['pnc']['products_length'];
                         }
                         $length_text = $prolength > 0 ? textLength($prolength) : '<span class="notice">No Length</span>';
                         $status = $po['status'] == '8' ? modeName($po['mode']) : statusNameShort($po['status'], true);
                         $status_class = $po['status'] < 9 ? 'red' : 'notice';
                         $qty_class = statusIsCancelled($po['status']) > 0 ? 'notice' : 'green';
                         $result .= '<div style="float:left;border:' . $border . 'px solid #ccc;text-align:center;margin:0 ' . $margin . 'px ' . $margin . 'px 0;padding:' . $padding . 'px;">';
                         $result .= webImage($po['products_image'], $imgsize, $imgsize);
                         $result .= '<br />';
                         $result .= $length_text;
                         $result .= '<br />';
                         $result .= '<span title="Order Date">' . date('d.m.Y', strtotime($po[$colname_order_date])) . '</span>';
                         $result .= '<br />';
                         $result .= '<span class="' . $status_class . '" title="Current Status">' . $status . '</span>';
                         $result .= '<br />';
                         $result .= '<strong class="' . $qty_class . '" title="Order Quantity">+' . intval($po[$colname_order_qty]) . '</strong>';
                         $result .= ' &nbsp; ';
                         $returns = intval($po[$colname_return_qty]);
                         $retclas = $returns > 0 ? 'red' : 'notice';
                         $result .= '<strong class="' . $retclas . '" title="Return Quantity">-' . $returns . '</strong>';
                         $result .= '</div>';
                     }
                 }
                 $result .= '</div>';
                 $result .= '<div style="clear:both;">&nbsp;</div>';
             } else {
                 $result .= '<h3>&raquo; No Order Historical info, a New Customer</h3>';
             }
         }
         $result .= '</div>';
         //HISTORICAL INFO - CLOSER
     }
     return $result;
 }
<?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);
        }
Example #7
0
<?php

use_class('jng_sp_customers');
$class_jcust = new jng_sp_customers();
use_class('jng_sp_customers_special');
$class_jcs = new jng_sp_customers_special();
use_class('jng_sp');
$class_sp = new jng_sp();
use_class('jng_sp_orders');
$class_jo = new jng_sp_orders();
$customers_id = isset($_GET['id']) ? tep_db_prepare_input($_GET['id']) : '';
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);
Example #8
0
<?php

use_class('jng_sp_orders');
use_class('depot_orders');
use_class('jng_sp');
use_class('jng_sp_customers');
use_class('jng_sp_customers_special');
use_class('payone_invoice');
$class_jo = new jng_sp_orders();
$class_do = new depot_orders();
$class_sp = new jng_sp();
$class_jcust = new jng_sp_customers();
$class_jcs = new jng_sp_customers_special();
//SUBMIT ACTION
if (isset($_POST['me_action'])) {
    if ($_POST['me_action'] == 'ADDNEWCOMMENT') {
        $order_id = tep_db_prepare_input($_POST['order_id']);
        $comment = tep_db_prepare_input($_POST['comment']);
        $comment_by = $session_userinfo['username'];
        $comment_id = $class_jo->insertComment($order_id, $comment, $comment_by);
        //$comment = $class_jo->retrieveCommentDetail($comment_id);
        //$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);