Contributions
Low Stock Report
The purpose of this package is to show a report page of the products stock level, signaling those who are below the stock re-order level, allowing then to modify the stock value entering into the product edit page.
| Greg Santo | 26 Apr 2005 |
Low Stock Notifications
NOTE: You must have the "Low Stock Report" contribution installed properly for this to function properly.
Description:
This contribution displays the number of items that need restocking in two places in the administrative area. On the administrative homepage, in the "Statistics" box on the left side, there will be a link that says "Re-Stock: 12" (where 12 is replaced by the number of items in need of restocking. If the "Check stock level" variable is set to FALSE, then the number will be replace with N/A). Clicking on this link will take you to the "Low Stock Report" contribution's stock editing page.
The second link is displayed at the top of ALL other pages in the administrative panel in the form of an error message. The link will appear in the error style (with a red background by default) and will say "You have at least one item that must be re-stocked! (Click Here to Re-Stock)" and will take you to the same page as mentioned above when you click on it. The reason for displaying it in the form of an error is so there is no way it will be missed.
NOTE: This contribution can be turned on/off with the "Configuration->Stock->Check Stock Level" variable.
-------------------------------------
Installation:
Extremely easy, requires the addition of a few lines to two files ...
1. Find the file "admin/includes/application_top.php"
** IMPORTANT: You must have the line "define('FILENAME_STATS_LOW_STOCK', 'stats_low_stock.php');" (from the "Low Stock Report" contribution) already in
application_top.php for this to function correctly **
All the way at the bottom right before the last "?>" add the following lines:
if (STOCK_CHECK == 'true') {
$products_query_raw = strtolower("select p.products_quantity" . " from " . TABLE_PRODUCTS. " p" .
" where p.products_quantity <= " . STOCK_REORDER_LEVEL);
$products_query = tep_db_query($products_query_raw);
$products = tep_db_fetch_array($products_query);
if($products['products_quantity'] != NULL)
$messageStack->add('<a href="' . tep_href_link(FILENAME_STATS_LOW_STOCK, '', 'NONSSL') . '">' .
'You have at least one item that must be re-stocked! (Click Here to Re-Stock)' .
'</a>', 'error');
}
2. Find the file "admin/index.php"
Find the line (near line 159)
$reviews = tep_db_fetch_array($reviews_query);
Add the following lines after it:
if (STOCK_CHECK == 'true') {
$stock_query = tep_db_query("select p.products_quantity" . " from " . TABLE_PRODUCTS. " p" . " where p.products_quantity <= " .
STOCK_REORDER_LEVEL);
$totalRestock = 0;
while($stock = tep_db_fetch_array($stock_query))
{
$totalRestock++;
}
}
else $totalRestock = 'N/A';
Find the line (near line 170)
BOX_ENTRY_REVIEWS . ' ' . $reviews['count']);
REPLACE it with
BOX_ENTRY_REVIEWS . ' ' . $reviews['count'] . '<br>' .
'<a href="' . tep_href_link(FILENAME_STATS_LOW_STOCK, '', 'NONSSL') . '">' . 'Re-Stock' . '</a>' . ': ' . $totalRestock);
3. You are done, note you must have "Configuration->Stock->Check Stock Level" variable set to TRUE to see these working properly. If you see "Re-Stock: N/A"
on the "Statistics" box on the administrative homepage then you have that variable set to FALSE.
| Fabius | 17 Mar 2003 |
| Fabius | 4 Feb 2003 |
Note: Contributions are used at own risk.
