Merci pour la réponse Fissiaux
J'ais regardé cette contribution mais c'est pas tout à fait ça que je recherche. les références à ajouter sont en rapport avec la commande et non avec le client ; le même client fait plusieurs commandes mais avec des références différentes .
Je crois que je peux employer le champs commentaire (à défault d'une meilleure solution ) j'ais modifié le fichier "Invoice" à partir du fichier "Orders" mais j'ais le problème suivant
Si j'ais plusieurs commentaires sur la commande il m'imprime tous les commentaires alors que je voudrais que le dernier.
Comment changer le code pour avoir que le dernier commentaire.
voici l'exemple:
Exemple Bon: ( champs commentaire vide)
FACTURE N° 1962
Méthode de paiement : Cash bij de levering
Date de la commande : mardi 19 septembre, 2006
Références client :
Exemple mauvais: (plusieurs champs commentaire ) ------> il faudrait afficher que le dernier
FACTURE N° 1958
Méthode de paiement : Cash bij de levering
Date de la commande : lundi 18 septembre, 2006
Références client : Références client : testRéférences client : test2Références client : test3
Code source :
CODE
<?php
/*
$Id: invoice.php,v 1.2 2004/03/13 15:09:11 ccwjr Exp $
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2002 osCommerce
Released under the GNU General Public License
*/
require('includes/application_top.php');
$customer_number_query = tep_db_query("select customers_id from " . TABLE_ORDERS . " where orders_id = '". tep_db_input(tep_db_prepare_input($HTTP_GET_VARS['order_id'])) . "'");
$customer_number = tep_db_fetch_array($customer_number_query);
/*
if ($customer_number['customers_id'] != $customer_id) {
tep_redirect(tep_href_link(FILENAME_ACCOUNT_HISTORY, '', 'SSL'));
}
*/
$payment_info_query = tep_db_query("select payment_info from " . TABLE_ORDERS . " where orders_id = '". tep_db_input(tep_db_prepare_input($HTTP_GET_VARS['order_id'])) . "'");
$payment_info = tep_db_fetch_array($payment_info_query);
$payment_info = $payment_info['payment_info'];
// require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_INVOICE);
require(DIR_WS_CLASSES . 'currencies.php');
$currencies = new currencies();
$oID = tep_db_prepare_input($HTTP_GET_VARS['oID']);
$orders_query = tep_db_query("select orders_id from " . TABLE_ORDERS . " where orders_id = '" . tep_db_input($oID) . "'");
include(DIR_WS_CLASSES . 'order.php');
$order = new order($oID);
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE . ' - ' . TITLE_PRINT_ORDER . $oID; ?></title>
<base href="<?php echo (getenv('HTTPS') == 'on' ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="print.css">
</head>
<body marginwidth="5" marginheight="5" topmargin="0" bottommargin="0" leftmargin="30" rightmargin="0">
<!-- body_text //-->
<table width="680" border="0" align="center" cellpadding="2" cellspacing="0">
<tr>
<br>
</tr>
<tr>
<td><table border="0" align="center" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td><table border="0" align="center" width="100%" cellspacing="0" cellpadding="0">
<tr align="left">
<td colspan="2" class="titleHeading"><?php echo tep_image(DIR_WS_IMAGES . 'logofacture.gif' , 'SOLDES Electromenager - Achat au meilleur prix en Belgique, Aeg, Siemens, Miele, Liebherr, Bosch, Zanussi, Smeg') . ' '; ?> </td>
</tr>
<tr>
<td class="marques2">BOSCH - AEG - ELECTROLUX - SIEMENS - SMEG - NEFF <br>
ZANUSSI - LIEBHERR - MIELE - SCHOLTES - BEKO <br>
FRI-FRI - SEB - TEFAl - CALOR - BRAUN - KRUPS - NILFISK <br>
SONY - JVC - PANASONIC - PHILIPS - SAMSUNG - YAMAHA <br>
DENON - KENWOOD - MARANTZ - B&W - JBL - JAMO - JM LAB</td>
</tr>
<tr>
<td colspan="2" valign="top" class="mail">info@dcmelectro.be</td>
</tr>
<tr>
<td height="110" colspan="2" valign="top" ><table width="50%" height="110" border="0" align="right" cellpadding="2" cellspacing="0">
<tr>
<!-- Ajout pour TVA_INTRACOM_v3.3 //-->
<td valign="top" class="adresseclient"><?php echo tep_address_format($order->billing['format_id'], $order->billing, 1,'', '<br>'); ?></td>
<!-- Fin ajout pour TVA_INTRACOM_v3.3 //-->
</tr>
</table></td>
</tr>
<tr>
<td height="40" colspan="2" align="center" class="titleHeading"> </td>
</tr>
<tr>
<td colspan="2" class="numerofacture"><b><?php echo TITLE_PRINT_INVOICE . ' N° ' . $HTTP_GET_VARS['oID']; ?></b></td>
</tr>
<tr align="left">
<td colspan="2" class="titleHeading"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td align="left" class="main"><table width="100%" border="0" cellspacing="0" cellpadding="2">
<tr>
<td class="main"><?php echo '<b>' . ENTRY_PAYMENT_METHOD . '</b> ' . $order->info['payment_method']; ?></td>
</tr>
<tr>
<td class="main"><?php echo $payment_info; ?></td>
</tr>
</table></td>
</tr>
<tr>
<td class="main"></td>
</tr>
<tr>
<td class="main"><?php echo '<b>' . ENTRY_DATE_PURCHASED . '</b> ' . tep_date_long($order->info['date_purchased']); ?></td>
</tr>
<tr>
<td class="main"><?php
$orders_history_query = tep_db_query("select orders_status_id, date_added, customer_notified, comments from " . TABLE_ORDERS_STATUS_HISTORY . " where orders_id = '" . (int)$oID . "' order by date_added");
if (tep_db_num_rows($orders_history_query)) {
while ($orders_history = tep_db_fetch_array($orders_history_query))
echo '<b>' . TABLE_HEADING_REF . '</b> ' . (tep_db_output($orders_history['comments']));
}
?> </td>
</tr>
<tr align="left">
<td colspan="2" class="titleHeading"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
</tr>
<tr>
<td height="385" valign="top"><table width="100%" border="0" cellpadding="1" cellspacing="0" bgcolor=#000000>
<tr>
<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr class="dataTableHeadingRow">
<td class="dataTableHeadingContent" colspan="2"><?php echo TABLE_HEADING_PRODUCTS; ?></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_EXCLUDING_TAX; ?></td>
<td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_TOTAL_EXCLUDING_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++) {
echo ' <tr class="dataTableRow">' . "\n" .
' <td class="dataTableContent" valign="top" align="right">' . $order->products[$i]['qty'] . ' x</td>' . "\n" .
' <td class="dataTableContent" valign="top">' . $order->products[$i]['name'] . '<br>';
if ( (isset($order->products[$i]['attributes'])) && (sizeof($order->products[$i]['attributes']) > 0) ) {
for ($j=0, $n2=sizeof($order->products[$i]['attributes']); $j<$n2; $j++) {
echo '<nobr><small> <i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . $order->products[$i]['attributes'][$j]['value'] . '</i><br></small></nobr>';
}
}
echo ' </td>' . "\n" .
' <td class="dataTableContent" valign="top">' . $order->products[$i]['model'] . '</td>' . "\n";
echo ' <td class="dataTableContent" align="right" valign="top">' . tep_display_tax_value($order->products[$i]['tax']) . '%</td>' . "\n" .
' <td class="dataTableContent" align="right" valign="top"><b>' . $currencies->format($order->products[$i]['final_price'], true, $order->info['currency'], $order->info['currency_value']) . '</b></td>' . "\n" .
' <td class="dataTableContent" align="right" valign="top"><b>' . $currencies->format($order->products[$i]['final_price'] * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . '</b></td>' . "\n" .
' <td class="dataTableContent" align="right" valign="top"><b>' . $currencies->format(tep_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']) * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . '</b></td>' . "\n";
echo ' </tr>' . "\n";
}
?>
</table>
</td>
</tr>
</table>
<table border="0" width="100%" cellspacing="0" cellpadding="2">
<?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> </td>
</tr>
<tr>
<td height="30" valign="top" class="recu">Reçu la marchandise figurant à la facture </td>
</tr>
<tr>
<td height="90" valign="top" class="signature">Signature<br>
<br>
<br>
<br>
<br>
<br>
Les réclamations ne sont acceptées qu'à la reception de la marchandise<br>
Sauf autre convention expresse nos factures sont payables au comptant. <br></td>
</tr>
<tr>
<td height="1"><hr size="1" noshade color="#E72F2A"></td>
</tr>
</table>
<!-- body_text_eof //-->
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
j'aurais besoin d'une aide pour ces adaptations.
merci à tous
José