Query to print all products (and price with tax)
arbocenc <[email protected]>
| Newsgroups | gmane.comp.web.oscommerce.features |
|---|---|
| Message-ID | <0d7989bc46f527a4654ae1a48e8adb8c@osCommerce-Forums> |
This message was sent from: Features
http://forums.oscommerce.com/viewtopic.php?p=175303#175303
----------------------------------------------------------------
Hi!
I've modified a query was posted here several months ago. I want it let my customers print a Catalog with all products of the shop. But there is one think I don't know how to do... Prices nao are without VAT (an European Tax). I'd like the prices include Tax, like in the orders. Any suggestions?
Thanks,
arbocenc
Here is the code
[code]
<?php
$result=mysql_query("
SELECT products.products_id, categories_name, products_name, products_price, manufacturers_name, products_weight
FROM products, products_description, categories_description, products_to_categories, manufacturers
WHERE products.products_id = products_to_categories.products_id
AND products_to_categories.categories_id = categories_description.categories_id
AND products.products_id = products_description.products_id
AND products.manufacturers_id = manufacturers.manufacturers_id
AND products_status='1'
AND products_description.language_id='4'
AND categories_description.language_id='4'
ORDER BY categories_description.categories_name, products_description.products_name");
?>
<!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>
<base href="<?php echo (getenv('HTTPS') == 'on' ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
<script language="javascript"><!--
function Back()
{
if (navigator.appName == "Microsoft Internet Explorer")
document.location="javascript: history.go(-1)"
else
document.location="javascript: window.back()"
}
//-->
</script>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
<!-- body //-->
<table border="1" width="80%" align="center" cellspacing="0" cellpadding="3">
<tr>
<td colspan="7" class="main" align="center"><?php echo tep_image(DIR_WS_IMAGES . '/banners/delaterra.gif', 'delaterra.net', '', ''); ?></td>
</tr>
<tr font="bold">
<td colspan="6" class="main" align="center"><b>delaterra.net<br>Tel.: 635 40 31 04 - 972 160 190<br>Pati de l'abadia, 1, 2on, 6a<br>17400 BREDA (La Selva - Girona)</b></td>
</tr>
<tr>
<td colspan="6" align="left" class="main"><?php echo '<a href="Javascript: Back()">' . tep_image_button('button_back.gif', IMAGE_BUTTON_BACK) . '</a>'; ?></td>
</tr>
<b>
<tr>
<td class="main" align="center"><b>Id.</b></td>
<td class="main" align="center"><b>Categories</b></td>
<td class="main" align="center"><b>Productes</b></td>
<td class="main" align="center"><b>Quilos/litres</b></td>
<td class="main" align="center"><b>Elaborador</b></td>
<td class="main" align="center"><b>Preu </b></td>
</tr>
</b>
<?php
if ($row = mysql_fetch_array($result)) {
do {
echo "<tr class=\"smallText\">";
echo "<td class=\"smallText\" valign=\"top\">" . $row["products_id"] . "</td>\n";
echo "<td class=\"smallText\" valign=\"top\">" . $row["categories_name"] . "</td>\n";
echo "<td class=\"smallText\" valign=\"top\"><a href=" . tep_href_link(FILENAME_PRODUCT_INFO . '?products_id=' . $row["products_id"], '', 'NONSSL') . ">" . $row["products_name"] . "</a></td>\n";
echo "<td class=\"smallText\" valign=\"top\">" . $row["products_weight"] . "</td>\n";
echo "<td class=\"smallText\" valign=\"top\">" . $row["manufacturers_name"] . "</td>\n";
echo "<td class=\"smallText\" valign=\"top\">" . $row["products_price"] . "</td>\n";
echo "</tr>";
}
while($row = mysql_fetch_array($result));
}
?>
<tr>
<td colspan="7"><?php echo '<a href="Javascript: Back()">' . tep_image_button('button_back.gif', IMAGE_BUTTON_BACK) . '</a>'; ?></td>
</tr>
</table>
<!-- body_eof //-->
</body>
</html>
[/code]