/** * function deleteProduct deletes one product given by parameter and deletes * also all images of this product * * @param int $product_id id of product * @return void */ public function deleteProduct($product_id) { $imageModel = new ModuleSimpleEshopImages($this->database); $images = $imageModel->getImagesByProductID($product_id); foreach ($images as $image) { $image->delete(); } $this->delete($product_id); }
/** * function getImages gets all images of one product given by parameter * $product_id * * @param int $enabled if we want onlz enabled images * @param int $product_id id of product * @return \Nette\Database\Table\Selection images */ public function getImages($product_id, $enabled = NULL) { $imageModel = new ModuleSimpleEshopImages($this->database); return $imageModel->getImagesByProductID($product_id, $enabled); }