Skip to content

Commit

Permalink
Merge pull request #212 from tblivet/fix/update_quickview_note
Browse files Browse the repository at this point in the history
Fixed issues with updating the note in quickview and hook display on product update
  • Loading branch information
tblivet authored Jun 27, 2024
2 parents 3a68c46 + fe56da8 commit c093968
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
10 changes: 9 additions & 1 deletion productcomments.php
Original file line number Diff line number Diff line change
Expand Up @@ -1076,11 +1076,19 @@ public function renderWidget($hookName = null, array $configuration = [])
case 'quickview':
$filePath = $tplHookPath . 'product-additional-info-quickview.tpl';
break;
case 'refresh':
if (Tools::getValue('quickview') == true) {
$filePath = '';
} else {
$filePath = $tplHookPath . 'product-additional-info.tpl';
}
break;
case '':
$filePath = $tplHookPath . 'product-additional-info.tpl';
break;
default: // 'refresh' and other unpredicted cases
default:
$filePath = '';
break;
}
}

Expand Down
17 changes: 12 additions & 5 deletions views/templates/hook/product-additional-info-quickview.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,22 @@
*}

{if $nb_comments != 0}
<script type="text/javascript">
$('#product-quickview-{$product.id}').insertAfter($('.quickview #product-description-short'));
$('#product-quickview-{$product.id} .grade-stars').rating({ grade: {$average_grade} });
$('#product-quickview-{$product.id} .comments-nb').html('({$nb_comments})');
<script type="text/javascript">
function renderQuickViewNote() {
$('#product-quickview-{$product.id}').insertAfter($('.quickview #product-description-short'));
$('#product-quickview-{$product.id} .grade-stars').rating({ grade: {$average_grade} });
$('#product-quickview-{$product.id} .comments-nb').html('({$nb_comments})');
}
renderQuickViewNote();
prestashop.on('updatedProduct', function(){
renderQuickViewNote();
});
</script>
<div id="product-quickview-{$product.id}" class="product-quickview-review">
<div class="grade-stars"></div>
<div class="comments-nb"></div>
</div>
</div>
{/if}

0 comments on commit c093968

Please sign in to comment.