Inventory quantity update and sort error (v. 2.9 - 2.91)

An error is appearing in the inventory quantity update area, and the product sort is not sticking.

  1. Open the itemlist.php file in the /storeadmin/ folder.

  2. Change the code (around line 222):

    $attinv_db = nullornot($currattrow [0]);

    to:

    $attinv_db = nullornot($currattrow['Quantity']);
  3. Change the code (around line 299):

  4. $catsearchquery = "SELECT Category FROM " .SB_DB_PREFIX ."_categories WHERE ID='$catsearch'";
    $catsearchresult = $dataconn->query($catsearchquery);

    to:

    $catsearch = (int)$catsearch;
    $catsearchresult = $dataconn->query("SELECT Category FROM " .SB_DB_PREFIX ."_categories WHERE ID='$catsearch'");
  5. Change the code (around line 306):

    $itemquery .= " AND (Category1='$catsearch' OR Category2='$catsearch' OR Category3='$catsearch' OR Category4='$catsearch' OR Category5='$catsearch' OR Category6 = '$catsearch' OR Category7 = '$catsearch' OR Category8 = '$catsearch' OR Category9 = '$catsearch' OR Category10 = '$catsearch' OR Category11 = '$catsearch' OR Category12 = '$catsearch' OR Category13 = '$catsearch' OR Category14 = '$catsearch' OR Category15 = '$catsearch'";
    $subquery = "SELECT Category, ID FROM " .SB_DB_PREFIX ."_categories WHERE Parent='$catsearch'";
    $subresult = $dataconn->query($subquery);
    if ($subresult->num_rows > 0)
    {
    while ($subrow = $subresult->fetch_assoc())
    {
    $itemquery .= " OR Category1='$subrow[Category]' OR Category2='$subrow[Category]' OR Category3='$subrow[Category]' OR Category4='$subrow[Category]' OR Category5='$subrow[Category]' OR Category6 = '$subrow[Category]' OR Category7 = '$subrow[Category]' OR Category8 = '$subrow[Category]' OR Category9 = '$subrow[Category]' OR Category10 = '$subrow[Category]' OR Category11 = '$subrow[Category]' OR Category12 = '$subrow[Category]' OR Category13 = '$subrow[Category]' OR Category14 = '$subrow[Category]' OR Category15 = '$subrow[Category]'";
    $endquery = "SELECT Category, ID FROM " .SB_DB_PREFIX ."_categories WHERE Parent='$subrow[Category]'";
    $endresult = $dataconn->query($endquery);
    if ($endresult->num_rows > 0)
    {
    while ($endrow = $endresult->fetch_assoc())
    {
    $itemquery .= " OR Category1='$endrow[Category]' OR Category2='$endrow[Category]' OR Category3='$endrow[Category]' OR Category4='$endrow[Category]' OR Category5='$endrow[Category]' OR Category6 = '$endrow[Category]' OR Category7 = '$endrow[Category]' OR Category8 = '$endrow[Category]' OR Category9 = '$endrow[Category]' OR Category10 = '$endrow[Category]' OR Category11 = '$endrow[Category]' OR Category12 = '$endrow[Category]' OR Category13 = '$endrow[Category]' OR Category14 = '$endrow[Category]' OR Category15 = '$endrow[Category]'";
    }
    }
    }
    }
    $itemquery .= ")";

    to:

    $itemquery .= " AND (Category1='$catsearch' OR Category2='$catsearch' OR Category3='$catsearch' OR Category4='$catsearch' OR Category5='$catsearch' OR Category6 = '$catsearch' OR Category7 = '$catsearch' OR Category8 = '$catsearch' OR Category9 = '$catsearch' OR Category10 = '$catsearch' OR Category11 = '$catsearch' OR Category12 = '$catsearch' OR Category13 = '$catsearch' OR Category14 = '$catsearch' OR Category15 = '$catsearch')";
  6. Change the code (around line ):

    if (!empty($catsearch))
    echo "";

    to:

    if (!empty($linkinfo))
    {
    $exp_linkinfo = explode('&', $linkinfo);
    foreach($exp_linkinfo AS $lnk_attlist)
    {
    $lnk_atts = explode('=',$lnk_attlist);
    $lnk_att = $lnk_atts[0];
    $lnk_val = (isset($lnk_atts[1])) ? $lnk_atts[1] : '';
    if (isset($_REQUEST[$lnk_att]) AND !empty($lnk_val))
    echo "";
    }
    }
    echo "";
  7. Open the helpbuttons.php file in the /includes/ folder of the /storeadmin/ directory.

    Change the line:

    if (!empty($_REQUEST['itemid']) AND substr($_REQUEST['Submit'], 0, 3) != 'Yes')

    to:

    if (!empty($_REQUEST['itemid']) AND !is_array($_REQUEST['itemid']) AND substr($_REQUEST['Submit'], 0, 3) != 'Yes')