This shows you the differences between two versions of the page.
| — |
tutorials:zencartmods:stashqty.html [2016/01/28 18:05] (current) |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== 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) | ||
| + | <code> | ||
| + | return $stock_values->fields['products_quantity']; | ||
| + | </code> | ||
| + | and replace it with | ||
| + | <code php> | ||
| + | return $stock_values->fields['products_quantity'] - STOCK_OFFSET; | ||
| + | </code> | ||
| + | |||
| + | in **/includes/functions/functions_general.php** | ||
| + | |||
| + | find (line 130) | ||
| + | <code php> | ||
| + | $button_check = $db->Execute("select product_is_call, products_quantity from " . TABLE_PRODUCTS . " where products_id = '" . (int)$product_id . "'"); | ||
| + | </code> | ||
| + | |||
| + | and add a line below it so that it is looks like: | ||
| + | <code php> | ||
| + | $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); | ||
| + | </code> | ||
| + | |||
| + | |||
| + | in **/includes/modules/product_info.php** | ||
| + | |||
| + | find (line 77) | ||
| + | <code php> | ||
| + | while (!$listing->EOF) { | ||
| + | $rows++; | ||
| + | </code> | ||
| + | and replace with | ||
| + | <code php> | ||
| + | while (!$listing->EOF) { | ||
| + | $rows++; | ||
| + | $listing->fields['products_quantity'] = zen_get_products_stock($listing->fields['products_id']); | ||
| + | </code> | ||
| + | |||
| + | |||
| + | in **/includes/modules/pages/product_info/main_template_vars.php** | ||
| + | |||
| + | find (line 115) | ||
| + | <code php> | ||
| + | $products_quantity = $product_info->fields['products_quantity']; | ||
| + | </code> | ||
| + | |||
| + | and replace it with | ||
| + | <code php> | ||
| + | // Stock Offset Mod | ||
| + | $products_quantity = zen_get_products_stock($product_id); | ||
| + | </code> | ||