Hiroboy 0 Posted October 9, 2006 I have been using the "osCommerce Stock Viewer" http://www.oscommerce.com/community/contributions,3317/ for some time now and it's very handy for Stock Checking and also working out total stock held etc. But I would like it to output a field for manufacturers name, so when pasted into Excel, I could sort by Manufacture, which makes stock checking much easier. This is the code as it stands, any help would be great. <? echo "<tr><td><b>". 'Products ID' . "</b></td> <td><b>" . 'Products Name' . "</b></td> <td><b>" . 'Products Model' . "</b></td> <td><b>" . 'Products Status' . "</b></td> <td><b>" . 'Products Qty' . "</b></td> <td><b>" . 'Products Price' . "</b></td> </tr><tr>"; $result = mysql_query("SELECT * FROM products, products_description WHERE products.products_id = products_description.products_id and products_description.language_id = '" . $languages_id . "' ORDER BY products_description.products_name"); if ($row = mysql_fetch_array($result)) { do { echo "<td class='infoBoxContents'> ".$row["products_id"]."</td>\n"; echo "<td class='infoBoxContents'>".$row["products_name"]."</td>\n"; echo "<td class='infoBoxContents'>".$row["products_model"]."</td>\n"; echo "<td class='infoBoxContents'>".$row["products_status"]."</td>\n"; echo "<td class='infoBoxContents'>".$row["products_quantity"]."</td>\n"; echo "<td class='infoBoxContents'>".$row["products_price"]."</td>\n"; echo "</tr>\n"; } while($row = mysql_fetch_array($result)); } echo "</table>\n"; ?> Share this post Link to post Share on other sites
pyramids 2 Posted October 11, 2006 here is the code, I altered it to fit the standard function calls, I also cut out sql calls to info not needed. <?php echo "<tr><td><b>". 'Products ID' . "</b></td> <td><b>" . 'Products Name' . "</b></td> <td><b>" . 'Products Model' . "</b></td> <td><b>" . 'Products Status' . "</b></td> <td><b>" . 'Products Qty' . "</b></td> <td><b>" . 'Products Price' . "</b></td> <td><b>" . 'Manufacture' . "</b></td> </tr><tr>"; $result = tep_db_query("SELECT p.products_id, pd.products_name, p.products_model, p.products_status, p.products_quantity, p.products_price, p.manufacturers_id, m.manufacturers_name from products p, products_description pd, manufacturers m WHERE p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' and p.manufacturers_id = m.manufacturers_id ORDER BY pd.products_name"); while ($row = tep_db_fetch_array($result)) { echo "<td class='infoBoxContents'> ".$row["products_id"]."</td><td class='infoBoxContents'>".$row["products_name"]."</td><td class='infoBoxContents'>".$row["products_model"]."</td><td class='infoBoxContents'>".$row["products_status"]."</td><td class='infoBoxContents'>".$row["products_quantity"]."</td><td class='infoBoxContents'>".$row["products_price"]."</td><td class='infoBoxContents'>".$row["manufacturers_name"]."</td></tr>"; } echo "</table>\n"; ?> Share this post Link to post Share on other sites
pyramids 2 Posted October 11, 2006 to have it sort it by manufacture name change this: ORDER BY pd.products_name to: ORDER BY m.manufacturers_name Share this post Link to post Share on other sites