'ets_rv_product_comment_video', 'primary' => 'id_ets_rv_product_comment_video', 'multilang' => false, 'fields' => array( 'id_ets_rv_product_comment' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'), 'video' => array('type' => self::TYPE_STRING, 'validate' => 'isString'), 'type' => array('type' => self::TYPE_STRING, 'validate' => 'isString'), 'position' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'), ), ); public function getLastPosition($id_ets_rv_product_comment) { return ($lastItem = (int)Db::getInstance()->getValue('SELECT `position` FROM `' . _DB_PREFIX_ . 'ets_rv_product_comment_image` WHERE id_ets_rv_product_comment=' . (int)$id_ets_rv_product_comment . ' ORDER BY `position` DESC')) ? $lastItem : 0; } public static function getVideos($product_comment_id,$count= false) { if (!Validate::isUnsignedInt($product_comment_id)) { return false; } $qr = 'FROM `' . _DB_PREFIX_ . 'ets_rv_product_comment_video` WHERE `id_ets_rv_product_comment` = ' . (int)$product_comment_id . ' ORDER BY `position` ASC'; return $count ? (int)Db::getInstance()->getValue('SELECT COUNT(*) ' . $qr) : Db::getInstance()->executeS('SELECT * ' . $qr); } public function delete() { if (parent::delete()) { if (@is_dir(($dirname = _PS_IMG_DIR_ . 'ets_reviews/r/'))) { if (@file_exists($dirname . $this->video)) { @unlink($dirname . $this->video); } } } return true; } }