scandic_outlet Posted May 11, 2011 Share Posted May 11, 2011 hi guys in my old osc 2.2. shop i have a modified invoice, where i have added a field in the products database for the products "location". In my invoice i then have added the product location to each item. In my new osc 2.3.1 shop i want also to display the extra db field, as well as sort the items on the invoice alphabetically based on the field " location ". Can you please help me how to rewrite this piece of code? In my 2.2 invoice.php, i am sorting the items on the invoice, based on product name alphabetically Here is the part from my old invoice: <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr class="dataTableHeadingRow"> <td class="dataTableHeadingContent" align="center"><?php echo 'Lok'; ?></td> <td class="dataTableHeadingContent" align="center"><?php echo 'Varenr'; ?></td> <td class="dataTableHeadingContent" align="center"><?php echo 'Antal'; ?></td> <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCTS; ?></td> <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_TAX; ?></td> <td class="dataTableHeadingContent" align="center"><?php echo 'Enhedspris'; ?></td> <td class="dataTableHeadingContent" align="center"><?php echo 'Total'; ?></td> </tr> <?php $order->sortByName(); $qtyBold = 2; for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) { $q_loc = tep_db_query("select products_loc from products where products_id = ". $order->products[$i]['id'] .""); $a_loc = tep_db_fetch_array($q_loc); echo ' <tr class="dataTableRow">' . "\n" . // ' <td class="dataTableContent" valign="top" align="center">' . $order->products[$i]['id'] . ' TEST</td>' . "\n" . ' <td class="dataTableContent" valign="top" align="center">' . $a_loc['products_loc'] . '</td>' . "\n" . ' <td class="dataTableContent" valign="top" align="center">'; if($order->products[$i]['qty'] >= $qtyBold) echo '<b>'.$order->products[$i]['model'].'</b>'; else echo $order->products[$i]['model']; echo ' </td>' . "\n"; echo ' <td class="dataTableContent" valign="top" align="center">' . $order->products[$i]['qty'] . ' x</td>' . "\n" . ' <td class="dataTableContent" valign="top">'; if($order->products[$i]['qty'] >= $qtyBold) echo '<b>'.$order->products[$i]['name'].'</b>'; else echo $order->products[$i]['name']; if (isset($order->products[$i]['attributes']) && (($k = sizeof($order->products[$i]['attributes'])) > 0)) { for ($j = 0; $j < $k; $j++) { And here is how my current invoice.php looks in 2.3.1 - i cant really figure out how to "get the product location" from the database, and sort the invoice items based alphabetically based on the location results.. Normally my location will be something like this: product 1: A2-1 product 2: K3-3 etc etc <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_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++) { Any help / input would be greatly appreciated. Thanks. Dedicated OsCommerce user. 2011 will be the return of OsC Link to comment Share on other sites More sharing options...
knifeman Posted May 11, 2011 Share Posted May 11, 2011 What we did was preface our model number with the bin location, then sorted invoices by model number. Now the picker just goes down each row picking items in order. Tim Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.