if ($keywords != '') { $filter_array = array(); $kw_array = explode(' ', $keywords); foreach ($kw_array as $kw) { $filter_array[] = " (jsc.customer_firstname LIKE '%{$kw}%' OR jsc.customer_lastname LIKE '%{$kw}%' OR jsc.customer_id='{$kw}')"; } if (count($filter_array) > 0) { $filter = implode(' AND ', $filter_array); } } } $sort = ''; $limit = ROWPERPAGE; $offset = ($page - 1) * $limit; $cust_count = $class_jcust->countTotal($jng_sp_id, $filter); $customers = $class_jcust->retrieveList($jng_sp_id, $filter, $sort, $limit, $offset); $content = ''; $content .= '<div style="margin-bottom:10px;">'; $content .= '<form name="customers" action="?open=sp-customers" method="post">'; $content .= 'Search for <input type="text" class="iwbutton input" name="keyword" value="' . $keywords . '" />'; $content .= ' <input type="submit" name="submit" value="Go" />'; $content .= '</form></div>'; if (count($customers) == 0) { $content .= '<div class="red>No customer found</div>'; } else { $ctable = array(); $ct = array(); $ct['long_id'] = 'SP ID'; $ct['sort'] = 'Title'; $ct['name'] = 'Name'; $ct['email'] = 'Email';
$clist_template = '<tr class="customer">'; foreach ($clist_headers as $k => $v) { switch ($k) { case 'countpro': $value = '<input type="text" name="qty_per_article" value="1" class="tac" style="width:30px;" />'; break; case 'act': $value = '<span class="ui-icon ui-icon-trash pointer"></span>'; break; default: $value = ' '; } $clist_template .= '<td class="' . $k . ' ui-corner-all">' . $value . '</td>'; } $clist_template .= '</tr>'; $customers = $class_jc->retrieveList($jng_sp_id); $customers_options = array(); foreach ($customers as $c) { $customers_options[$c['jng_sp_customers_id']] = "{$c['customer_firstname']} {$c['customer_lastname']}" . ($c['customer_title'] != '' ? " ({$c['customer_title']})" : ''); } $customers_combo = '<select name="customer" class="input"><option value="0">Please choose...</option>' . loadComboListFromArray($customers_options) . '</select>'; if (isset($_POST['me_action'])) { if ($_POST['me_action'] == 'LOADPRODUCT') { $pid = tep_db_prepare_input($_POST['pid']); $rowclass = $_POST['rowclass']; $product = $class_pm->retrieveDetail($pid, 'p,pnc,pd'); $articles = $class_pa->retrieveList($pid, "active_status='1'"); $articles_options = array(); $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 ? ' ⋅ ' . 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'] . ' ⋅ ' . textLength($a['length']) . '</div>';