SpinerC Posted February 17, 2007 Posted February 17, 2007 Can you find the error? :ph34r: I can't! And I found a fix for the INVOICE / PACKING SLIP DATES and went ahead and tried to change them...... the ref is throwing red flags everywhere! lol! Packing Slip Error: Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /admin/packingslip.php on line 25 Here is where I found this contribution: http://www.oscommerce.com/community/contributions,2521 Here is the File: Add the date and order number to the invoice and packing slip add this to the invoice.php and packingslip.php files in the admin folder: at line 21 //get the date from the order table $date_resource = tep_db_query("select date_purchased from " . TABLE_ORDERS . " where orders_id = '" . (int)$oID . "'"); //get the array from the result $date = mysql_fetch_array($date_resource); //get the date as a string from the result $date_purchased = substr($date['date_purchased'], 5, 2) . '/' . substr($date['date_purchased'], 8, 2) . '/' . substr($date['date_purchased'], 0, 4); and at line 88 <tr> <td class="main"><b><?php echo ENTRY_ORDER_NUMBER; ?></b></td> <td class="main"><?php echo $oID; ?></td> </tr> <tr> <td class="main"><b><?php echo ENTRY_ORDER_DATE; ?></b></td> <td class="main"><?php echo $date_purchased; ?></td> </tr> In the invoice.php and packingslip.php files in the admin/includes/languages/[language] folder, where [language] represents the language used. define('ENTRY_ORDER_NUMBER', 'Order Number:'); define('ENTRY_ORDER_DATE', 'Order Date:'); if you are not using english obviously substitute the required language. Exact location of these in the file is not really important - use whatever you are comfortable with. This will place the order number and date in the bottom left corner of the invoice and packing slip. They can be moved around the page as required. And..... the Invoice seems to be working BUT, the date is on the far RIGHT and the wording on the FAR Left.. HELP!! I can't see straight any more..... no icon for pulling hair out!!!! (!) Sincerely Charlene :blink: :blink: :blink:
SpinerC Posted February 17, 2007 Author Posted February 17, 2007 Here is what the page looks like, all of the Packingslip in the Admin Folder: <?php /* $Id: packingslip.php,v 1.7 2003/06/20 00:40:10 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']); //get the date from the order table $date_resource = tep_db_query("select date_purchased from " . TABLE_ORDERS . " where orders_id = '" . (int)$oID . "'"); //get the array from the result $date = mysql_fetch_array($date_resource); //get the date as a string from the result $date_purchased = substr($date['date_purchased'], 5, 2) . '/' . substr($date['date_purchased'], 8, 2) . '/' . substr($date['date_purchased'], 0, 4); $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 //--> <table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td class="pageHeading"><?php echo nl2br(STORE_NAME_ADDRESS); ?></td> <td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'oscommerce.gif', 'osCommerce', '204', '50'); ?></td> </tr> </table></td> </tr> <tr> <td><table width="100%" border="0" cellspacing="0" cellpadding="2"> <tr> <td colspan="2"><?php echo tep_draw_separator(); ?></td> </tr> <tr> <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="2"> <tr> <td class="main"><b><?php echo ENTRY_SOLD_TO; ?></b></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></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> <td><table border="0" cellspacing="0" cellpadding="2"> <tr> <td class="main"><b><?php echo ENTRY_PAYMENT_METHOD; ?></b></td> <td class="main"><?php echo $order->info['payment_method']; ?></td> </tr> <tr> <td class="main"><b><?php echo ENTRY_ORDER_NUMBER; ?></b></td> <td class="main"><?php echo $oID; ?></td> </tr> <tr> <td class="main"><b><?php echo ENTRY_ORDER_DATE; ?></b></td> <td class="main"><?php echo $date_purchased; ?></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> </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']) && (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']; echo '</i></small></nobr>'; } } echo ' </td>' . "\n" . ' <td class="dataTableContent" valign="top">' . $order->products[$i]['model'] . '</td>' . "\n" . ' </tr>' . "\n"; } ?> </table></td> </tr> </table> <!-- body_text_eof //--> <br> </body> </html> <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?> Anyone? :'( :'( :'( :'( :'( Sincerely Charlene :blink:
natewlew Posted February 17, 2007 Posted February 17, 2007 I ran this page inside of my admin folder and got a cannot redeclare error. Other that that I couldn't find a php error. Find: require(DIR_WS_CLASSES . 'currencies.php'); To: require_once(DIR_WS_CLASSES . 'currencies.php'); Other great Open Source (Free) programs: (Free as in free speech not free beer) The Gimp - An image program. | Firefox - All you have to do is add the Web Developer add-on to make this web browser complete. | FileZilla - An ftp program. | Inkscape - A good program to create images with. | Thunderbird - An email program. | Openoffice.org - An office suite that is compatible with MS Office. | Abiword - Another office suite. | Audacity - A sound recording tool. | ddp's Picks | Wordpress - An easy to use blogging software. | Joomla - An easy to use CMS that has ecommerce plug-ins. | Drupal - Another CMS How do I find these programs? Google Search!
SpinerC Posted February 17, 2007 Author Posted February 17, 2007 I ran this page inside of my admin folder and got a cannot redeclare error. Other that that I couldn't find a php error.Find: require(DIR_WS_CLASSES . 'currencies.php'); To: require_once(DIR_WS_CLASSES . 'currencies.php'); I changed it and now I have this one: Parse error: parse error, unexpected T_STRING in/admin/packingslip.php on line 19 Thanks for trying, any other ideas? I am open to suggestions. What I don't understand is, the Invoice had the same changes and it works fine. I tried to copy and paste from one to the other but, still get the same error message, before, line 25. Thanks again! Sincerely Charlene :)
ozzieshopper Posted February 17, 2007 Posted February 17, 2007 I changed it and now I have this one: Parse error: parse error, unexpected T_STRING in/admin/packingslip.php on line 19 Thanks for trying, any other ideas? I am open to suggestions. What I don't understand is, the Invoice had the same changes and it works fine. I tried to copy and paste from one to the other but, still get the same error message, before, line 25. Thanks again! Sincerely Charlene :) Does this page require the header as I can't locate it in your page code or is it just not meant to be there? see below for an example of where the header usually goes. </head> <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0"> <!-- header //--> <?php require(DIR_WS_INCLUDES . 'header.php'); ?> <!-- header_eof //--> <!-- body //-->
SpinerC Posted February 17, 2007 Author Posted February 17, 2007 Does this page require the header as I can't locate it in your page code or is it just not meant to be there? see below for an example of where the header usually goes. </head> <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0"> <!-- header //--> <?php require(DIR_WS_INCLUDES . 'header.php'); ?> <!-- header_eof //--> <!-- body //--> I am using an FTP and went into look at the file, the Header is there and is below the information that is causing the error to the best of my knowledge. I followed the instructions that were given in the contribution for this file. So I am not sure what the problem is exactly, I am open to more ideas.... cause I do need to get this fixed so I can print off the packing slip. The file is found under admin/packingslip.php so it wouldn't show up on the site, only after ordering. <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 //--> Anything else I can check? Thanks for your help, I appreciate it! :) Sincerely Charlene :)
SpinerC Posted February 17, 2007 Author Posted February 17, 2007 The error still reads: Parse error: parse error, unexpected T_STRING in /admin/packingslip.php on line 19 This file is for the packingslip.php found in the Admin folder. Here is the entire page of codes if anyone wants to take a crack at this: <?php /* $Id: packingslip.php,v 1.7 2003/06/20 00:40:10 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']); //get the date from the order table $date_resource = tep_db_query("select date_purchased from " . TABLE_ORDERS . '' where orders_id = '" . (int)$oID . "'"); //get the array from the result $date = mysql_fetch_array($date_resource); //get the date as a string from the result $date_purchased = substr($date['date_purchased'], 5, 2) . '/' . substr($date['date_purchased'], 8, 2) . '/' . substr($date['date_purchased'], 0, 4); $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 //--> <table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td class="pageHeading"><?php echo nl2br(STORE_NAME_ADDRESS); ?></td> <td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'oscommerce.gif', 'osCommerce', '204', '50'); ?></td> </tr> </table></td> </tr> <tr> <td><table width="100%" border="0" cellspacing="0" cellpadding="2"> <tr> <td colspan="2"><?php echo tep_draw_separator(); ?></td> </tr> <tr> <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="2"> <tr> <td class="main"><b><?php echo ENTRY_SOLD_TO; ?></b></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></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> <td><table border="0" cellspacing="0" cellpadding="2"> <tr> <td class="main"><b><?php echo ENTRY_PAYMENT_METHOD; ?></b></td> <td class="main"><?php echo $order->info['payment_method']; ?></td> </tr> <tr> <td class="main"><b><?php echo ENTRY_ORDER_NUMBER; ?></b></td> <td class="main"><?php echo $oID; ?></td> </tr> <tr> <td class="main"><b><?php echo ENTRY_ORDER_DATE; ?></b></td> <td class="main"><?php echo $date_purchased; ?></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> </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']) && (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']; echo '</i></small></nobr>'; } } echo ' </td>' . "\n" . ' <td class="dataTableContent" valign="top">' . $order->products[$i]['model'] . '</td>' . "\n" . ' </tr>' . "\n"; } ?> </table></td> </tr> </table> <!-- body_text_eof //--> <br> </body> </html> <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?> Any help is greatly appreciated! Thank you! Sincerely Charlene :)
wheeloftime Posted February 17, 2007 Posted February 17, 2007 The error still reads: Parse error: parse error, unexpected T_STRING in /admin/packingslip.php on line 19Any help is greatly appreciated! Thank you! Sincerely Charlene :) Charlene, The error is due to one single quote too much (just before the where orders_id) in $date_resource = tep_db_query("select date_purchased from " . TABLE_ORDERS . '' where orders_id = '" . (int)$oID . "'"); You will still get an error however when you remove that single quote because of a problem with the use of single and double quotes. If you rewrite that line to $date_resource = tep_db_query('select date_purchased from ' . TABLE_ORDERS . ' where orders_id = "' . (int)$oID . '"'); it should work alright. HTH Howard
SpinerC Posted February 17, 2007 Author Posted February 17, 2007 Charlene, The error is due to one single quote too much (just before the where orders_id) in $date_resource = tep_db_query("select date_purchased from " . TABLE_ORDERS . '' where orders_id = '" . (int)$oID . "'"); You will still get an error however when you remove that single quote because of a problem with the use of single and double quotes. If you rewrite that line to $date_resource = tep_db_query('select date_purchased from ' . TABLE_ORDERS . ' where orders_id = "' . (int)$oID . '"'); it should work alright. HTH Howard Where were you yesterday (j/k) :D Thank you!! :wub: I have another string on the go, trying to change the margins on the print out of both the invoice and the packing slip, they are too narrow to the edge of the page. I know it is in the stylesheet but, I am a newbie to php and don't want another two day headache lol! :blush: BTW, that string of codes is exactly as it appears in the contribution pages.... I guess that is the reason for the warning :) Thanks again! Sincerely Charlene :)
Recommended Posts
Archived
This topic is now archived and is closed to further replies.