@@ -190,21 +190,6 @@ public static function getRatings($id_product)
190190 return Db::getInstance ((bool ) _PS_USE_SQL_SLAVE_ )->getRow ($ sql );
191191 }
192192
193- /**
194- * @deprecated 4.0.0
195- */
196- public static function getAverageGrade ($ id_product )
197- {
198- $ validate = Configuration::get ('PRODUCT_COMMENTS_MODERATE ' );
199-
200- return Db::getInstance ((bool ) _PS_USE_SQL_SLAVE_ )->getRow ('
201- SELECT AVG(pc.`grade`) AS grade
202- FROM ` ' . _DB_PREFIX_ . 'product_comment` pc
203- WHERE pc.`id_product` = ' . (int ) $ id_product . '
204- AND pc.`deleted` = 0 ' .
205- ($ validate == '1 ' ? ' AND pc.`validate` = 1 ' : '' ));
206- }
207-
208193 public static function getAveragesByProduct ($ id_product , $ id_lang )
209194 {
210195 /* Get all grades */
@@ -234,31 +219,6 @@ public static function getAveragesByProduct($id_product, $id_lang)
234219 return $ averages ;
235220 }
236221
237- /**
238- * Return number of comments and average grade by products
239- *
240- * @return int|false
241- *
242- * @deprecated 4.0.0
243- */
244- public static function getCommentNumber ($ id_product )
245- {
246- if (!Validate::isUnsignedId ($ id_product )) {
247- return false ;
248- }
249- $ validate = (bool ) Configuration::get ('PRODUCT_COMMENTS_MODERATE ' );
250- $ cache_id = 'ProductComment::getCommentNumber_ ' . $ id_product . '- ' . $ validate ;
251- if (!Cache::isStored ($ cache_id )) {
252- $ result = (int ) Db::getInstance ((bool ) _PS_USE_SQL_SLAVE_ )->getValue ('
253- SELECT COUNT(`id_product_comment`) AS "nbr"
254- FROM ` ' . _DB_PREFIX_ . 'product_comment` pc
255- WHERE `id_product` = ' . $ id_product . ($ validate ? ' AND `validate` = 1 ' : '' ));
256- Cache::store ($ cache_id , (string ) $ result );
257- }
258-
259- return (int ) Cache::retrieve ($ cache_id );
260- }
261-
262222 /**
263223 * Return number of comments and average grade by products
264224 *
@@ -434,66 +394,6 @@ public static function deleteUsefulness($id_product_comment)
434394 WHERE `id_product_comment` = ' . $ id_product_comment );
435395 }
436396
437- /**
438- * Report comment
439- *
440- * @return bool
441- *
442- * @deprecated 4.0.0 - migrated to controllers/front/ReportComment and src/Entity/ProductCommentReport
443- */
444- public static function reportComment ($ id_product_comment , $ id_customer )
445- {
446- return Db::getInstance ()->execute ('
447- INSERT INTO ` ' . _DB_PREFIX_ . 'product_comment_report` (`id_product_comment`, `id_customer`)
448- VALUES ( ' . (int ) $ id_product_comment . ', ' . (int ) $ id_customer . ') ' );
449- }
450-
451- /**
452- * Comment already report
453- *
454- * @return bool
455- *
456- * @deprecated 4.0.0 - migrated to controllers/front/ReportComment and src/Entity/ProductCommentReport
457- */
458- public static function isAlreadyReport ($ id_product_comment , $ id_customer )
459- {
460- return (bool ) Db::getInstance ()->getValue ('
461- SELECT COUNT(*)
462- FROM ` ' . _DB_PREFIX_ . 'product_comment_report`
463- WHERE `id_customer` = ' . (int ) $ id_customer . '
464- AND `id_product_comment` = ' . (int ) $ id_product_comment );
465- }
466-
467- /**
468- * Set comment usefulness
469- *
470- * @return bool
471- *
472- * @deprecated 4.0.0 - migrated to controllers/front/UpdateCommentUsefulness and src/Entity/ProductCommentUsefulness
473- */
474- public static function setCommentUsefulness ($ id_product_comment , $ usefulness , $ id_customer )
475- {
476- return Db::getInstance ()->execute ('
477- INSERT INTO ` ' . _DB_PREFIX_ . 'product_comment_usefulness` (`id_product_comment`, `usefulness`, `id_customer`)
478- VALUES ( ' . (int ) $ id_product_comment . ', ' . (int ) $ usefulness . ', ' . (int ) $ id_customer . ') ' );
479- }
480-
481- /**
482- * Usefulness already set
483- *
484- * @return bool
485- *
486- * @deprecated 4.0.0 - migrated to controllers/front/UpdateCommentUsefulness and src/Entity/ProductCommentUsefulness
487- */
488- public static function isAlreadyUsefulness ($ id_product_comment , $ id_customer )
489- {
490- return (bool ) Db::getInstance ()->getValue ('
491- SELECT COUNT(*)
492- FROM ` ' . _DB_PREFIX_ . 'product_comment_usefulness`
493- WHERE `id_customer` = ' . (int ) $ id_customer . '
494- AND `id_product_comment` = ' . (int ) $ id_product_comment );
495- }
496-
497397 /**
498398 * Get reported comments
499399 *
0 commit comments