Erstmal vielen Dank nochmal fuer die Anleitung an Snatch, diese Funktion ist echt hilfreich.
Ich war allerdings nicht sehr gluecklich darueber, das alle Artikel aufgelistet werden, da die Seite ganz schoen lang werden kann wenn man viel Artikel im Shop hat. Es machte eine Suche nach einem Artikel recht schwer.
Ich habe also die stats_stock_warning.php umgeschrieben.
Nun werden nur noch Artikel angezeigt, die einen Lagerbestand NULL haben (kann man natuerlich aendern, z.B. 10). Ebenfalls werden die Artikel nun nach Artikelnummer sortiert, was die suche um einiges vereinfacht.
Ich bin kein PHP experte und an alle die solche sind, bitte lacht mich nicht aus, sondern gebt Verbesserungsvorschlaege.
Was wichtig ist, es funktioniert und erleichtert mir die arbeit gewaltig.
Falls jemand hilfe braucht um die Lagerbestandanzeige zu veraendern, bin ich gerne bereit zu helfen wo ich kann.
Zusammenfassung:
1. Auflistung der Artikel: Artikelnummer / Artikelname / Artikel Lagerbestand
2. Auflistung der Artikelattribute: Artikelnummer-Attributname / Artikelname / Attribute Lagerbestand
Hier nun die stats_stock_warning.php
PHP-Code:
<?php
/* --------------------------------------------------------------
$Id: stats_stock_warning.php 899 2005-04-29 02:40:57Z hhgag $
XT-Commerce - community made shopping
http://www.xt-commerce.com
Copyright (c) 2003 XT-Commerce
--------------------------------------------------------------
based on:
(c) 2000-2001 The Exchange Project (earlier name of osCommerce)
(c) 2002-2003 osCommerce(stats_products_viewed.php,v 1.27 2003/01/29); www.oscommerce.com
(c) 2003 nextcommerce (stats_stock_warning.php,v 1.9 2003/08/18); www.nextcommerce.org
Released under the GNU General Public License
--------------------------------------------------------------*/
require('includes/application_top.php');
?>
<!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 $_SESSION['language_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">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->
<!-- body //-->
<table border="0" width="100%" cellspacing="2" cellpadding="2">
<tr>
<td class="columnLeft2" width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
</table></td>
<!-- body_text //-->
<td class="boxCenter" width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr>
<td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td width="80" rowspan="2"><?php echo xtc_image(DIR_WS_ICONS.'heading_statistic.gif'); ?></td>
<td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
</tr>
<tr>
<td class="main" valign="top">XT Statistics</td>
</tr>
</table></td>
</tr>
<tr>
<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td><table width="650"><tr><td><b><font color="ff0000">Artikel</b></font></td>
<?php
$products_query = xtc_db_query("SELECT p.products_id, p.products_quantity, p.products_model, pd.products_name FROM " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd WHERE pd.language_id = '" . $_SESSION['languages_id'] . "' AND pd.products_id = p.products_id AND p.products_quantity <=0 ORDER BY products_model" );
while ($products_values = xtc_db_fetch_array($products_query)) {
echo '<tr><td width="20%" class="dataTableContent"><a href="' . xtc_href_link(FILENAME_CATEGORIES, 'pID=' . $products_values['products_id'] . '&action=new_product') . '"><b>' . $products_values['products_model'] . '</b> </a></td><td width="78%" class="dataTableContent">' . $products_values['products_name'] . '</td><td width="2%" class="dataTableContent">';
if ($products_values['products_quantity'] <='0') {
echo '<font color="ff0000"><b>'.$products_values['products_quantity'].'</b></font>';
}
echo '</td></tr>';
$products_attributes_query = xtc_db_query("SELECT
pov.products_options_values_name,
pa.attributes_stock
FROM
" . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov
WHERE
pa.products_id = '".$products_values['products_id'] . "' AND pov.products_options_values_id = pa.options_values_id AND pov.language_id = '" . $_SESSION['languages_id'] . "' ORDER BY pa.attributes_stock");
}
?>
</table><table width="720"><tr><td> </td></tr><tr><td><font color="ff0000"><b>Artikelattribute</b></font></td></tr>
<?php
$products_query = xtc_db_query("SELECT p.products_id, p.products_quantity, p.products_model, pd.products_name FROM " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd WHERE pd.language_id = '" . $_SESSION['languages_id'] . "' AND pd.products_id = p.products_id ORDER BY products_model" );
while ($products_values = xtc_db_fetch_array($products_query)) {
$products_attributes_query = xtc_db_query("SELECT
pov.products_options_values_name,
pa.attributes_stock
FROM
" . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov
WHERE
pa.products_id = '".$products_values['products_id'] . "' AND pov.products_options_values_id = pa.options_values_id AND pov.language_id = '" . $_SESSION['languages_id'] . "' AND pa.attributes_stock <=0 ORDER BY pa.attributes_stock");
while ($products_attributes_values = xtc_db_fetch_array($products_attributes_query)) {
echo '<tr><td width="30%" class="dataTableContent"><b>' . $products_values['products_model'] . ' -' . $products_attributes_values['products_options_values_name'] . '</b></td><td width="68%" class="dataTableContent">' . $products_values['products_name'] . '</td><td width="2%" class="dataTableContent">';
if ($products_attributes_values['attributes_stock'] <= '0') {
echo '<font color="ff0000"><b>' . $products_attributes_values['attributes_stock'] . '</b></font>';
} else {
echo $products_attributes_values['attributes_stock'];
}
echo '</td></tr>';
}
}
?>
</table></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table></td>
<!-- body_text_eof //-->
</tr>
</table>
<!-- body_eof //-->
<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
Und nicht vergessen vorher ein Backup durchfuehren
Have fun
Arnie