I am developing a new shopping cart using the cubecart system, the client has about 2500 parts in the database. After importing these products into the database I noticed that a good 500 were mis categorized and about 100 were out of date and had to be removed. Cubecart didnt have any support for multi re-categorize or multiple deletes so I created the following hack. This hack will allow you to check off all the products on the product view page and do 2 different things. Either delete the selected products or move the selected products to a different category. To enable this hack in your cubecart admin panel paste the code in the following areas . in the file /admin/products/index.php <------------------Find:----------------------> include("../../includes/currencyVars.inc.php"); <------------------ Add under: ----------------------> // worcester wide web multi delete / reorder echo ''; if ($_GET['multifunction'] == '1'){ if ($_POST['operation'] == 'delete'){ $db = new db(); $delete = $_POST['order']; $deletesep = implode(",", $delete); $where = "productId IN (".$deletesep.")"; $delete = $db->delete($glob['dbprefix']."CubeCart_inventory", $where); $delete = $db->delete($glob['dbprefix']."CubeCart_cats_idx", $where); // fix cat count $maxdepth = 4; if(isset($_GET['page'])){ $page = $_GET['page']; } else { $page = 0; } $query = "SELECT * FROM ".$glob['dbprefix']."CubeCart_category WHERE 1"; $results = $db->select($query, $catsPerPage, $page); $numrows = $db->numrows($query); for ($i=0; $inumrows($query); $quantity[$thiscat] += $qtytoadd; $fathercat = $results[$i]['cat_father_id']; while($fathercat != 0){ $query2 = "SELECT cat_father_id FROM ".$glob['dbprefix']."CubeCart_category WHERE cat_id = '$thiscat'"; $results2 = $db->select($query2); $fathercat = $results2[0]['cat_father_id']; if($fathercat != 0){ $quantity[$fathercat] += $qtytoadd; } $thiscat = $fathercat; } } for ($i=0; $inumrows($query); $cellColor = ""; $cellColor = cellColor($i); $record1["noProducts"] = $db->mySQLSafe($quantity[$thiscat]); $where1 = "cat_id=".$db->mySQLSafe($thiscat); $update = $db->update($glob['dbprefix']."CubeCart_category", $record1, $where1); } //end fix cat count }elseif ($_POST['operation'] == 'reorder'){ $db = new db(); $ordered = $_POST['order']; $orderedsep = implode(",", $ordered); $cat_id = $_POST['cat_id']; $where = "productId IN (".$orderedsep.")"; $record = 'cat_id = \''.$cat_id.'\''; $update = $db->updatespecial($glob['dbprefix']."CubeCart_inventory", $record, $where); $update = $db->updatespecial($glob['dbprefix']."CubeCart_cats_idx", $record, $where); // fix cat count $maxdepth = 4; if(isset($_GET['page'])){ $page = $_GET['page']; } else { $page = 0; } $query = "SELECT * FROM ".$glob['dbprefix']."CubeCart_category WHERE 1"; $results = $db->select($query, $catsPerPage, $page); $numrows = $db->numrows($query); for ($i=0; $inumrows($query); $quantity[$thiscat] += $qtytoadd; $fathercat = $results[$i]['cat_father_id']; while($fathercat != 0){ $query2 = "SELECT cat_father_id FROM ".$glob['dbprefix']."CubeCart_category WHERE cat_id = '$thiscat'"; $results2 = $db->select($query2); $fathercat = $results2[0]['cat_father_id']; if($fathercat != 0){ $quantity[$fathercat] += $qtytoadd; } $thiscat = $fathercat; } } for ($i=0; $inumrows($query); $cellColor = ""; $cellColor = cellColor($i); $record1["noProducts"] = $db->mySQLSafe($quantity[$thiscat]); $where1 = "cat_id=".$db->mySQLSafe($thiscat); $update = $db->update($glob['dbprefix']."CubeCart_category", $record1, $where1); } //end fix cat count }else{ echo ''; } } // worcester wide web multi delete / reorder <------------------Find:---------------------->

<------------------ Replace With: ---------------------->

<------------------Find:----------------------> <------------------ Add above:----------------------> <------------------Find:---------------------->
<------------------ Replace with: ----------------------> Check All | Uncheck All <------------------ open up /classes/db.inc.php ----------------------> <------------------find ----------------------> } // end update <------------------ Under add: ----------------------> function updatespecial ($tablename, $record, $where) { $query = "UPDATE ".$tablename." SET ".$record." WHERE ".$where; $this->query = $query; mysql_query($query, $this->db); if ($this->error()) die ($this->debug()); if ($this->affected() > 0) return true; else return false; } // end update special (non array) <------------------ ----------------------> That should do it, if you have any problems please let me know.