musicmaestro Posted March 10, 2007 Posted March 10, 2007 I want to add a field from the products table on to the invoice.php / orders.php I have searched the forum but cant find the answer. Please can someone help or tell me where I can find the information? Thankyou Steve
Nullachtfuffzehn Posted March 10, 2007 Posted March 10, 2007 I want to add a field from the products table on to the invoice.php / orders.php I have searched the forum but cant find the answer. Please can someone help or tell me where I can find the information? Thankyou Steve What field do you want to add and where do you want to add it? Would help to give you an answer.
musicmaestro Posted March 10, 2007 Author Posted March 10, 2007 What field do you want to add and where do you want to add it? Would help to give you an answer. Manfred Thank you. In our set up we use the products table field products_weight to store a UPC/SKU number which identifies the product sold to the customer. On the invoice at present is the two standard fields then the tax field. I would like the product_weight to show before the tax field. I hope that makes sense but if you need any further information, please let me know. Thanks again Steve
Nullachtfuffzehn Posted March 10, 2007 Posted March 10, 2007 Manfred Thank you. In our set up we use the products table field products_weight to store a UPC/SKU number which identifies the product sold to the customer. On the invoice at present is the two standard fields then the tax field. I would like the product_weight to show before the tax field. I hope that makes sense but if you need any further information, please let me know. Thanks again Steve Ok, that should be not so hard to realize. You gotta add a new column in the table header like this: <td class="dataTableHeadingContent" colspan="2"><?php echo TABLE_HEADING_PRODUCTS; ?></td> <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCTS_MODEL; ?></td> <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCTS_WEIGHT; ?></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_PRICE_INCLUDING_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> For the added TABLE_HEADING_PRODUCTS_WEIGHT you got to define a text in each invoice.php in your language subdirectories. Then, before line 119, maybe 120 after you added the above, add the following line: echo ' <td class="dataTableContent" align="right" valign="top">' . $order->products[$i]['weight']. '</td>' . "\n" . And you should be done.
musicmaestro Posted March 10, 2007 Author Posted March 10, 2007 Ok, that should be not so hard to realize. You gotta add a new column in the table header like this: <td class="dataTableHeadingContent" colspan="2"><?php echo TABLE_HEADING_PRODUCTS; ?></td> <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCTS_MODEL; ?></td> <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCTS_WEIGHT; ?></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_PRICE_INCLUDING_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> For the added TABLE_HEADING_PRODUCTS_WEIGHT you got to define a text in each invoice.php in your language subdirectories. Then, before line 119, maybe 120 after you added the above, add the following line: echo ' <td class="dataTableContent" align="right" valign="top">' . $order->products[$i]['weight']. '</td>' . "\n" . And you should be done. Ok, managed to edit the invoice.php in admin (we are only using the english version. I added the line as you mentioned and also added the second line. When I viewed an invoice I got: Parse error: parse error, unexpected T_ECHO in ....../htdocs/admin/invoice.php Here is my code: <td class="dataTableHeadingContent" colspan="2"><?php echo TABLE_HEADING_PRODUCTS; ?></td> <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCTS_MODEL; ?></td> <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCTS_WEIGHT; ?></td> <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_TAX; ?></td> and ' <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" . [b]echo ' <td class="dataTableContent" align="right" valign="top">' . $order->products[$i]['weight']. '</td>' . "\n" .[/b] ' <td class="dataTableContent" align="right" valign="top"><b>' . $currencies->format($order->products[$i]['final_price'], true, $ord....... What am I doing wrong Manfred? Thank you Steve
Nullachtfuffzehn Posted March 10, 2007 Posted March 10, 2007 In your case just remove the echo statement, cause your inserted the string right into a concatenated string (the things with the . between). Watch out that there's a . at the end of the line before and at the end of the line you've inserted. So no echo at the beginning and no ; at the end, but as far as I see there's no ; there.
Nullachtfuffzehn Posted March 10, 2007 Posted March 10, 2007 In your case just remove the echo statement, cause your inserted the string right into a concatenated string (the things with the . between). Watch out that there's a . at the end of the line before and at the end of the line you've inserted. So no echo at the beginning and no ; at the end, but as far as I see there's no ; there.
musicmaestro Posted March 10, 2007 Author Posted March 10, 2007 In your case just remove the echo statement, cause your inserted the string right into a concatenated string (the things with the . between). Watch out that there's a . at the end of the line before and at the end of the line you've inserted. So no echo at the beginning and no ; at the end, but as far as I see there's no ; there. Bit frustrating this one. Still getting that error message so it must be something minor. Thank you for time Steve
Nullachtfuffzehn Posted March 10, 2007 Posted March 10, 2007 Bit frustrating this one. Still getting that error message so it must be something minor. Thank you for time Steve Send me the complete code via pm and i'll look into it and correct it. It's not a biggie...
Nullachtfuffzehn Posted March 11, 2007 Posted March 11, 2007 Ok, here's the code that should work. <?php /* $Id: invoice.php,v 1.6 2003/06/20 00:37:30 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions [url="http://www.oscommerce.com"]http://www.oscommerce.com[/url] Copyright © 2003 osCommerce Released under the GNU General Public License */ require('includes/application_top.php'); 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 = '" . (int)$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> <link rel="stylesheet" type="text/css" href="includes/stylesheet.css"> </head> <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF"> <!-- body_text //--> <p align=center> <table border="0" width="90%" cellspacing="0" cellpadding="2"> <tr> <td><table width="100%" border="0" cellspacing="0" cellpadding="2"> <tr><br><br><br> <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="2"> <tr> <td class="main"><b><?php echo ENTRY_SOLD_TO; ?></b><br><br></td> </tr> <tr> <td class="main"><?php echo tep_address_format($order->customer['format_id'], $order->customer, 1, '', '<br>'); ?></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '5'); ?></td> </tr> <tr> <td class="main"><?php echo $order->customer['telephone']; ?></td> </tr> <tr> <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"><b><?php echo ENTRY_SHIP_TO; ?></b><br><br></td> </tr> <tr> <td class="main"><?php echo tep_address_format($order->delivery['format_id'], $order->delivery, 1, '', '<br>'); ?></td> </tr> </table></td> </tr> </table></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> </tr> <tr><br><br> <td><table border="0" cellspacing="0" cellpadding="2"> <tr><br><br><br><br> <td class="main"><b><?php echo ENTRY_PAYMENT_METHOD; ?></b></td> <td class="main"><?php echo $order->info['payment_method']; ?></td> </tr> </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" colspan="2"><?php echo TABLE_HEADING_PRODUCTS; ?></td> <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCTS_MODEL; ?></td> <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCTS_WEIGHT; ?></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_PRICE_INCLUDING_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']; if (isset($order->products[$i]['attributes']) && (($k = sizeof($order->products[$i]['attributes'])) > 0)) { for ($j = 0; $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">' . $order->products[$i]['model'] . '</td>' . "\n"; echo ' <td class="dataTableContent" align="right" valign="top">' . $order->products[$i]['weight']. '</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">' . $order->products[$i]['weight'] . '</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(tep_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']), 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"; } ?> <tr> <td align="right" colspan="8"><table border="0" 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> </table></td> </tr> <tr> <td><p align="center"><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr><br><br> <p align="center"><font size="3" face="Verdana">Thank you for your order - <b>Payment received</b></font></p><p align="center"><font size="3" face="Verdana">For more great CD & DVD titles visit www.cdxmusic.com</font></p><br> <td class="pageHeading"><?php echo nl2br(STORE_NAME_ADDRESS); ?></td> <td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'oscommerce.gif', 'CDX Music', '468', '60'); ?></td><br><br><td class="pageHeading">Your Order/Ref No: <?php echo $oID;?></td> </tr> </table></td> </tr> </table> <!-- body_text_eof //--> <br> </body> </html> <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
musicmaestro Posted March 11, 2007 Author Posted March 11, 2007 Thank you for the post There doesn't appear to be any data showing on the invoice for that field and the header is showing TABLE_HEADING_PRODUCTS_WEIGHT It's late now, so I'm going to call it a day and do a revist tomorrow (or today as it now is!) Thank you for your help so far. Steve.
Nullachtfuffzehn Posted March 11, 2007 Posted March 11, 2007 Thank you for the post There doesn't appear to be any data showing on the invoice for that field and the header is showing TABLE_HEADING_PRODUCTS_WEIGHT It's late now, so I'm going to call it a day and do a revist tomorrow (or today as it now is!) Thank you for your help so far. Steve. That's what I said, you got to add the definition at the /includes/languages/'language'/invoice.php. Other than this, you're getting no more error messages. I'll look into it tomorrow (or today) then. Have a good night.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.