/** * @param Product $product */ private function saveDiscounts($product) { if ($product->isDiscountsModified()) { $this->getDb()->query("DELETE FROM product_discount WHERE product_id = '" . (int) $product->getId() . "'"); foreach ($product->getDiscounts() as $product_discount) { $this->getDb()->query("INSERT INTO product_discount SET product_id = '" . (int) $product->getId() . "', customer_group_id = '" . (int) $product_discount['customer_group_id'] . "', quantity = '" . (int) $product_discount['quantity'] . "', priority = '" . (int) $product_discount['priority'] . "', price = '" . (double) $product_discount['price'] . "', date_start = '" . $this->getDb()->escape($product_discount['date_start']) . "', date_end = '" . $this->getDb()->escape($product_discount['date_end']) . "'"); } } }