public static function deleteFileByType($product_id, $file_type)
 {
     $product_id = pSQL($product_id);
     $file_type = pSQL($file_type);
     // check if file exists in database
     $file = PrestaEbooksCore::findByType($product_id, $file_type);
     if (!empty($file)) {
         return false;
     }
     if (Db::getInstance()->delete('prestaebooks', 'product_id = "' . $product_id . '" and ebook_type = "' . $file_type . '"')) {
         return true;
     }
     return false;
 }
 public function getProductFiles($product_id)
 {
     $files = array();
     foreach ($this->file_types as $type) {
         $files[$type] = PrestaEbooksCore::findByType($product_id, $type);
     }
     return $files;
 }