/** * Removes (order)products from the database for $orderId which are not in the ISC_QUOTE instance $quote * * @param int $orderId * @param ISC_QUOTE $quote * @return bool false on failure otherwise true */ public function deleteUnusedOrderProducts($orderId, ISC_QUOTE $quote) { $orderId = (int)$orderId; $products = $this->db->Query("SELECT `orderprodid` FROM [|PREFIX|]order_products WHERE orderorderid = " . $orderId); if (!$products) { return false; } while ($product = $this->db->Fetch($products)) { $quoteProduct = $quote->getItemById($product['orderprodid']); if ($quoteProduct) { // product is still in the quote continue; } if (!$this->deleteOrderProduct($product['orderprodid'])) { return false; } } return true; }