$articles_options[] = '<div id="' . $pid . '-0-' . $product['p']['products_ean'] . '" class="article pointer" title="Click to toggle order for this article">' . 'EAN ' . $product['p']['products_ean'] . ($product['pnc']['products_length'] > 0 ? ' &sdot; ' . textLength($product['pnc']['products_length']) : '') . '</div>';
     foreach ($articles as $a) {
         $articles_options[] = '<div id="' . $pid . '-' . $a['products_articles_id'] . '-' . $a['products_ean'] . '" class="article pointer" title="Click to toggle order for this article">' . 'EAN ' . $a['products_ean'] . ' &sdot; ' . textLength($a['length']) . '</div>';
     }
     $product_image = webImage($product['p']['products_image'], IMAGE_SIZE_THUMBNAIL_1, IMAGE_SIZE_THUMBNAIL_1, 'Product ' . $pid, '');
     $ajaxResult = array();
     $ajaxResult['pid'] = $pid;
     $ajaxResult['image'] = $product_image;
     $ajaxResult['desc'] = '<a href="?open=product-detail&amp;products_id=' . $pid . '" target="_blank" title="View / Manage Product Detail">' . $pid . ' / ' . $product['p']['products_model'] . '</a>';
     $ajaxResult['desc'] .= '<br />' . $product['pd']['2']['products_name'];
     $ajaxResult['arts'] = implode('', $articles_options);
     echo ajaxReturn($ajaxResult);
     exit;
 } elseif ($_POST['me_action'] == 'LOADCUSTADDRESS') {
     $jng_sp_customers_id = tep_db_prepare_input($_POST['jng_sp_customers_id']);
     $cust_addresses = $class_jc->getAddresses($jng_sp_customers_id);
     $address_options = array();
     foreach ($cust_addresses as $ca) {
         $address_options[$ca['address_id']] = $ca['city'] . ', ' . $ca['address'];
     }
     $ajaxResult = array();
     $ajaxResult['row_index'] = $_POST['row_index'];
     $ajaxResult['address_combo'] = '<select name="cust-address" class="input2"><option value="0">Please choose...</option>' . loadComboListFromArray($address_options) . '</select>';
     ajaxReturn($ajaxResult);
     exit;
 } elseif ($_POST['me_action'] == 'CREATEORDERS') {
     if (is_array($_POST['customers']) && is_array($_POST['articles'])) {
         $timestamp = date('Y-m-d H:i:s');
         $orders_created_collection = array();
         $orders_created = 0;
         $products_created = 0;
}
//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;">';
if (is_null($customer_special)) {
    $form .= '<form name="customer_special_list" action="?open=sp-customer&id=' . $customer['jng_sp_customers_id'] . '" method="post">';
    $form .= '<input type="hidden" name="me_action" value="SETSPECIALLIST" />';
    $form .= '<input type="hidden" name="customer_id" value="' . $customer['jng_sp_customers_id'] . '" />';
    $form .= '<input type="submit" name="submit" value="Upgrade as VIP" />';
    $form .= '<input type="submit" name="submit" value="Add to Blacklist" />';