Updated Mals Inventory Stock Limit Feature (v. 2.83)

Mals has adjusted code to allow for a product inventory stock limit in the cart. If someone orders an item with a certain quantity in stock, and later changes that value in the cart, they will not be able to increase that quantity. To use this new feature, you can apply the following modification (only tested in 2.83-2.84; this update has been included in version 2.9 and higher):

  1. Open the order.php file in the /go/ folder.

  2. Around line 9, change the code:

    $inv_inc_amt = "";

    to:

    $inv_inc_amt = "X";

    Note that the value must be a capital X.

  3. Around line 437, change the code:

    if ($inventorycheck != "No"  AND $chkrow[0] > 0 AND is_int($inv_inc_amt))

    to:

    if ($inventorycheck != "No"  AND $chkrow[0] > 0 AND (is_int($inv_inc_amt) OR $inv_inc_amt == 'X'))
  4. Around line 446, change the code:

    if ($run_countex <= $chkrow[0])

    to:

    if ($run_countex <= $chkrow[0] AND $exp_disc[0] > 0)
  5. Around line 494, change the code:

    else if ($inventorycheck != "No"  AND $chkrow[0] > 0 AND is_int($inv_inc_amt))
    $gotolink .= "&discountpr=$chkrow[0]," .number_format((float)$price, 2, '.', '') .":0," .number_format((float)$inv_inc_amt, 2, '.', '');

    to:

    else if ($inventorycheck != "No"  AND $chkrow[0] > 0 AND (is_int($inv_inc_amt) OR $inv_inc_amt == 'X'))
    $gotolink .= "&discountpr=$chkrow[0]," .number_format((float)$price, 2, '.', '') .":0," .$inv_inc_amt;
  6. If you want to remove the check box next to the quantity in the cart (which is no longer needed with this modification) and use a standard quantity field instead, around line 532, change the code:

    if ($inventorycheck != "No")
    $gotolink .= "&noqty=3";

    to:

    // if ($inventorycheck != "No")
    // $gotolink .= "&noqty=3";
  7. Save and update the order.php file.

Note that this modification will only affect items that have stock quantities greater than zero, and only if the Inv Check field is set to 'Yes' in the Catalog Setup.