cretbogdan Posted December 10, 2013 Posted December 10, 2013 I am trying to add a button to orders page , in order to check quicker all orders of the customer . I added the button , but I can't get the cID to display all orders of the customer . <?php echo tep_draw_button(IMAGE_ORDERS, 'document', tep_href_link(FILENAME_ORDERS, 'cID=' . $HTTP_GET_VARS['cID'])) .tep_draw_button(IMAGE_ORDERS_INVOICE, 'document', tep_href_link(FILENAME_ORDERS_INVOICE, 'oID=' . $HTTP_GET_VARS['oID']), null, array('newwindow' => true)) . tep_draw_button(IMAGE_ORDERS_PACKINGSLIP, 'document', tep_href_link(FILENAME_ORDERS_PACKINGSLIP, 'oID=' . $HTTP_GET_VARS['oID']), null, array('newwindow' => true)) . tep_draw_button(IMAGE_BACK, 'triangle-1-w', tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('action')))); ?></td> I always get this url http://www.mysite/admin123123/orders.php?cID= As you can see the cID is missing . Any help would be very good Thanks ...
Bob Terveuren Posted December 10, 2013 Posted December 10, 2013 Hi You need to grab the customers_id from the order to use as cID - so arround line 337 orders_query_raw add customers_id so: $orders_query_raw = "select o.orders_id, o.customers_id,o.customers_name, o.payment_method, o.date_purchased, o.last_modified, o.currency, o.currency_value, s.orders_status_name, ot.text as order_total from " . TABLE_ORDERS . " o left join " . TABLE_ORDERS_TOTAL . " ot on (o.orders_id = ot.orders_id), " . TABLE_ORDERS_STATUS . " s where o.orders_status = s.orders_status_id and s.language_id = '" . (int)$languages_id . "' and ot.class = 'ot_total' order by o.orders_id DESC"; Then use that further down to create a button: default: if (isset($oInfo) && is_object($oInfo)) { $heading[] = array('text' => '<strong>[' . $oInfo->orders_id . '] ' . tep_datetime_short($oInfo->date_purchased) . '</strong>'); $contents[] = array('align' => 'center', 'text' => tep_draw_button(IMAGE_EDIT, 'document', tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('oID', 'action')) . 'oID=' . $oInfo->orders_id . '&action=edit')) . //new button tep_draw_button(IMAGE_EDIT, 'document', tep_href_link(FILENAME_ORDERS, 'cID=' . $oInfo->customers_id )) . //new button tep_draw_button(IMAGE_DELETE, 'trash', tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('oID', 'action')) . 'oID=' . $oInfo->orders_id . '&action=delete'))); $contents[] = array('align' => 'center', 'text' => tep_draw_button(IMAGE_ORDERS_INVOICE, 'document', tep_href_link(FILENAME_ORDERS_INVOICE, 'oID=' . $oInfo->orders_id), null, array('newwindow' => true)) . tep_draw_button(IMAGE_ORDERS_PACKINGSLIP, 'document', tep_href_link(FILENAME_ORDERS_PACKINGSLIP, 'oID=' . $oInfo->orders_id), null, array('newwindow' => true))); $contents[] = array('text' => '<br />' . TEXT_DATE_ORDER_CREATED . ' ' . tep_date_short($oInfo->date_purchased)); if (tep_not_null($oInfo->last_modified)) $contents[] = array('text' => TEXT_DATE_ORDER_LAST_MODIFIED . ' ' . tep_date_short($oInfo->last_modified)); $contents[] = array('text' => '<br />' . TEXT_INFO_PAYMENT_METHOD . ' ' . $oInfo->payment_method); } break;
cretbogdan Posted December 10, 2013 Author Posted December 10, 2013 I made the changes to the code , but still don't get the cID . Could you please take a look , I am doing something wrong ? <?php /* $Id$ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2010 osCommerce Released under the GNU General Public License */ require('includes/application_top.php'); if (isset($_GET['osCAdminID'])) $osc_admin_id='&osCAdminID=' . $_GET['osCAdminID']; require(DIR_WS_CLASSES . 'currencies.php'); $currencies = new currencies(); $orders_statuses = array(); $orders_status_array = array(); $orders_status_query = tep_db_query("select orders_status_id, orders_status_name from " . TABLE_ORDERS_STATUS . " where language_id = '" . (int)$languages_id . "'"); while ($orders_status = tep_db_fetch_array($orders_status_query)) { $orders_statuses[] = array('id' => $orders_status['orders_status_id'], 'text' => $orders_status['orders_status_name']); $orders_status_array[$orders_status['orders_status_id']] = $orders_status['orders_status_name']; } $action = (isset($HTTP_GET_VARS['action']) ? $HTTP_GET_VARS['action'] : ''); /***** MODIFY ORDER *****/ // change shipping method if (isset($_POST['change_shipping_method']) && isset($_GET['oID']) && is_numeric($_POST['shipping_cost'])) { $_POST['shipping_method']; $_POST['shipping_cost']; $sub_total_query=tep_db_query("select value from orders_total where orders_id='" . $_GET['oID'] . "' and class='ot_subtotal'"); $sub_total=tep_db_fetch_array($sub_total_query); $total=$sub_total['value']+$_POST['shipping_cost']; tep_db_query("update orders_total set title='" . tep_db_input($_POST['shipping_method']) . "', text='" . number_format($_POST['shipping_cost'], 2, '.', ',') . " RON', value='" . number_format($_POST['shipping_cost'], 4, '.', ',') . "' where orders_id='" . $_GET['oID'] . "' and class='ot_shipping'"); tep_db_query("update orders_total set text='<strong>" . number_format($total, 2, '.', ',') . " RON</strong>', value='" . number_format($total, 4, '.', ',') . "' where orders_id='" . $_GET['oID'] . "' and class='ot_total'"); tep_redirect(tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('action')) . 'action=edit')); } if(isset($HTTP_GET_VARS['newqty']) && $HTTP_GET_VARS['newqty']!="") { // echo 'schimbare pe cantitate'; $oID = tep_db_prepare_input($HTTP_GET_VARS['oID']); $qty=$HTTP_GET_VARS['newqty']; $opid=$HTTP_GET_VARS['pid']; //citim vechea cantitate pentru produsul la care vrem sa modificam cantitatea $product_info_pricee = tep_db_query( "select products_quantity , products_price from ". TABLE_ORDERS_PRODUCTS." where orders_products_id='" .(int) $opid."' and orders_id = '".(int) $oID."'" ); $product_info_pricef = tep_db_fetch_array($product_info_pricee); if($product_info_pricef['products_quantity']) { //numarul produselor adaugate este $nrprad=(int) $qty - (int)$product_info_pricef['products_quantity']; $costprad= ($product_info_pricef['products_price'] ) * ( $nrprad); } //modificam cantitatea in tabela de produse ale comenzii tep_db_query("update " . TABLE_ORDERS_PRODUCTS . " set products_quantity = '" . $qty . "' where orders_products_id='" .(int) $opid."' and orders_id = '".(int) $oID."'"); //modificam totalul...si subtotalul //adaugam la subtotal pretul produselor comandate $atotal_order1 = tep_db_query("select o.value from orders_total o where o.orders_id='" .(int) $oID."' and o.title= 'Sub-Total:'"); $atotal_order2 = tep_db_fetch_array($atotal_order1); $acost=$atotal_order2['value']; $acost+=$costprad; $acost=number_format($acost, 2, '.', ','); tep_db_query("update " . orders_total . " set value = '" . $acost . "' where orders_id='" .(int)$oID."' and title= 'Sub-Total:'"); $cost_subt=$acost . ' RON'; tep_db_query("update " . orders_total . " set text = '" . $cost_subt."' where orders_id='" .(int) $oID."' and title ='Sub-Total:'"); //apoi adaugam la costul total ,pretul produsului comandat $total_order1 = tep_db_query("select o.value from orders_total o where o.orders_id='" .(int) $oID ."' and o.title= 'Total:'"); $total_order2 = tep_db_fetch_array($total_order1); $cost=$total_order2['value']; $cost+=( $costprad ) ; $cost=number_format($cost, 2, '.', ','); tep_db_query("update " . orders_total . " set value = '" . $cost . "' where orders_id='" .(int) $oID."' and title = 'Total:'"); $cost_tot='<strong>' . $cost . ' RON</strong>'; tep_db_query("update " . orders_total . " set text = '" . $cost_tot."' where orders_id='" .(int)$oID."' and title ='Total:'"); tep_redirect(tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('action', 'pid', 'newqty')) . 'action=edit')); } if(isset($HTTP_GET_VARS['mydropdowntva']) && $HTTP_GET_VARS['mydropdowntva']!=""){ // echo ' schimbare pe tva'; $newprodid=$HTTP_GET_VARS['prodid']; if(strcmp((int)$HTTP_GET_VARS['mydropdowntva'] , (int)"24" )==0) { //echo 'setare pe 24%'; tep_db_query("update " . TABLE_PRODUCTS . " set TVA = 24 where products_id = '" . (int) $newprodid . "'"); } else { //echo 'setare pe 9 %'; tep_db_query("update " . TABLE_PRODUCTS . " set TVA = 9 where products_id = '" . (int) $newprodid . "'"); } } if( isset($HTTP_GET_VARS['taxaex']) ){ echo 'schimbare pe taxa expediere'; $oID = tep_db_prepare_input($HTTP_GET_VARS['oID']); $numenouataxa=tep_db_prepare_input($HTTP_GET_VARS['taxaex']); $costtaxa2=tep_db_prepare_input($HTTP_GET_VARS['taxanr']); $costtaxa=(float) $costtaxa2; if($numenouataxa == ("Posta Romana (Taxa expediere ):" )) { // echo 'setare pe Posta romana cu costl costtaxa '.$oID.' ai'; tep_db_query("update orders_total set text ='". $costtaxa." RON ',value = '". $costtaxa."' ,title='Posta Romana (Taxa expediere ):' where orders_id= '" . (int) $oID . "' and title like '%Taxa expediere%'"); //apoi adaugam la costul total ,pretul produsului comandat $total_order1 = tep_db_query("select o.value from orders_total o where o.orders_id='" .(int) $oID ."' and o.title= 'Sub-Total:'"); $total_order2 = tep_db_fetch_array($total_order1); $cost=$total_order2['value']; $cost+=$costtaxa; tep_db_query("update " . orders_total . " set value = '" . $cost . "' where orders_id='" .(int) $oID."' and title = 'Total:'"); $cost_tot='<strong>' . number_format($cost, 2, '.', ',') . ' RON</strong>'; tep_db_query("update " . orders_total . " set text = '" . $cost_tot."' where orders_id='" .(int)$oID."' and title ='Total:'"); } else { // echo 'heeree curierat'; // echo 'setare pe Curierat rapid cu costul introdus '.$oID.' ai'; // tep_db_query("update " . TABLE_PRODUCTS . " set TVA = 9 where products_id = '" . (int) $newprodid . "'"); tep_db_query("update orders_total set text = '".$costtaxa ." RON' ,value =' ".$costtaxa ."', title='Curierat rapid (Taxa expediere):' where orders_id= '" . (int) $oID . "' and title like '%Taxa expediere%'"); $total_order1 = tep_db_query("select o.value from orders_total o where o.orders_id='" .(int) $oID ."' and o.title= 'Sub-Total:'"); $total_order2 = tep_db_fetch_array($total_order1); $cost=$total_order2['value']; //echo 'cost '.$cost .' cost'; $cost+=$costtaxa ; tep_db_query("update " . orders_total . " set value = '" . $cost . "' where orders_id='" .(int) $oID."' and title = 'Total:'"); $cost_tot='<strong>' . number_format($cost, 2, '.', ',') . ' RON</strong>'; tep_db_query("update " . orders_total . " set text = '" . $cost_tot."' where orders_id='" .(int)$oID."' and title ='Total:'"); } } if( isset($HTTP_GET_VARS['newprice']) ){ $oID = tep_db_prepare_input($HTTP_GET_VARS['oID']); $price = $_GET['old']; $pricenew=$HTTP_GET_VARS['newprice']; $prodid = $HTTP_GET_VARS['pid']; $prodid2=$HTTP_GET_VARS['pid2']; $atotal_order1 = tep_db_query("select o.products_price ,o.products_quantity from orders_products o where o.orders_products_id ='" .(int)$prodid2 ."' and o.orders_id= '".$oID."'"); $atotal_order2 = tep_db_fetch_array($atotal_order1); tep_db_query("update orders_products set products_price = '" . $pricenew . "' , final_price ='" . $pricenew . "' where orders_products_id = '" .$prodid2 . "'"); //interogare pentru aflarea pretului total , respectiv subtotal , pentru ca apoi sa se scada Cantitate * pretnou - pret vechi in modul $sumadif = ($pricenew - $atotal_order2 ['products_price']) * $atotal_order2 ['products_quantity'] ; // echo 'cost prod '. $cost_prod; $total_ordera = tep_db_query("select o.value from orders_total o where o.orders_id='" .(int) $oID ."' and o.title= 'Sub-Total:'"); $total_orderb = tep_db_fetch_array($total_ordera); $val=$total_orderb['value']+$sumadif; // echo 'val '. $val; tep_db_query("update " . orders_total . " set value = '" . $val . "' where orders_id='" .(int) $oID."' and title= 'Sub-Total:'"); $cost_subt=number_format($val, 2, '.', ',') . ' RON'; tep_db_query("update " . orders_total . " set text = '" . $cost_subt."' where orders_id='" .(int) $oID."' and title ='Sub-Total:'"); //apoi vom scadea de la costul total ,pretul produsului comandat $total_orderc = tep_db_query("select o.value from orders_total o where o.orders_id='" .(int) $oID ."' and o.title= 'Total:'"); $total_orderd = tep_db_fetch_array($total_orderc); $val2=$total_orderd['value']+ $sumadif; tep_db_query("update " . orders_total . " set value = '" . $val2 . "' where orders_id='" .(int) $oID."' and title = 'Total:'"); $cost_tot='<strong>' . number_format($val2, 2, '.', ',') . ' RON</strong>'; tep_db_query("update " . orders_total . " set text = '" . $cost_tot."' where orders_id='" .(int) $oID."' and title ='Total:'"); tep_redirect(tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('action', 'newprice', 'pid')) . 'action=edit')); } /***** MODIFY ORDER EOF *****/ if (tep_not_null($action)) { switch ($action) { case 'update_order': $oID = tep_db_prepare_input($HTTP_GET_VARS['oID']); $status = tep_db_prepare_input($HTTP_POST_VARS['status']); $comments = tep_db_prepare_input($HTTP_POST_VARS['comments']); $email_status_query = tep_db_query("select orders_status_name from " . TABLE_ORDERS_STATUS . " where language_id = '" . (int)$_POST['email_language'] . "'"); if (tep_db_num_rows($email_status_query)==1) { $email_status=tep_db_fetch_array($email_status_query); $email_status=stripslashes($email_status['orders_status_name']); } else { $email_status=$orders_status_array[$status]; } $order_updated = false; $check_status_query = tep_db_query("select customers_name,customers_domeniu, customers_email_address, orders_status, date_purchased from " . TABLE_ORDERS . " where orders_id = '" . (int)$oID . "'"); $check_status = tep_db_fetch_array($check_status_query); if ( ($check_status['orders_status'] != $status) || tep_not_null($comments)) { if (tep_db_input($status)!=0) { tep_db_query("update " . TABLE_ORDERS . " set orders_status = '" . tep_db_input($status) . "', last_modified = now() where orders_id = '" . (int)$oID . "'"); } $customer_notified = '0'; if (isset($HTTP_POST_VARS['notify']) && ($HTTP_POST_VARS['notify'] == 'on')) { $notify_comments = ''; $selected_lang_query=tep_db_query("select directory from languages where languages_id='" . (int)$_POST['email_language'] . "'"); if (tep_db_num_rows($selected_lang_query)==1) { $selected_lang=tep_db_fetch_array($selected_lang_query); require(DIR_WS_LANGUAGES . 'orders_' . $selected_lang['directory'] . '.php'); } else { require(DIR_WS_LANGUAGES . 'orders_romana.php'); } if ($comments) { $notify_comments = sprintf(LN_EMAIL_TEXT_COMMENTS_UPDATE, $comments) . "\n"; } $email = STORE_NAME . "\n" . LN_EMAIL_SEPARATOR . "\n" . LN_EMAIL_TEXT_ORDER_NUMBER . ' ' . $oID . "\n" . LN_EMAIL_TEXT_INVOICE_URL . ' ' . tep_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, 'order_id=' . $oID, 'SSL') . "\n" . LN_EMAIL_TEXT_DATE_ORDERED . ' ' . tep_date_long($check_status['date_purchased']) . "\n\n" . sprintf(LN_EMAIL_TEXT_STATUS_UPDATE, $email_status) . $notify_comments; tep_mail($check_status['customers_name'], $check_status['customers_email_address'], LN_EMAIL_TEXT_SUBJECT, $email, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS); $customer_notified = '1'; } tep_db_query("insert into " . TABLE_ORDERS_STATUS_HISTORY . " (orders_id, orders_status_id, date_added, customer_notified, comments) values ('" . (int)$oID . "', '" . tep_db_input($status) . "', now(), '" . tep_db_input($customer_notified) . "', '" . tep_db_input($comments) . "')"); $order_updated = true; } if ($order_updated == true) { $messageStack->add_session(SUCCESS_ORDER_UPDATED, 'success'); } else { $messageStack->add_session(WARNING_ORDER_NOT_UPDATED, 'warning'); } tep_redirect(tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('action')) . 'action=edit')); break; case 'updateqty': $oID = tep_db_prepare_input($HTTP_GET_VARS['oID']); $qty = $_GET['newqty']; $qty2=$HTTP_GET_VARS['newqty']; $array = Array(); break; case 'deleteconfirm': $oID = tep_db_prepare_input($HTTP_GET_VARS['oID']); tep_remove_order($oID, $HTTP_POST_VARS['restock']); tep_redirect(tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('oID', 'action')))); break; case 'deleteprod': $oID = tep_db_prepare_input($HTTP_GET_VARS['oID']); $prid=$HTTP_GET_VARS['pid']; //vom scadea de la subtotal pretul produselor sterse $atotal_order1 = tep_db_query("select o.products_id,o.products_name,o.products_price ,o.products_quantity from orders_products o where o.orders_products_id ='" .(int)$prid ."' and o.orders_id= '".$oID."'"); $atotal_order2 = tep_db_fetch_array($atotal_order1); $cost_prod=($atotal_order2['products_price'] *$atotal_order2['products_quantity']); $total_ordera = tep_db_query("select o.value from orders_total o where o.orders_id='" .(int) $oID ."' and o.title= 'Sub-Total:'"); $total_orderb = tep_db_fetch_array($total_ordera); $val=$total_orderb['value']-$cost_prod; tep_db_query("update " . orders_total . " set value = '" . $val . "' where orders_id='" .(int) $oID."' and title= 'Sub-Total:'"); $cost_subt=number_format($val, 2, '.', ',') . ' RON'; tep_db_query("update " . orders_total . " set text = '" . $cost_subt."' where orders_id='" .(int) $oID."' and title ='Sub-Total:'"); //apoi vom scadea de la costul total ,pretul produsului comandat $total_orderc = tep_db_query("select o.value from orders_total o where o.orders_id='" .(int) $oID ."' and o.title= 'Total:'"); $total_orderd = tep_db_fetch_array($total_orderc); $val2=$total_orderd['value']-($cost_prod); tep_db_query("update " . orders_total . " set value = '" . $val2 . "' where orders_id='" .(int) $oID."' and title = 'Total:'"); $cost_tot='<strong>' . number_format($val2, 2, '.', ',') . ' RON</strong>'; tep_db_query("update " . orders_total . " set text = '" . $cost_tot."' where orders_id='" .(int) $oID."' and title ='Total:'"); //se sterge proodusul tep_db_query("delete from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . (int)$oID. "' and orders_products_id='".(int)$prid."'"); tep_redirect(tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('action', 'pid')) . 'action=edit')); break; case 'stergefact': $oID = tep_db_prepare_input($HTTP_GET_VARS['oID']); $querystg = tep_db_query("select * from invoices where order_id = '" . (int)$oID . "'"); $querystg2 = mysql_numrows( $querystg); if($querystg2 != 1) { echo 'Nu exista factura pentru aceasta comanda'; } else { echo 'Se sterge factura...'; tep_db_query("delete from invoices where order_id = '" . (int)$oID . "'"); } tep_redirect(tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('action')) . 'action=edit')); break; } } if (($action == 'edit') && isset($HTTP_GET_VARS['oID'])) { $oID = tep_db_prepare_input($HTTP_GET_VARS['oID']); $orders_query = tep_db_query("select orders_id from " . TABLE_ORDERS . " where orders_id = '" . (int)$oID . "'"); $order_exists = true; if (!tep_db_num_rows($orders_query)) { $order_exists = false; $messageStack->add(sprintf(ERROR_ORDER_DOES_NOT_EXIST, $oID), 'error'); } } include(DIR_WS_CLASSES . 'order.php'); require(DIR_WS_INCLUDES . 'template_top.php'); ?> <table border="0" width="100%" cellspacing="0" cellpadding="2"> <? if (($action == 'edit') && ($order_exists == true)) { $order = new order($oID); ?> <tr> <td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td class="pageHeading"><?php echo HEADING_TITLE; ?></td> <td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', 1, HEADING_IMAGE_HEIGHT); ?></td> <td class="smallText" align="right"><a href="http://www.ecig-vapo.com/admin/customers.php?search=">Istoric comenzi</a><?php echo tep_draw_button(IMAGE_ORDERS_INVOICE, 'document', tep_href_link(FILENAME_ORDERS_INVOICE, 'oID=' . $HTTP_GET_VARS['oID']), null, array('newwindow' => true)).tep_draw_button(IMAGE_EDIT, 'document', tep_href_link(FILENAME_ORDERS, 'cID=' . $oInfo->customers_id )) . tep_draw_button(IMAGE_ORDERS_PACKINGSLIP, 'document', tep_href_link(FILENAME_ORDERS_PACKINGSLIP, 'oID=' . $HTTP_GET_VARS['oID']), null, array('newwindow' => true)) . tep_draw_button(IMAGE_BACK, 'triangle-1-w', tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('action')))); ?></td> </tr> </table></td> </tr> <tr> <td><table width="100%" border="0" cellspacing="0" cellpadding="2"> <tr> <td colspan="3"><?php echo tep_draw_separator(); ?></td> </tr> <tr> <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="2"> <tr> <td class="main" valign="top"><strong><?php echo ENTRY_CUSTOMER; ?></strong></td> <td class="main"><?php echo tep_address_format($order->customer['format_id'], $order->customer, 1, '', '<br />'); ?></td> </tr> <tr> <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '5'); ?></td> </tr> <tr> <td class="main"><strong><?php echo ENTRY_TELEPHONE_NUMBER; ?></strong></td> <td class="main"><?php echo $order->customer['telephone']; ?></td> </tr> <tr> <td class="main"><strong><?php echo ENTRY_EMAIL_ADDRESS; ?></strong></td> <td class="main"><?php echo '<a href="mailto:' . $order->customer['email_address'] . '"><u>' . $order->customer['email_address'] . '</u></a>'; ?></td> </tr> </table></td> <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="2"> <tr> <td class="main" valign="top"><strong><?php echo ENTRY_SHIPPING_ADDRESS; ?></strong></td> <td class="main"><?php echo tep_address_format($order->delivery['format_id'], $order->delivery, 1, '', '<br />'); ?></td> </tr> <? $oID= $HTTP_GET_VARS['oID']; ?> </table></td> <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="2"> <tr> <td class="main" valign="top"><strong><?php echo ENTRY_BILLING_ADDRESS; ?></strong></td> <td class="main"><?php echo tep_address_format($order->billing['format_id'], $order->billing, 1, '', '<br />'); ?></td> </tr> </table></td> </tr> <tr> <td> <a href="shipping-billing.php?action=customer&oID=<?php echo $oID . $osc_admin_id; ?>" style="text-decoration:none;"><button type="button">Modifica date client</button></a> </td> <td> <a href="shipping-billing.php?action=shipping&oID=<?php echo $oID . $osc_admin_id; ?>" style="text-decoration:none;"><button type="button">Modifica date livrare</button></a> </td> <td> <a href="shipping-billing.php?action=billing&oID=<?php echo $oID . $osc_admin_id; ?>" style="text-decoration:none;"><button type="button">Modifica date facturare</button></a> </td> </tr> </table></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> </tr> <tr> <td><table border="0" cellspacing="0" cellpadding="2"> <tr> <td class="main"><strong><?php echo ENTRY_PAYMENT_METHOD; ?></strong></td> <td class="main"><?php echo $order->info['payment_method']; ?></td> </tr> <?php if (tep_not_null($order->info['cc_type']) || tep_not_null($order->info['cc_owner']) || tep_not_null($order->info['cc_number'])) { ?> <tr> <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> </tr> <tr> <td class="main"><?php echo ENTRY_CREDIT_CARD_TYPE; ?></td> <td class="main"><?php echo $order->info['cc_type']; ?></td> </tr> <tr> <td class="main"><?php echo ENTRY_CREDIT_CARD_OWNER; ?></td> <td class="main"><?php echo $order->info['cc_owner']; ?></td> </tr> <tr> <td class="main"><?php echo ENTRY_CREDIT_CARD_NUMBER; ?></td> <td class="main"><?php echo $order->info['cc_number']; ?></td> </tr> <tr> <td class="main"><?php echo ENTRY_CREDIT_CARD_EXPIRES; ?></td> <td class="main"><?php echo $order->info['cc_expires']; ?></td> </tr> <?php } ?> </table></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> </tr> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr class="dataTableHeadingRow"> <td class="dataTableHeadingContent">Update Qty</td> <!--<td class="dataTableHeadingContent">TVA</td>--> <td class="dataTableHeadingContent">Pret</td> <td class="dataTableHeadingContent" colspan="2"><?php echo TABLE_HEADING_PRODUCTS; ?></td> <td class="dataTableHeadingContent">StergeProd</td> <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCTS_MODEL; ?></td> <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_TAX; ?></td> <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_PRICE_INCLUDING_TAX; ?></td> <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_TOTAL_INCLUDING_TAX; ?></td> </tr> <?php for ($i=0, $n=sizeof($order->products); $i<$n; $i++) { $product_info_tva1 = tep_db_query( "select TVA from ". TABLE_PRODUCTS." where products_id=" .(int)$order->products[$i]['prodid'] ); $product_info_tva2 = tep_db_fetch_array($product_info_tva1); if ($product_info_tva2['TVA']=="24") $newtva="9%"; else $newtva="24%"; echo ' <tr class="dataTableRow">' . "\n" . '<td class="dataTableContent" valign="top" align="left">'.' <form name = "quant" id= "quant" action="orders.php" method="get"> Qty: <input type="text" name="newqty" id="newqty" size=4 value="'.$order->products[$i]['qty'].'"/> <input type="submit" value="Up" title="Apasa pentru a introduce noua cantitate!" size=4 /> <input type="hidden" id="oID" name="oID" value="'.$oID.'" /> <input type="hidden" id="pid" name="pid" value="'.$order->products[$i]['idp'].'" /> <input type="hidden" id="osCAdminID" name="osCAdminID" value="' . $_GET['osCAdminID'] . '" /> </form> </td>'. '<td> <form name = "upprice" id= "upprice" action="orders.php?action=upprice&pid='.$order->products[$i]['prodid'].'&oID='.$oID.$osc_admin_id.'" method="get"> Pret: <input type="text" name="newprice" id="newprice" size=4 value="'.round($order->products[$i]['final_price'] ,2).'"/>Ron <input type="submit" value="Up" title="Apasa pentru a introduce noul pret!" size=4 /> <input type="hidden" id="oID" name="oID" value="'.$oID.'" /> <input type="hidden" id="pid" name="pid" value="'.$order->products[$i]['prodid'].'" /> <input type="hidden" id="pid2" name="pid2" value="'.$order->products[$i]['idp'].'" /> <input type="hidden" id="osCAdminID" name="osCAdminID" value="' . $_GET['osCAdminID'] . '" /> </form> </td>'. '<td class="dataTableContent" valign="top" align="right">' . $order->products[$i]['qty'] . ' x</td>' . "\n" . '<td class="dataTableContent" valign="top">' . $order->products[$i]['name']; if (isset($order->products[$i]['attributes']) && (sizeof($order->products[$i]['attributes']) > 0)) { for ($j = 0, $k = sizeof($order->products[$i]['attributes']); $j < $k; $j++) { echo '<br /><nobr><small> <i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . $order->products[$i]['attributes'][$j]['value']; if ($order->products[$i]['attributes'][$j]['price'] != '0') echo ' (' . $order->products[$i]['attributes'][$j]['prefix'] . $currencies->format($order->products[$i]['attributes'][$j]['price'] * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . ')'; echo '</i></small></nobr>'; } } echo ' </td>' . "\n" . ' <td class="dataTableContent" valign="top" align="left">' . '<a href= "orders.php?action=deleteprod&pid='.$order->products[$i]['idp'].'&oID='.$oID.$osc_admin_id.'" style="text-decoration:none;"><button type="button">Sterge</button></a></td>'. ' <td class="dataTableContent" valign="top">' . $order->products[$i]['model'] . '</td>' . "\n" . ' <td class="dataTableContent" align="right" valign="top">' . tep_display_tax_value($order->products[$i]['tax']) . '%</td>' . "\n" . ' <td class="dataTableContent" align="right" valign="top"><strong>' . $currencies->format(tep_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax'], true), true, $order->info['currency'], $order->info['currency_value']) . '</strong></td>' . "\n" . ' <td class="dataTableContent" align="right" valign="top"><strong>' . $currencies->format(tep_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax'], true) * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . '</strong></td>' . "\n"; echo ' </tr>' . "\n"; } ?> <tr> <td align="left" colspan="3"> <form name="prodnew" id ="prodnew" action="newproduct.php?action=new&oID=<?php echo $oID . $osc_admin_id; ?>" method="post"> <input type="submit" value="Produs Nou" title="Apasa pentru a introduce un nou produs!"/> </form> </td> <td align="right" colspan="9"> <table border="0" cellspacing="0" cellpadding="2" style="float:right;"> <?php for ($i = 0, $n = sizeof($order->totals); $i < $n; $i++) { echo ' <tr>' . "\n" . ' <td align="right" class="smallText">' . $order->totals[$i]['title'] . '</td>' . "\n" . ' <td align="right" class="smallText">' . $order->totals[$i]['text'] . '</td>' . "\n" . ' </tr>' . "\n"; } ?> </table> <script type="text/javascript"> $(document).ready(function(){ $('.shipping_method').change(function(){ $val=$('.shipping_method option:selected').attr('id'); $val=$val.split('_'); $val=$val[0]; $('[name=shipping_cost]').val($val); }); }); </script> <table style="float:right; margin-right:20px;"> <tr><td>Modifica metoda de livrare:</td></tr> <tr> <td> <form name="shipping_method_form" method="post" action="orders.php?oID=<?php echo $oID . $osc_admin_id; ?>"> <input name="shipping_method" type="text" value="metoda de livrare" style="width:150px;" /> <input name="shipping_cost" type="text" value="cost" style="width:50px;" /> <input type="submit" value="Modifica" name="change_shipping_method" /> </form> </td> </tr> </table> </td> </tr> </table></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> </tr> <tr> <td align = "left"> <table><tr> <td> <? //se verifica daca exista deja o factura pentru comanda curenta $verif_invoice_num = tep_db_query("select serie, invoice_numb, invoice_date, invoice_data_id from invoices where order_id='" .(int) $oID ."' "); $verif_invoice_num2 = tep_db_fetch_array($verif_invoice_num); if($verif_invoice_num2['invoice_numb']) { $numarfactura=$verif_invoice_num2['invoice_numb']; $serie=$verif_invoice_num2['serie']; $invoice_date=date('d-m-Y', strtotime($verif_invoice_num2['invoice_date'])); // echo 'exista factura pentru comanda asta!'; } else { //echo 'nu exista fact pt comanda asta'; $verif_invoice_num = tep_db_query("select max( invoice_numb) as numb from invoices"); $verif_invoice_num2 = tep_db_fetch_array($verif_invoice_num); if ($verif_invoice_num2['numb'] != "") $numarfactura =$verif_invoice_num2['numb'] ; $numarfactura ++; // echo 'facturanoua '.strlen($numarfactura); $invoice_date=date('d-m-Y'); } $length=strlen($numarfactura); $lungime=$numarfactura; $z=$length; while ($z<7) { $lungime="0".$lungime; $z++; } if ($serie != '') { $serieaux = $serie; } else { $serieaux="VI"; } $invoice_data_sets_query=tep_db_query("select invoice_data_id, invoice_data_title from invoice_data"); $select='Date facturare: <select name="invoice_data_id">'; while ($invoice_data_set=tep_db_fetch_array($invoice_data_sets_query)) { if ($invoice_data_set['invoice_data_id']==$verif_invoice_num2['invoice_data_id']) $selected=' selected="selected"'; else $selected=' '; $select.='<option value="' . $invoice_data_set['invoice_data_id'] . '"' . $selected . '>' . tep_db_prepare_input($invoice_data_set['invoice_data_title']) . '</option>'; } $select.='</select><br />'; echo 'Genereaza factura aferenta <br>'; echo '<form name="factura" id ="factura" action="factura.php" method="get"> Serie: <input type="text" id ="serie" name="serie" value="'.$serieaux.'" size="5"/><br /> Numar: <input type="text" id ="nf" name="nf" value="'.$lungime.'" size="10"/><br /> Data(zi-an-luna):<input type="text" id ="nf" name="data_fact" value="'.$invoice_date.'" size="10"/><br />' . $select . '<input type="hidden" id="oID" name="oID" value="'.$oID.'" />'; if ($_GET['osCAdminID']) echo '<input type="hidden" id="osCAdminID" name="osCAdminID" value="' . $_GET['osCAdminID'] . '" />'; echo '<input type="submit" value="Genereaza factura" title = "Apasa pentru a genera factura!"/> </form></td>'; ?> </td> <td style="width:50px;"></td> <!--<td> <?php $chit_query=tep_db_query("select id_chitanta from chitante where orders_id='" . tep_db_prepare_input($_GET['oID']) . "'"); if (tep_db_num_rows($chit_query)==1) { $chit=tep_db_fetch_array($chit_query); $chit_nr=$chit['id_chitanta']; $nr_zeros=6-strlen($chit['id_chitanta']); for ($i=0; $i<$nr_zeros; $i++) { $chit_nr='0' . $chit_nr; } ?> Chitanta generata: <?php echo $chit_nr; ?> <?php } else { ?> Genereaza chitanta <?php } ?> <br /> <form name="chitanta" action="chitanta.php" method="get"> Numar: <?php $chit_query=tep_db_query("select max(id_chitanta) as max from chitante"); $chit=tep_db_fetch_array($chit_query); $nr_chitanta=$chit['max']+1; $nr_zeros=6-strlen($nr_chitanta); for ($i=0; $i<$nr_zeros; $i++) { $nr_chitanta='0' . $nr_chitanta; } ?> <input type="text" name="nr_chitanta" value="<?php echo $nr_chitanta; ?>" /><br /> <input type="hidden" name="oID" value="<?php echo $_GET['oID']; ?>" /> <input type="submit" name="gen_chit" value="Genereaza chitanta" /> </form> </td>--> </tr></table> </td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> </tr> <tr> <td class="main"> Formular Posta Romana :<br /> <form name="formular" id ="formular" action="expeditie.php" method="get"> <?php echo $select; ?> <input type="hidden" id="oID" name="oID" value="<?php echo $oID; ?>" /> <?php if ($_GET['osCAdminID']) { ?> <input type="hidden" id="osCAdminID" name="osCAdminID" value="<?php echo $_GET['osCAdminID']; ?>" /> <?php } ?> <input type="submit" value="FormularPosta" title = "Apasa pentru a genera formularul prin Posta Romana!"/> </form> </td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '5'); ?></td> </tr> <tr> <td class="main"><table border="1" cellspacing="0" cellpadding="5"> <tr> <td class="smallText" align="center"><strong><?php echo TABLE_HEADING_DATE_ADDED; ?></strong></td> <td class="smallText" align="center"><strong><?php echo TABLE_HEADING_CUSTOMER_NOTIFIED; ?></strong></td> <td class="smallText" align="center"><strong><?php echo TABLE_HEADING_STATUS; ?></strong></td> <td class="smallText" align="center"><strong><?php echo TABLE_HEADING_COMMENTS; ?></strong></td> </tr> <?php $orders_history_query = tep_db_query("select orders_status_id, date_added, customer_notified, comments from " . TABLE_ORDERS_STATUS_HISTORY . " where orders_id = '" . tep_db_input($oID) . "' order by date_added"); if (tep_db_num_rows($orders_history_query)) { while ($orders_history = tep_db_fetch_array($orders_history_query)) { echo ' <tr>' . "\n" . ' <td class="smallText" align="center">' . tep_datetime_short($orders_history['date_added']) . '</td>' . "\n" . ' <td class="smallText" align="center">'; if ($orders_history['customer_notified'] == '1') { echo tep_image(DIR_WS_ICONS . 'tick.gif', ICON_TICK) . "</td>\n"; } else { echo tep_image(DIR_WS_ICONS . 'cross.gif', ICON_CROSS) . "</td>\n"; } echo ' <td class="smallText">' . $orders_status_array[$orders_history['orders_status_id']] . '</td>' . "\n" . ' <td class="smallText">' . nl2br(tep_db_output($orders_history['comments'])) . ' </td>' . "\n" . ' </tr>' . "\n"; } } else { echo ' <tr>' . "\n" . ' <td class="smallText" colspan="5">' . TEXT_NO_ORDER_HISTORY . '</td>' . "\n" . ' </tr>' . "\n"; } ?> </table></td> </tr> <tr> <td class="main"><br /><strong><?php echo TABLE_HEADING_COMMENTS; ?></strong></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '5'); ?></td> </tr> <?php echo tep_draw_form('status', FILENAME_ORDERS, tep_get_all_get_params(array('action')) . 'action=update_order'); $langs_query=tep_db_query("select languages_id, name from languages order by name"); $messages_query=tep_db_query("select message_id, message_title from predefined_messages order by message_title"); ?> <tr> <td class="main"><?php echo tep_draw_textarea_field('comments', 'soft', '60', '5'); ?></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> </tr> <tr> <td><table border="0" cellspacing="0" cellpadding="2"> <tr> <td><table border="0" cellspacing="0" cellpadding="2"> <tr> <td class="main"> <strong>Limba:</strong> <select name="email_language"> <?php while ($langs=tep_db_fetch_array($langs_query)) { ?> <option value="<?php echo $langs['languages_id']; ?>"<?php if ($langs['languages_id']==4) echo 'selected="selected"'; ?>><?php echo $langs['name']; ?></option> <?php } ?> </select> </td> </tr> <tr> <td class="main"> <script type="text/javascript" src="includes/functions.js"></script> <strong>Mesaj:</strong> <?php if (isset($_GET['osCAdminID'])) { ?> <input type="hidden" name="hidden_token" id="hidden-token" value="<?php echo htmlspecialchars($_GET['osCAdminID']); ?>" /> <?php } ?> <select name="predefined_message" id="predefined-message"> <option value="0">Alegeti un mesaj</option> <?php while ($message=tep_db_fetch_array($messages_query)) { ?> <option value="<?php echo $message['message_id']; ?>"><?php echo $message['message_title']; ?></option> <?php } ?> </select> </td> </tr> <tr> <td class="main"><strong><?php echo ENTRY_STATUS; ?></strong> <?php echo tep_draw_pull_down_menu('status', $orders_statuses, $order->info['orders_status']); ?></td> </tr> <tr> <td class="main"><strong><?php echo ENTRY_NOTIFY_CUSTOMER; ?></strong> <?php echo tep_draw_checkbox_field('notify', '', true); ?></td> <td class="main"><strong><?php echo ENTRY_NOTIFY_COMMENTS; ?></strong> <?php echo tep_draw_checkbox_field('notify_comments', '', true); ?></td> </tr> </table></td> <td class="smallText" valign="top"><?php echo tep_draw_button(IMAGE_UPDATE, 'disk', null, 'primary'); ?></td> </tr> </table></td> </tr> </form> <? } else { ?> <tr> <td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td class="pageHeading"><?php echo HEADING_TITLE; ?></td> <td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', 1, HEADING_IMAGE_HEIGHT); ?></td> <td align="right"><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr><?php echo tep_draw_form('orders', FILENAME_ORDERS, '', 'get'); ?> <td class="smallText" align="right"><?php echo HEADING_TITLE_SEARCH . ' ' . tep_draw_input_field('oID', '', 'size="12"') . tep_draw_hidden_field('action', 'edit'); ?></td> <?php echo tep_hide_session_id(); ?> </form></tr> <tr><?php echo tep_draw_form('status', FILENAME_ORDERS, '', 'get'); ?> <td class="smallText" align="right"><?php echo HEADING_TITLE_STATUS . ' ' . tep_draw_pull_down_menu('status', array_merge(array(array('id' => '', 'text' => TEXT_ALL_ORDERS)), $orders_statuses), '', 'onchange="this.form.submit();"'); ?></td> <?php echo tep_hide_session_id(); ?> </form></tr> </table></td> </tr> </table></td> </tr> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr class="dataTableHeadingRow"> <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_CUSTOMERS; ?></td> <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_ORDER_TOTAL; ?></td> <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_DATE_PURCHASED; ?></td> <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_STATUS; ?></td> <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_ORDER_ID; ?></td> <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_ACTION; ?> </td> </tr> <?php if (isset($HTTP_GET_VARS['cID'])) { $cID = tep_db_prepare_input($HTTP_GET_VARS['cID']); $orders_query_raw = "select o.orders_id, o.customers_id,o.customers_name,o.customers_domeniu, o.customers_id, o.payment_method, o.date_purchased, o.last_modified, o.currency, o.currency_value, s.orders_status_name, ot.text as order_total from " . TABLE_ORDERS . " o left join " . TABLE_ORDERS_TOTAL . " ot on (o.orders_id = ot.orders_id), " . TABLE_ORDERS_STATUS . " s where o.customers_id = '" . (int)$cID . "' and o.orders_status = s.orders_status_id and s.language_id = '" . (int)$languages_id . "' and ot.class = 'ot_total' order by orders_id DESC"; } elseif (isset($HTTP_GET_VARS['status']) && is_numeric($HTTP_GET_VARS['status']) && ($HTTP_GET_VARS['status'] > 0)) { $status = tep_db_prepare_input($HTTP_GET_VARS['status']); $orders_query_raw = "select o.orders_id,o.customers_id, o.customers_name,o.customers_domeniu, o.payment_method, o.date_purchased, o.last_modified, o.currency, o.currency_value, s.orders_status_name, ot.text as order_total from " . TABLE_ORDERS . " o left join " . TABLE_ORDERS_TOTAL . " ot on (o.orders_id = ot.orders_id), " . TABLE_ORDERS_STATUS . " s where o.orders_status = s.orders_status_id and s.language_id = '" . (int)$languages_id . "' and s.orders_status_id = '" . (int)$status . "' and ot.class = 'ot_total' order by o.orders_id DESC"; } else { $orders_query_raw = "select o.orders_id, o.customers_id, o.customers_name,o.customers_domeniu, o.payment_method, o.date_purchased, o.last_modified, o.currency, o.currency_value, s.orders_status_name, ot.text as order_total from " . TABLE_ORDERS . " o left join " . TABLE_ORDERS_TOTAL . " ot on (o.orders_id = ot.orders_id), " . TABLE_ORDERS_STATUS . " s where o.orders_status = s.orders_status_id and s.language_id = '" . (int)$languages_id . "' and ot.class = 'ot_total' order by o.orders_id DESC"; } $orders_split = new splitPageResults($HTTP_GET_VARS['page'], MAX_DISPLAY_SEARCH_RESULTS, $orders_query_raw, $orders_query_numrows); $orders_query = tep_db_query($orders_query_raw); while ($orders = tep_db_fetch_array($orders_query)) { if ((!isset($HTTP_GET_VARS['oID']) || (isset($HTTP_GET_VARS['oID']) && ($HTTP_GET_VARS['oID'] == $orders['orders_id']))) && !isset($oInfo)) { $oInfo = new objectInfo($orders); } if (isset($oInfo) && is_object($oInfo) && ($orders['orders_id'] == $oInfo->orders_id)) { echo '<tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('oID', 'action')) . 'oID=' . $oInfo->orders_id . '&action=edit') . '\'">' . "\n"; } else { echo '<tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('oID')) . 'oID=' . $orders['orders_id']) . '\'">' . "\n"; } $factnumb =''; $orders_invoice_query1 = tep_db_query("select invoice_numb from invoices where order_id = '" . $orders['orders_id'] . "'"); $orders_invoice_query2 = tep_db_fetch_array($orders_invoice_query1); if ($orders_invoice_query2 ['invoice_numb']!= '') { $factnumb=$orders_invoice_query2 ['invoice_numb']; $length=strlen( $factnumb); $lungimefc= $factnumb; $z=$length; while ($z<7) { $lungimefc="0".$lungimefc; $z++; } } ?> <?php if ($orders['orders_status_name']=='Livrata') { echo '<td class="dataTableContentGreen" >';} else { echo '<td class="dataTableContent">' ;} ?> <?php echo '<a href="' . tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('oID', 'action')) . 'oID=' . $orders['orders_id'] . '&action=edit') . '">' . tep_image(DIR_WS_ICONS . 'preview.gif', ICON_PREVIEW) . '</a> ' . $orders['customers_name']; ?></td> <?php if ($orders['orders_status_name']=='Livrata') { echo '<td class="dataTableContentGreen" align="right">';} else { echo ' <td class="dataTableContent" align="right">' ;} ?> <?php echo strip_tags($orders['order_total']); ?></td> <?php if ($orders['orders_status_name']=='Livrata') { echo '<td class="dataTableContentGreen" align="center">';} else { echo ' <td class="dataTableContent" align="center">' ;} ?> <?php echo tep_datetime_short($orders['date_purchased']); ?></td> <?php if ($orders['orders_status_name']=='Livrata') { echo '<td class="dataTableContentGreen" align="right">';} else { echo '<td class="dataTableContent" align="right">' ;} ?> <?php echo $orders['orders_status_name']; ?></td> <td class="dataTableContent" align="center"><?php echo strip_tags($orders['orders_id']); ?></td> <td class="dataTableContent" align="right"><?php if($factnumb ) echo $lungimefc ; else echo '';?></td> <td class="dataTableContent" align="right"><?php if (isset($oInfo) && is_object($oInfo) && ($orders['orders_id'] == $oInfo->orders_id)) { echo tep_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', ''); } else { echo '<a href="' . tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('oID')) . 'oID=' . $orders['orders_id']) . '">' . tep_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?> </td> </tr> <?php } ?> <tr> <td colspan="5"><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td class="smallText" valign="top"><?php echo $orders_split->display_count($orders_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $HTTP_GET_VARS['page'], TEXT_DISPLAY_NUMBER_OF_ORDERS); ?></td> <td class="smallText" align="right"><?php echo $orders_split->display_links($orders_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $HTTP_GET_VARS['page'], tep_get_all_get_params(array('page', 'oID', 'action'))); ?></td> </tr> </table></td> </tr> </table></td> <?php $heading = array(); $contents = array(); switch ($action) { case 'delete': $heading[] = array('text' => '<strong>' . TEXT_INFO_HEADING_DELETE_ORDER . '</strong>'); $contents = array('form' => tep_draw_form('orders', FILENAME_ORDERS, tep_get_all_get_params(array('oID', 'action')) . 'oID=' . $oInfo->orders_id . '&action=deleteconfirm')); $contents[] = array('text' => TEXT_INFO_DELETE_INTRO . '<br /><br /><strong>' . $cInfo->customers_firstname . ' ' . $cInfo->customers_lastname . '</strong>'); $contents[] = array('text' => '<br />' . tep_draw_checkbox_field('restock') . ' ' . TEXT_INFO_RESTOCK_PRODUCT_QUANTITY); $contents[] = array('align' => 'center', 'text' => '<br />' . tep_draw_button(IMAGE_DELETE, 'trash', null, 'primary') . tep_draw_button(IMAGE_CANCEL, 'close', tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('oID', 'action')) . 'oID=' . $oInfo->orders_id))); break; default: if (isset($oInfo) && is_object($oInfo)) { $heading[] = array('text' => '<strong>[' . $oInfo->orders_id . '] ' . tep_datetime_short($oInfo->date_purchased) . '</strong>'); $contents[] = array('align' => 'center', 'text' => tep_draw_button(IMAGE_EDIT, 'document', tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('oID', 'action')) . 'oID=' . $oInfo->orders_id . '&action=edit')) . tep_draw_button(IMAGE_EDIT, 'document', tep_href_link(FILENAME_ORDERS, 'cID=' . $oInfo->customers_id )) . tep_draw_button(IMAGE_DELETE, 'trash', tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('oID', 'action')) . 'oID=' . $oInfo->orders_id . '&action=delete'))); $contents[] = array('align' => 'center', 'text' => tep_draw_button(IMAGE_ORDERS_INVOICE, 'document', tep_href_link(FILENAME_ORDERS_INVOICE, 'oID=' . $oInfo->orders_id), null, array('newwindow' => true)) . tep_draw_button(IMAGE_ORDERS_PACKINGSLIP, 'document', tep_href_link(FILENAME_ORDERS_PACKINGSLIP, 'oID=' . $oInfo->orders_id), null, array('newwindow' => true))); $contents[] = array('text' => '<br />' . TEXT_DATE_ORDER_CREATED . ' ' . tep_date_short($oInfo->date_purchased)); if (tep_not_null($oInfo->last_modified)) $contents[] = array('text' => TEXT_DATE_ORDER_LAST_MODIFIED . ' ' . tep_date_short($oInfo->last_modified)); $contents[] = array('text' => '<br />' . TEXT_INFO_PAYMENT_METHOD . ' ' . $oInfo->payment_method); } break; } if ((tep_not_null($heading)) && (tep_not_null($contents))) { echo '<td width="25%" valign="top">' . "\n"; $box = new box; echo $box->infoBox($heading, $contents); echo '</td>' . "\n"; } ?> </tr> </table></td> </tr> <? } ?> <?php require(DIR_WS_INCLUDES . 'template_bottom.php'); require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
Bob Terveuren Posted December 11, 2013 Posted December 11, 2013 That all looks OK but if no cID then try dumping the result of the query at line 747 by adding // var_dump($orders_query); // after it or maybe exit(var_dump($orders_query)); You should get an array dumped out - is there a value for customers_id?
cretbogdan Posted December 11, 2013 Author Posted December 11, 2013 I tried to add what you said , at line 747 and in many other places but I don't get any array dumped out when I check in backoffice . Nothing ...
WESK Posted December 12, 2013 Posted December 12, 2013 I have something similar to what your trying to do but I use the customer's email since we allow checkout without an account.... here is the code I use to get the total number of orders and a clickable text link to the list of orders. $check_prev_orders_query = tep_db_query("select count(orders_id) as total_ord from " . TABLE_ORDERS . " where customers_email_address = '" . $order->customer['email_address'] . "'"); $check_prev_orders = tep_db_fetch_array($check_prev_orders_query); echo '<a href="I-USE-MY-FULL-DOMAIN/ADMIN/orders.php?q='.$order->customer['email_address'].'">Total Orders:<b>'.$check_prev_orders['total_ord'].'</b></a>';
cretbogdan Posted December 13, 2013 Author Posted December 13, 2013 Hello Thank you for your solution . I added that code and is shows how many orders had that customer , with a problem only . After I click on the link it shows me all orders from backoffice , it does not show me only the orders from that customer . To give you and example . This is the link from the url bar after I click http://www.myshop.com/admin/orders.php?q=email@dasdad.com and the result is the same with this http://www.myshop/admin/orders.php
WESK Posted December 13, 2013 Posted December 13, 2013 Sounds like a space might be int he search string....for example if you query on orders.php for "smith " vs "smith" without the quotes (that trailing space could be the issue with the query showing you everything). I would pull the html code from your live site and see if there are spaces in the a href link.
Jack_mcs Posted December 14, 2013 Posted December 14, 2013 @@cretbogdan If you haven't found a solution yet, you may want to look at the Additional Order Info addon. One of the things it does is adds a link to all of the orders for a customer. Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons
Recommended Posts
Archived
This topic is now archived and is closed to further replies.