KlausVers Posted January 25, 2005 Share Posted January 25, 2005 Hi there. I have installed the "Packing Slip with Pictures" contribution, but on all me orders it just shoves the some picture over and over again! Please help me, this is the code: <?php /* $Id: packingslip.php,v 1.7 2003/06/20 00:40:10 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 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 //--> <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 . 'e-vintage.gif'); ?></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> </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"><?php echo "Image"; ?></td> <td class="dataTableHeadingContent"><?php echo "Qty"; ?></td> <td class="dataTableHeadingContent"><?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++) { // Added 5/2004 Get Image from Data Base CED $products_query_raw = "select p.products_image from " . TABLE_PRODUCTS . " p where products_model =" . "'" . $order->products[$i]['model'] . "'"; $products_query = tep_db_query($products_query_raw); $products = tep_db_fetch_array($products_query); // Added 5/2004 Get Image from Data Base CED // Updated/Modified 5/2004 to added images to Packing Slip CED echo ' <tr class="dataTableRow">' . "\n" . ' <td class="dataTableContent" align="left">' . tep_image(DIR_WS_CATALOG . DIR_WS_IMAGES . $products['products_image'], $listing_values['products_image'], SMALL_IMAGE_HEIGHT, SMALL_IMAGE_WIDTH) . '</a> </td>' . ' <td class="dataTableContent" valign="top" align="left">' . $order->products[$i]['qty'] . ' </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'); ?> Thanks alot in advance, Klaus Quote Link to comment Share on other sites More sharing options...
KlausVers Posted January 30, 2005 Author Share Posted January 30, 2005 please help me someone?! anyone? Quote Link to comment Share on other sites More sharing options...
boxtel Posted January 30, 2005 Share Posted January 30, 2005 please help me someone?! anyone? <{POST_SNAPBACK}> well, it seems it is fetching the image based on the products_model, not the products_id. Quote Treasurer MFC Link to comment Share on other sites More sharing options...
boxtel Posted February 1, 2005 Share Posted February 1, 2005 please help me someone?! anyone? <{POST_SNAPBACK}> instead if this : // Added 5/2004 Get Image from Data Base CED $products_query_raw = "select p.products_image from " . TABLE_PRODUCTS . " p where products_model =" . "'" . $order->products[$i]['model'] . "'"; you use this : // Added 5/2004 Get Image from Data Base CED $products_query_raw = "select p.products_image from " . TABLE_PRODUCTS . " p where products_id =" . "'" . $order->products[$i]['id'] . "'"; that will select the products_image based on the id and not the model from the order at index $i. Quote Treasurer MFC Link to comment Share on other sites More sharing options...
boxtel Posted February 3, 2005 Share Posted February 3, 2005 instead if this : // Added 5/2004 Get Image from Data Base CED $products_query_raw = "select p.products_image from " . TABLE_PRODUCTS . " p where products_model =" . "'" . $order->products[$i]['model'] . "'"; you use this : // Added 5/2004 Get Image from Data Base CED $products_query_raw = "select p.products_image from " . TABLE_PRODUCTS . " p where products_id =" . "'" . $order->products[$i]['id'] . "'"; that will select the products_image based on the id and not the model from the order at index $i. <{POST_SNAPBACK}> so your code now looks like this ? // Added 5/2004 Get Image from Data Base CED $products_query_raw = "select p.products_image from " . TABLE_PRODUCTS . " p where products_id =" . "'" . $order->products[$i]['id'] . "'"; $products_query = tep_db_query($products_query_raw); $products = tep_db_fetch_array($products_query); // Added 5/2004 Get Image from Data Base CED Quote Treasurer MFC Link to comment Share on other sites More sharing options...
KlausVers Posted February 4, 2005 Author Share Posted February 4, 2005 Yes and I'v dobble checked it, but it won't show any image then, just a blank square with a red cross! ??? Quote Link to comment Share on other sites More sharing options...
boxtel Posted February 4, 2005 Share Posted February 4, 2005 Yes and I'v dobble checked it, but it won't show any image then, just a blank square with a red cross! ??? <{POST_SNAPBACK}> // Added 5/2004 Get Image from Data Base CED $products_query_raw = "select p.products_image from " . TABLE_PRODUCTS . " p where products_id =" . "'" . $order->products[$i]['id'] . "'"; $products_query = tep_db_query($products_query_raw); $products = tep_db_fetch_array($products_query); // Added 5/2004 Get Image from Data Base CED put this right after : echo $products['products_image']; and see if the image filename is printed on the screen. Quote Treasurer MFC Link to comment Share on other sites More sharing options...
boxtel Posted February 4, 2005 Share Posted February 4, 2005 // Added 5/2004 Get Image from Data Base CED$products_query_raw = "select p.products_image from " . TABLE_PRODUCTS . " p where products_id =" . "'" . $order->products[$i]['id'] . "'"; $products_query = tep_db_query($products_query_raw); $products = tep_db_fetch_array($products_query); // Added 5/2004 Get Image from Data Base CED put this right after : echo $products['products_image']; and see if the image filename is printed on the screen. <{POST_SNAPBACK}> better still, put this right after it : echo $order->products[$i]['id'] . ' : ' . $products['products_image'] . ' '; that should tell you the products id and the image file that goes with it. Quote Treasurer MFC Link to comment Share on other sites More sharing options...
boxtel Posted February 5, 2005 Share Posted February 5, 2005 better still, put this right after it : echo $order->products[$i]['id'] . ' : ' . $products['products_image'] . ' '; that should tell you the products id and the image file that goes with it. <{POST_SNAPBACK}> the entire for loop which prints out the products as I am using it now. <?php for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) { // Added 5/2004 Get Image from Data Base CED $products_query_raw = "select p.products_image from " . TABLE_PRODUCTS . " p where products_id =" . "'" . $order->products[$i]['id'] . "'"; $products_query = tep_db_query($products_query_raw); $products = tep_db_fetch_array($products_query); // Added 5/2004 Get Image from Data Base CED //echo $order->products[$i]['id'] . ' '; //echo $products['products_image']; echo ' <tr class="dataTableRow">' . "\n" . ' <td class="dataTableContent" width="10" valign="top" align="center">' . tep_image(DIR_WS_CATALOG . DIR_WS_IMAGES . $products['products_image'], $listing_values['products_image']) . '</td>' . "\n" . ' <td class="dataTableContent" valign="top" align="left">' . $order->products[$i]['qty'] . ' x ' . $order->products[$i]['name'] . '</td>'; 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"; } ?> Quote Treasurer MFC Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.