/** * @param Product $product */ private function saveImages($product) { if ($product->isImagesModified()) { $this->getDb()->query("DELETE FROM product_image WHERE product_id = '" . (int) $product->getId() . "'"); foreach ($product->getImages() as $product_image) { $this->getDb()->query("INSERT INTO product_image SET product_id = '" . (int) $product->getId() . "', image = '" . $this->getDb()->escape($product_image['image']) . "', sort_order = '" . (int) $product_image['sort_order'] . "'"); } } }