====== Stashing inventory ======
This mod will let you 'save' 3 (or whatever #) pieces of inventory of each item. So if the true inventory is 50 pieces, the store will act like there is only 47. This will let you keep a stash around in case you need extras to replace customer's damaged or lost packages, or if your inventory is off by a few pieces.
For example, we have 83 Mintyboosts in stock:
{{:zencartmods:trueinventory.gif|}}
But the cart displays only 80:
{{:zencartmods:stashedinventory.gif|}}
===== New Files =====
We'll be using the same file as the "Show IN STOCK over 100 quantity" mod above
===== Change Settings =====
Change the same settings as the "Show IN STOCK over 100 quantity" mod above
===== Code changes =====
Files changed: **/includes/functions/functions_lookups.php \\
/includes/functions/functions_general.php \\
/includes/modules/product_listing.php \\
/includes/modules/pages/product_info/main_template_vars.php**
in **/includes/functions/functions_lookups.php**
find (line 172)
return $stock_values->fields['products_quantity'];
and replace it with
return $stock_values->fields['products_quantity'] - STOCK_OFFSET;
in **/includes/functions/functions_general.php**
find (line 130)
$button_check = $db->Execute("select product_is_call, products_quantity from " . TABLE_PRODUCTS . " where products_id = '" . (int)$product_id . "'");
and add a line below it so that it is looks like:
$button_check = $db->Execute("select product_is_call, products_quantity from " . TABLE_PRODUCTS . " where products_id = '" . (int)$product_id . "'");
$button_check->fields['products_quantity'] = zen_get_products_stock($product_id);
in **/includes/modules/product_info.php**
find (line 77)
while (!$listing->EOF) {
$rows++;
and replace with
while (!$listing->EOF) {
$rows++;
$listing->fields['products_quantity'] = zen_get_products_stock($listing->fields['products_id']);
in **/includes/modules/pages/product_info/main_template_vars.php**
find (line 115)
$products_quantity = $product_info->fields['products_quantity'];
and replace it with
// Stock Offset Mod
$products_quantity = zen_get_products_stock($product_id);