diff --git a/controllers/front/ListComments.php b/controllers/front/ListComments.php index 888650b7..8cd0c9f9 100644 --- a/controllers/front/ListComments.php +++ b/controllers/front/ListComments.php @@ -63,6 +63,7 @@ public function display() $productComment['title'] = htmlentities($productComment['title']); $productComment['content'] = htmlentities($productComment['content']); $productComment['date_add'] = $dateFormatter->format($dateAdd); + $productComment['date_add_ISO_8601'] = $dateAdd->format('c'); // The customer has firstname and lastname, for guest we only have customer_name field $productComment['customer_name'] = !empty($productComment['customer_name']) diff --git a/views/js/list-comments.js b/views/js/list-comments.js index 697c9ec6..0a151448 100644 --- a/views/js/list-comments.js +++ b/views/js/list-comments.js @@ -97,16 +97,17 @@ jQuery(document).ready(function () { if (!customerName) { customerName = comment.firstname+' '+comment.lastname; } - commentTemplate = commentTemplate.replace(/@COMMENT_ID@/, comment.id_product_comment); - commentTemplate = commentTemplate.replace(/@PRODUCT_ID@/, comment.id_product); - commentTemplate = commentTemplate.replace(/@CUSTOMER_NAME@/, customerName); - commentTemplate = commentTemplate.replace(/@COMMENT_DATE@/, comment.date_add); - commentTemplate = commentTemplate.replace(/@COMMENT_TITLE@/, comment.title); - commentTemplate = commentTemplate.replace(/@COMMENT_COMMENT@/, comment.content); - commentTemplate = commentTemplate.replace(/@COMMENT_USEFUL_ADVICES@/, comment.usefulness); - commentTemplate = commentTemplate.replace(/@COMMENT_GRADE@/, comment.grade); - commentTemplate = commentTemplate.replace(/@COMMENT_NOT_USEFUL_ADVICES@/, (comment.total_usefulness - comment.usefulness)); - commentTemplate = commentTemplate.replace(/@COMMENT_TOTAL_ADVICES@/, comment.total_usefulness); + commentTemplate = commentTemplate.replaceAll(/@COMMENT_ID@/g, comment.id_product_comment); + commentTemplate = commentTemplate.replaceAll(/@PRODUCT_ID@/g, comment.id_product); + commentTemplate = commentTemplate.replaceAll(/@CUSTOMER_NAME@/g, customerName); + commentTemplate = commentTemplate.replaceAll(/@COMMENT_DATE@/g, comment.date_add); + commentTemplate = commentTemplate.replaceAll(/@COMMENT_DATE_ISO_8601@/g, comment.date_add_ISO_8601); + commentTemplate = commentTemplate.replaceAll(/@COMMENT_TITLE@/g, comment.title); + commentTemplate = commentTemplate.replaceAll(/@COMMENT_COMMENT@/g, comment.content); + commentTemplate = commentTemplate.replaceAll(/@COMMENT_USEFUL_ADVICES@/g, comment.usefulness); + commentTemplate = commentTemplate.replaceAll(/@COMMENT_GRADE@/g, comment.grade); + commentTemplate = commentTemplate.replaceAll(/@COMMENT_NOT_USEFUL_ADVICES@/g, (comment.total_usefulness - comment.usefulness)); + commentTemplate = commentTemplate.replaceAll(/@COMMENT_TOTAL_ADVICES@/g, comment.total_usefulness); const $comment = $(commentTemplate); $('.grade-stars', $comment).rating({ diff --git a/views/templates/hook/product-comment-item-prototype.tpl b/views/templates/hook/product-comment-item-prototype.tpl index 7b21984a..23d30b36 100644 --- a/views/templates/hook/product-comment-item-prototype.tpl +++ b/views/templates/hook/product-comment-item-prototype.tpl @@ -23,20 +23,26 @@ * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) *} -
+
-
+
+ + + +
+ -
+
-

@COMMENT_TITLE@

-

@COMMENT_COMMENT@

+

@COMMENT_TITLE@

+

@COMMENT_COMMENT@

{if $usefulness_enabled}