Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions controllers/front/ListComments.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'])
Expand Down
21 changes: 11 additions & 10 deletions views/js/list-comments.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
16 changes: 11 additions & 5 deletions views/templates/hook/product-comment-item-prototype.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,26 @@
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*}

<div class="product-comment-list-item row" data-product-comment-id="@COMMENT_ID@" data-product-id="@PRODUCT_ID@">
<div class="product-comment-list-item row" data-product-comment-id="@COMMENT_ID@" data-product-id="@PRODUCT_ID@" itemprop="review" itemscope itemtype="https://schema.org/Review">
<div class="col-sm-3 comment-infos">
<div class="grade-stars" data-grade="@COMMENT_GRADE@"></div>
<div class="comment-date">
<div style="display:none" itemprop="reviewRating" itemscope itemtype="https://schema.org/Rating">
<meta itemprop="worstRating" content="1" />
<meta itemprop="ratingValue" content="@COMMENT_GRADE@" />
<meta itemprop="bestRating" content="5" />
</div>
<div class="comment-date" itemprop="datePublished" content="@COMMENT_DATE_ISO_8601@">
@COMMENT_DATE@
</div>
<div class="comment-author">
<div class="comment-author" itemprop="author" itemscope itemtype="https://schema.org/Person">
<meta itemprop="name" content="@CUSTOMER_NAME@" />
{l s='By %1$s' sprintf=['@CUSTOMER_NAME@'] d='Modules.Productcomments.Shop'}
</div>
</div>

<div class="col-sm-9 comment-content">
<p class="h4">@COMMENT_TITLE@</p>
<p>@COMMENT_COMMENT@</p>
<p class="h4" itemprop="name">@COMMENT_TITLE@</p>
<p itemprop="reviewBody">@COMMENT_COMMENT@</p>
<div class="comment-buttons btn-group">
{if $usefulness_enabled}
<a class="useful-review">
Expand Down