From 0d48b076699a664f5d82ba34bd366e82d84fe761 Mon Sep 17 00:00:00 2001 From: tblivet Date: Fri, 15 Dec 2023 19:00:40 +0100 Subject: [PATCH] fix: productcomments Make productcomments work again, and small display improvements has been added --- .../templates/hook/average-grade-stars.tpl | 15 +++ .../templates/hook/empty-product-comment.tpl | 2 +- .../templates/hook/post-comment-modal.tpl | 14 +-- .../hook/product-additional-info.tpl | 31 ++++++ .../templates/hook/product-comments-list.tpl | 53 +++++---- src/scss/core/modules/_index.scss | 1 + src/scss/core/modules/_productcomments.scss | 103 ++++++++++++++++++ .../catalog/_partials/miniatures/product.tpl | 4 +- 8 files changed, 190 insertions(+), 33 deletions(-) create mode 100644 modules/productcomments/views/templates/hook/average-grade-stars.tpl create mode 100644 modules/productcomments/views/templates/hook/product-additional-info.tpl create mode 100644 src/scss/core/modules/_productcomments.scss diff --git a/modules/productcomments/views/templates/hook/average-grade-stars.tpl b/modules/productcomments/views/templates/hook/average-grade-stars.tpl new file mode 100644 index 000000000..fc99bebdb --- /dev/null +++ b/modules/productcomments/views/templates/hook/average-grade-stars.tpl @@ -0,0 +1,15 @@ +{** + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + *} + +{if $nb_comments != 0} +
+
+ {if isset($showNbComments) && $showNbComments} +
({$nb_comments})
+ {elseif isset($showGradeAverage) && $showGradeAverage} +
({$grade|number_format:1})
+ {/if} +
+{/if} diff --git a/modules/productcomments/views/templates/hook/empty-product-comment.tpl b/modules/productcomments/views/templates/hook/empty-product-comment.tpl index 314582606..dd6f3ffa3 100644 --- a/modules/productcomments/views/templates/hook/empty-product-comment.tpl +++ b/modules/productcomments/views/templates/hook/empty-product-comment.tpl @@ -3,7 +3,7 @@ * file that was distributed with this source code. *} -
+
{if $post_allowed} + {/if} + {else} + {include file='module:productcomments/views/templates/hook/average-grade-stars.tpl' grade=$average_grade showGradeAverage=true} + + {/if} +
+{/if} diff --git a/modules/productcomments/views/templates/hook/product-comments-list.tpl b/modules/productcomments/views/templates/hook/product-comments-list.tpl index 730061c89..9fcc350d4 100644 --- a/modules/productcomments/views/templates/hook/product-comments-list.tpl +++ b/modules/productcomments/views/templates/hook/product-comments-list.tpl @@ -2,42 +2,49 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. *} + -
-
-
- - {l s='Comments' d='Modules.Productcomments.Shop'} ({$nb_comments}) -
- {include file='module:productcomments/views/templates/hook/average-grade-stars.tpl' grade=$average_grade} +
+
+ {l s='Comments' d='Modules.Productcomments.Shop'} ({$nb_comments})
+ {include file='module:productcomments/views/templates/hook/average-grade-stars.tpl' grade=$average_grade showGradeAverage=true showNbComments=false}
{include file='module:productcomments/views/templates/hook/product-comment-item-prototype.tpl' assign="comment_prototype"} {include file='module:productcomments/views/templates/hook/empty-product-comment.tpl'} -
-
-
+ +
-
-