Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Recommended Posts

Posted

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";
?>

Posted

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";
?>

Posted

to have it sort it by manufacture name change this:

 

ORDER BY pd.products_name

 

to:

 

ORDER BY m.manufacturers_name

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...