feat(main): Add base theme: This is the falcon theme out of the box.
This is falcon v3.1.2
This commit is contained in:
34
falcon/modules/productcomments/index.php
Normal file
34
falcon/modules/productcomments/index.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright since 2007 PrestaShop SA and Contributors
|
||||
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
|
||||
* that is bundled with this package in the file LICENSE.md.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/licenses/AFL-3.0
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to https://devdocs.prestashop.com/ for more information.
|
||||
*
|
||||
* @author PrestaShop SA and Contributors <contact@prestashop.com>
|
||||
* @copyright Since 2007 PrestaShop SA and Contributors
|
||||
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
|
||||
*/
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
||||
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
|
||||
header('Location: ../');
|
||||
exit;
|
||||
34
falcon/modules/productcomments/views/css/index.php
Normal file
34
falcon/modules/productcomments/views/css/index.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright since 2007 PrestaShop SA and Contributors
|
||||
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
|
||||
* that is bundled with this package in the file LICENSE.md.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/licenses/AFL-3.0
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to https://devdocs.prestashop.com/ for more information.
|
||||
*
|
||||
* @author PrestaShop SA and Contributors <contact@prestashop.com>
|
||||
* @copyright Since 2007 PrestaShop SA and Contributors
|
||||
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
|
||||
*/
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
||||
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
|
||||
header('Location: ../');
|
||||
exit;
|
||||
@ -0,0 +1 @@
|
||||
/* EMPTY */
|
||||
34
falcon/modules/productcomments/views/img/index.php
Normal file
34
falcon/modules/productcomments/views/img/index.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright since 2007 PrestaShop SA and Contributors
|
||||
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
|
||||
* that is bundled with this package in the file LICENSE.md.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/licenses/AFL-3.0
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to https://devdocs.prestashop.com/ for more information.
|
||||
*
|
||||
* @author PrestaShop SA and Contributors <contact@prestashop.com>
|
||||
* @copyright Since 2007 PrestaShop SA and Contributors
|
||||
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
|
||||
*/
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
||||
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
|
||||
header('Location: ../');
|
||||
exit;
|
||||
BIN
falcon/modules/productcomments/views/img/small_stars.png
Normal file
BIN
falcon/modules/productcomments/views/img/small_stars.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.2 KiB |
3
falcon/modules/productcomments/views/img/star_active.svg
Normal file
3
falcon/modules/productcomments/views/img/star_active.svg
Normal file
@ -0,0 +1,3 @@
|
||||
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="1060" height="1024" viewBox="0 0 1060 1024">
|
||||
<path fill="#f49d72" d="M529.829 0l163.657 337.371 366.629 53.943-265.143 262.4 62.629 370.286-327.771-174.629-327.771 174.629 62.629-370.286-265.143-262.4 366.171-53.943z"></path>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 294 B |
3
falcon/modules/productcomments/views/img/star_gray.svg
Normal file
3
falcon/modules/productcomments/views/img/star_gray.svg
Normal file
@ -0,0 +1,3 @@
|
||||
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="1060" height="1024" viewBox="0 0 1060 1024">
|
||||
<path fill="#cacaca" d="M529.829 0l163.657 337.371 366.629 53.943-265.143 262.4 62.629 370.286-327.771-174.629-327.771 174.629 62.629-370.286-265.143-262.4 366.171-53.943z"></path>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 294 B |
BIN
falcon/modules/productcomments/views/img/stars.png
Normal file
BIN
falcon/modules/productcomments/views/img/stars.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
34
falcon/modules/productcomments/views/index.php
Normal file
34
falcon/modules/productcomments/views/index.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright since 2007 PrestaShop SA and Contributors
|
||||
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
|
||||
* that is bundled with this package in the file LICENSE.md.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/licenses/AFL-3.0
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to https://devdocs.prestashop.com/ for more information.
|
||||
*
|
||||
* @author PrestaShop SA and Contributors <contact@prestashop.com>
|
||||
* @copyright Since 2007 PrestaShop SA and Contributors
|
||||
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
|
||||
*/
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
||||
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
|
||||
header('Location: ../../');
|
||||
exit;
|
||||
34
falcon/modules/productcomments/views/js/index.php
Normal file
34
falcon/modules/productcomments/views/js/index.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright since 2007 PrestaShop SA and Contributors
|
||||
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
|
||||
* that is bundled with this package in the file LICENSE.md.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/licenses/AFL-3.0
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to https://devdocs.prestashop.com/ for more information.
|
||||
*
|
||||
* @author PrestaShop SA and Contributors <contact@prestashop.com>
|
||||
* @copyright Since 2007 PrestaShop SA and Contributors
|
||||
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
|
||||
*/
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
||||
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
|
||||
header('Location: ../');
|
||||
exit;
|
||||
164
falcon/modules/productcomments/views/js/jquery.rating.plugin.js
Normal file
164
falcon/modules/productcomments/views/js/jquery.rating.plugin.js
Normal file
@ -0,0 +1,164 @@
|
||||
/**
|
||||
* Copyright since 2007 PrestaShop SA and Contributors
|
||||
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
|
||||
* that is bundled with this package in the file LICENSE.md.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/licenses/AFL-3.0
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to https://devdocs.prestashop.com/ for more information.
|
||||
*
|
||||
* @author PrestaShop SA and Contributors <contact@prestashop.com>
|
||||
* @copyright Since 2007 PrestaShop SA and Contributors
|
||||
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
|
||||
*/
|
||||
|
||||
jQuery.fn.rating = function(generalOptions) {
|
||||
const $ratings = $(this);
|
||||
|
||||
$ratings.each(function initRating() {
|
||||
const $ratingComponent = $(this);
|
||||
var options = generalOptions ? generalOptions : {};
|
||||
const ratingAddedClass = 'js-rating-added';
|
||||
if (!options.grade && $ratingComponent.data('grade')) {
|
||||
options.grade = $ratingComponent.data('grade');
|
||||
}
|
||||
if (!options.min && $ratingComponent.data('min')) {
|
||||
options.min = $ratingComponent.data('min');
|
||||
}
|
||||
if (!options.max && $ratingComponent.data('max')) {
|
||||
options.max = $ratingComponent.data('max');
|
||||
}
|
||||
if (!options.input && $ratingComponent.data('input')) {
|
||||
options.input = $ratingComponent.data('input');
|
||||
}
|
||||
var componentOptions = jQuery.extend({
|
||||
grade: null,
|
||||
input: null,
|
||||
min: 1,
|
||||
max: 5,
|
||||
starWidth: 20
|
||||
}, options);
|
||||
|
||||
if ($ratingComponent.hasClass(ratingAddedClass)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const minValue = Math.min(componentOptions.min, componentOptions.max);
|
||||
const maxValue = Math.max(componentOptions.min, componentOptions.max);
|
||||
const ratingValue = Math.min(Math.max(minValue, componentOptions.grade), maxValue);
|
||||
|
||||
$ratingComponent.html('');
|
||||
$ratingComponent.append('<div class="star-content star-empty clearfix"></div>');
|
||||
$ratingComponent.append('<div class="star-content star-full clearfix"></div>');
|
||||
|
||||
const emptyStars = $('.star-empty', this);
|
||||
const fullStars = $('.star-full', this);
|
||||
const emptyStar = $('<div class="star"></div>');
|
||||
const fullStar = $('<div class="star-on"></div>');
|
||||
|
||||
var ratingInput;
|
||||
if (componentOptions.input) {
|
||||
ratingInput = $('<input type="number" name="'+componentOptions.input+'" id="'+componentOptions.input+'" />');
|
||||
ratingInput.val(ratingValue);
|
||||
ratingInput.css('display', 'none');
|
||||
ratingInput.change(displayInteractiveGrade);
|
||||
$ratingComponent.append(ratingInput);
|
||||
initInteractiveGrade();
|
||||
} else {
|
||||
displayGrade(ratingValue);
|
||||
}
|
||||
|
||||
function initInteractiveGrade() {
|
||||
emptyStars.html('');
|
||||
fullStars.html('');
|
||||
var newStar;
|
||||
for (var i = minValue; i <= maxValue; ++i) {
|
||||
newStar = emptyStar.clone();
|
||||
newStar.data('grade', i);
|
||||
newStar.hover(function overStar() {
|
||||
var overIndex = $('.star', fullStars).index($(this));
|
||||
$('.star', fullStars).each(function overStars() {
|
||||
$(this).removeClass('star-on');
|
||||
var starIndex = $('.star', fullStars).index($(this));
|
||||
if (starIndex <= overIndex) {
|
||||
$(this).addClass('star-hover');
|
||||
} else {
|
||||
$(this).removeClass('star-hover');
|
||||
}
|
||||
});
|
||||
});
|
||||
newStar.click(function selectGrade() {
|
||||
var selectedGrade = $(this).data('grade');
|
||||
ratingInput.val(selectedGrade);
|
||||
});
|
||||
fullStars.append(newStar);
|
||||
}
|
||||
|
||||
fullStars.hover(function(){}, displayInteractiveGrade);
|
||||
displayInteractiveGrade();
|
||||
}
|
||||
|
||||
function displayInteractiveGrade() {
|
||||
$('.star', fullStars).each(function displayStar() {
|
||||
var starValue = $(this).data('grade');
|
||||
$(this).removeClass('star-hover');
|
||||
if (starValue <= ratingInput.val()) {
|
||||
$(this).addClass('star-on');
|
||||
} else {
|
||||
$(this).removeClass('star-on');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function displayGrade(grade) {
|
||||
emptyStars.html('');
|
||||
fullStars.html('');
|
||||
var newStar;
|
||||
for (var i = minValue; i <= maxValue; ++i) {
|
||||
if (i <= Math.floor(grade)) {
|
||||
newStar = emptyStar.clone();
|
||||
newStar.css('visibility', 'hidden');
|
||||
emptyStars.append(newStar);
|
||||
fullStars.append(fullStar.clone());
|
||||
} else if (i > Math.ceil(grade)) {
|
||||
newStar = emptyStar.clone();
|
||||
emptyStars.append(newStar.clone());
|
||||
} else {
|
||||
//This the partial star composed of
|
||||
// - one invisible partial empty star
|
||||
// - one visible partial empty star (remaining part)
|
||||
// - one visible partial full star
|
||||
var fullWidth = (grade - i + 1) * componentOptions.starWidth;
|
||||
var emptyWidth = componentOptions.starWidth - fullWidth;
|
||||
newStar = emptyStar.clone();
|
||||
newStar.css('visibility', 'hidden');
|
||||
newStar.css('width', fullWidth);
|
||||
emptyStars.append(newStar);
|
||||
|
||||
newStar = emptyStar.clone();
|
||||
newStar.css('width', emptyWidth);
|
||||
newStar.css('background-position', '0px -'+fullWidth+'px');
|
||||
newStar.css('background-position', '-'+fullWidth+'px 0px');
|
||||
newStar.css('marginLeft', 0);
|
||||
emptyStars.append(newStar);
|
||||
|
||||
fullStar.css('width', fullWidth);
|
||||
fullStars.append(fullStar.clone());
|
||||
}
|
||||
|
||||
$ratingComponent.addClass(ratingAddedClass);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
171
falcon/modules/productcomments/views/js/list-comments.js
Normal file
171
falcon/modules/productcomments/views/js/list-comments.js
Normal file
@ -0,0 +1,171 @@
|
||||
/**
|
||||
* Copyright since 2007 PrestaShop SA and Contributors
|
||||
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
|
||||
* that is bundled with this package in the file LICENSE.md.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/licenses/AFL-3.0
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to https://devdocs.prestashop.com/ for more information.
|
||||
*
|
||||
* @author PrestaShop SA and Contributors <contact@prestashop.com>
|
||||
* @copyright Since 2007 PrestaShop SA and Contributors
|
||||
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
|
||||
*/
|
||||
|
||||
jQuery(document).ready(function () {
|
||||
const $ = jQuery;
|
||||
const commentsList = $('#product-comments-list');
|
||||
const emptyProductComment = $('#empty-product-comment');
|
||||
const commentsListUrl = commentsList.data('list-comments-url');
|
||||
const updateCommentUsefulnessUrl = commentsList.data('update-comment-usefulness-url');
|
||||
const reportCommentUrl = commentsList.data('report-comment-url');
|
||||
const commentPrototype = commentsList.data('comment-item-prototype');
|
||||
|
||||
emptyProductComment.hide();
|
||||
$('.comments-note .grade-stars').rating();
|
||||
|
||||
prestashop.on('updatedProduct', function() {
|
||||
$('.product-comments-additional-info .grade-stars').rating();
|
||||
})
|
||||
|
||||
document.addEventListener('updateRating', function() {
|
||||
$('.comments-note .grade-stars').rating();
|
||||
});
|
||||
|
||||
const updateCommentPostErrorModal = $('#update-comment-usefulness-post-error');
|
||||
|
||||
const confirmAbuseModal = $('#report-comment-confirmation');
|
||||
const reportCommentPostErrorModal = $('#report-comment-post-error');
|
||||
const reportCommentPostedModal = $('#report-comment-posted');
|
||||
|
||||
function showUpdatePostCommentErrorModal(errorMessage) {
|
||||
$('#update-comment-usefulness-post-error-message').html(errorMessage);
|
||||
updateCommentPostErrorModal.modal('show');
|
||||
}
|
||||
|
||||
function showReportCommentErrorModal(errorMessage) {
|
||||
$('#report-comment-post-error-message').html(errorMessage);
|
||||
reportCommentPostErrorModal.modal('show');
|
||||
}
|
||||
|
||||
function paginateComments(page) {
|
||||
$.get(commentsListUrl, {page: page}, function(jsonResponse) {
|
||||
if (jsonResponse.comments && jsonResponse.comments.length > 0) {
|
||||
populateComments(jsonResponse.comments);
|
||||
if (jsonResponse.comments_nb > jsonResponse.comments_per_page) {
|
||||
$('#product-comments-list-pagination').pagination({
|
||||
currentPage: page,
|
||||
items: jsonResponse.comments_nb,
|
||||
itemsOnPage: jsonResponse.comments_per_page,
|
||||
cssStyle: '',
|
||||
prevText: '<i class="material-icons font-reset align-middle">chevron_left</i>',
|
||||
nextText: '<i class="material-icons font-reset align-middle">chevron_right</i>',
|
||||
useAnchors: false,
|
||||
displayedPages: 2,
|
||||
onPageClick: paginateComments
|
||||
});
|
||||
} else {
|
||||
$('#product-comments-list-pagination').hide();
|
||||
}
|
||||
} else {
|
||||
commentsList.html('');
|
||||
emptyProductComment.show();
|
||||
commentsList.append(emptyProductComment);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function populateComments(comments) {
|
||||
commentsList.html('');
|
||||
comments.forEach(addComment);
|
||||
}
|
||||
|
||||
function addComment(comment) {
|
||||
var commentTemplate = commentPrototype;
|
||||
var customerName = comment.customer_name;
|
||||
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_NOT_USEFUL_ADVICES@/, (comment.total_usefulness - comment.usefulness));
|
||||
commentTemplate = commentTemplate.replace(/@COMMENT_TOTAL_ADVICES@/, comment.total_usefulness);
|
||||
|
||||
const $comment = $(commentTemplate);
|
||||
$('.grade-stars', $comment).rating({
|
||||
grade: comment.grade
|
||||
});
|
||||
$('.js-useful-review', $comment).click(function(e) {
|
||||
e.preventDefault();
|
||||
updateCommentUsefulness($comment, comment.id_product_comment, 1);
|
||||
});
|
||||
$('.js-not-useful-review', $comment).click(function(e) {
|
||||
e.preventDefault();
|
||||
updateCommentUsefulness($comment, comment.id_product_comment, 0);
|
||||
});
|
||||
$('.js-report-abuse', $comment).click(function(e) {
|
||||
e.preventDefault();
|
||||
confirmCommentAbuse(comment.id_product_comment);
|
||||
});
|
||||
|
||||
commentsList.append($comment);
|
||||
}
|
||||
|
||||
function updateCommentUsefulness($comment, commentId, usefulness) {
|
||||
$.post(updateCommentUsefulnessUrl, {id_product_comment: commentId, usefulness: usefulness}, function(jsonData){
|
||||
if (jsonData) {
|
||||
if (jsonData.success) {
|
||||
$('.js-useful-review-value', $comment).html(jsonData.usefulness);
|
||||
$('.js-not-useful-review-value', $comment).html(jsonData.total_usefulness - jsonData.usefulness);
|
||||
} else {
|
||||
const decodedErrorMessage = $("<div/>").html(jsonData.error).text();
|
||||
showUpdatePostCommentErrorModal(decodedErrorMessage);
|
||||
}
|
||||
} else {
|
||||
showUpdatePostCommentErrorModal(productCommentUpdatePostErrorMessage);
|
||||
}
|
||||
}).fail(function() {
|
||||
showUpdatePostCommentErrorModal(productCommentUpdatePostErrorMessage);
|
||||
});
|
||||
}
|
||||
|
||||
function confirmCommentAbuse(commentId) {
|
||||
confirmAbuseModal.modal('show');
|
||||
confirmAbuseModal.one('modal:confirm', function(event, confirm) {
|
||||
if (!confirm) {
|
||||
return;
|
||||
}
|
||||
$.post(reportCommentUrl, {id_product_comment: commentId}, function(jsonData){
|
||||
if (jsonData) {
|
||||
if (jsonData.success) {
|
||||
reportCommentPostedModal.modal('show');
|
||||
} else {
|
||||
showReportCommentErrorModal(jsonData.error);
|
||||
}
|
||||
} else {
|
||||
showReportCommentErrorModal(productCommentAbuseReportErrorMessage);
|
||||
}
|
||||
}).fail(function() {
|
||||
showReportCommentErrorModal(productCommentAbuseReportErrorMessage);
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
paginateComments(1);
|
||||
});
|
||||
129
falcon/modules/productcomments/views/js/post-comment.js
Normal file
129
falcon/modules/productcomments/views/js/post-comment.js
Normal file
@ -0,0 +1,129 @@
|
||||
/**
|
||||
* Copyright since 2007 PrestaShop SA and Contributors
|
||||
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
|
||||
* that is bundled with this package in the file LICENSE.md.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/licenses/AFL-3.0
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to https://devdocs.prestashop.com/ for more information.
|
||||
*
|
||||
* @author PrestaShop SA and Contributors <contact@prestashop.com>
|
||||
* @copyright Since 2007 PrestaShop SA and Contributors
|
||||
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
|
||||
*/
|
||||
|
||||
jQuery(document).ready(function () {
|
||||
const $ = jQuery;
|
||||
$('body').on('click', '.js-post-product-comment', function (event) {
|
||||
event.preventDefault();
|
||||
showPostCommentModal();
|
||||
});
|
||||
|
||||
const postCommentModal = $('#post-product-comment-modal');
|
||||
postCommentModal.on('hidden.bs.modal', function () {
|
||||
postCommentModal.modal('hide');
|
||||
clearPostCommentForm();
|
||||
});
|
||||
|
||||
const commentPostedModal = $('#product-comment-posted-modal');
|
||||
const commentPostErrorModal = $('#product-comment-post-error');
|
||||
|
||||
function showPostCommentModal() {
|
||||
commentPostedModal.modal('hide');
|
||||
commentPostErrorModal.modal('hide');
|
||||
postCommentModal.modal('show');
|
||||
}
|
||||
|
||||
function showCommentPostedModal() {
|
||||
postCommentModal.modal('hide');
|
||||
commentPostErrorModal.modal('hide');
|
||||
clearPostCommentForm();
|
||||
commentPostedModal.modal('show');
|
||||
}
|
||||
|
||||
function showPostErrorModal(errorMessage) {
|
||||
postCommentModal.modal('hide');
|
||||
commentPostedModal.modal('hide');
|
||||
clearPostCommentForm();
|
||||
$('#product-comment-post-error-message').html(errorMessage);
|
||||
commentPostErrorModal.modal('show');
|
||||
}
|
||||
|
||||
function clearPostCommentForm() {
|
||||
$('#post-product-comment-form input[type="text"]').val('');
|
||||
$('#post-product-comment-form input[type="text"]').removeClass('vis-invalid');
|
||||
$('#post-product-comment-form textarea').val('');
|
||||
$('#post-product-comment-form textarea').removeClass('is-invalid');
|
||||
$('#post-product-comment-form .criterion-rating input').val(3).change();
|
||||
}
|
||||
|
||||
function initCommentModal() {
|
||||
$('#post-product-comment-modal .grade-stars').rating();
|
||||
$('body').on('click', '.js-post-product-comment', function (event) {
|
||||
event.preventDefault();
|
||||
showPostCommentModal();
|
||||
});
|
||||
|
||||
$('#post-product-comment-form').submit(submitCommentForm);
|
||||
}
|
||||
|
||||
function submitCommentForm(event) {
|
||||
event.preventDefault();
|
||||
var formData = $(this).serializeArray();
|
||||
if (!validateFormData(formData)) {
|
||||
return;
|
||||
}
|
||||
$.post($(this).attr('action'), $(this).serialize(), function(jsonData) {
|
||||
if (jsonData) {
|
||||
if (jsonData.success) {
|
||||
clearPostCommentForm();
|
||||
showCommentPostedModal();
|
||||
} else {
|
||||
if (jsonData.errors) {
|
||||
var errorList = '<ul>';
|
||||
for (var i = 0; i < jsonData.errors.length; ++i) {
|
||||
errorList += '<li>' + jsonData.errors[i] + '</li>';
|
||||
}
|
||||
errorList += '</ul>';
|
||||
showPostErrorModal(errorList);
|
||||
} else {
|
||||
const decodedErrorMessage = $("<div/>").html(jsonData.error).text();
|
||||
showPostErrorModal(decodedErrorMessage);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
showPostErrorModal(productCommentPostErrorMessage);
|
||||
}
|
||||
}).fail(function() {
|
||||
showPostErrorModal(productCommentPostErrorMessage);
|
||||
});
|
||||
}
|
||||
|
||||
function validateFormData(formData) {
|
||||
var isValid = true;
|
||||
formData.forEach(function(formField) {
|
||||
const fieldSelector = '#post-product-comment-form [name="'+formField.name+'"]';
|
||||
if (!formField.value) {
|
||||
$(fieldSelector).addClass('is-invalid');
|
||||
isValid = false;
|
||||
} else {
|
||||
$(fieldSelector).removeClass('is-invalid');
|
||||
}
|
||||
});
|
||||
|
||||
return isValid;
|
||||
}
|
||||
|
||||
initCommentModal();
|
||||
});
|
||||
@ -0,0 +1,151 @@
|
||||
/**
|
||||
* 2007-2019 PrestaShop SA and Contributors
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2019 PrestaShop SA and Contributors
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
|
||||
$(document).ready(function() {
|
||||
productListingComments.init();
|
||||
productListingComments.load();
|
||||
});
|
||||
|
||||
|
||||
var productListingComments = (function () {
|
||||
|
||||
var data = {
|
||||
productIDs: [],
|
||||
commentsLoadingInProgress: false,
|
||||
ajaxIDsLimit: 50,
|
||||
ajaxUrl: ''
|
||||
}
|
||||
|
||||
var DOMStrings = {
|
||||
productListReviewsContainer: '.product-list-reviews',
|
||||
productListReviewsNumberOfComments: '.comments-nb',
|
||||
productListReviewsStarsContainer: '.grade-stars',
|
||||
productContainer: '.js-product-miniature'
|
||||
};
|
||||
|
||||
var DOMClasses = {
|
||||
inProgress: 'reviews-loading',
|
||||
reviewsLoaded: 'reviews-loaded',
|
||||
hasReviews: 'has-reviews'
|
||||
};
|
||||
|
||||
function setEvents() {
|
||||
prestashop.on('updatedProductList', function() {
|
||||
addProductsIDs();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function setAjaxUrl() {
|
||||
if (data.ajaxUrl !== '')
|
||||
return;
|
||||
|
||||
var url = $(DOMStrings.productListReviewsContainer).first().data('url');
|
||||
data.ajaxUrl = url;
|
||||
}
|
||||
|
||||
function getNewProductsReviewsElements() {
|
||||
var $productListReviews = $(DOMStrings.productContainer)
|
||||
.not('.' + DOMClasses.reviewsLoaded + ', .' + DOMClasses.inProgress)
|
||||
.addClass(DOMClasses.inProgress)
|
||||
.find(DOMStrings.productListReviewsContainer);
|
||||
|
||||
return $productListReviews;
|
||||
}
|
||||
|
||||
function addProductsIDs() {
|
||||
|
||||
var $productsList = getNewProductsReviewsElements(),
|
||||
seenIds = {};
|
||||
|
||||
$productsList.each(function () {
|
||||
var id = $(this).data('id');
|
||||
seenIds[id] = true;
|
||||
});
|
||||
|
||||
|
||||
var IDsArray = Object.keys(seenIds);
|
||||
var prevDataIDs = data.productIDs.splice(0);
|
||||
data.productIDs = prevDataIDs.concat(IDsArray);
|
||||
|
||||
if (!data.commentsLoadingInProgress) {
|
||||
loadProductsData();
|
||||
}
|
||||
}
|
||||
|
||||
function loadProductsData() {
|
||||
if (data.productIDs.length === 0)
|
||||
return;
|
||||
|
||||
data.commentsLoadingInProgress = true;
|
||||
|
||||
var dataIDsCopy = data.productIDs.slice(0);
|
||||
selectedProductIDs = dataIDsCopy.splice(0, data.ajaxIDsLimit);
|
||||
|
||||
|
||||
$.get(data.ajaxUrl, { id_products: selectedProductIDs }, function (jsonData) {
|
||||
if (jsonData) {
|
||||
$.each(jsonData.products, function(i, elem) {
|
||||
var productData = elem;
|
||||
var $productsReviewsContainer = $('.product-list-reviews[data-id="' + productData.id_product + '"]');
|
||||
|
||||
$productsReviewsContainer.each(function () {
|
||||
var $self = $(this);
|
||||
|
||||
if (productData.comments_nb > 0) {
|
||||
$self.find(DOMStrings.productListReviewsStarsContainer).rating({ grade: productData.average_grade, starWidth: 16 });
|
||||
$self.find(DOMStrings.productListReviewsNumberOfComments).text('(' + productData.comments_nb + ')');
|
||||
$self.closest(DOMStrings.productContainer).addClass(DOMClasses.hasReviews);
|
||||
$self.css('visibility', 'visible');
|
||||
}
|
||||
|
||||
$self.closest(DOMStrings.productContainer).addClass(DOMClasses.reviewsLoaded);
|
||||
$self.closest(DOMStrings.productContainer).removeClass(DOMClasses.inProgress);
|
||||
|
||||
});
|
||||
data.productIDs.shift();
|
||||
});
|
||||
|
||||
data.commentsLoadingInProgress = false;
|
||||
if (data.productIDs.length > 0) {
|
||||
loadProductsData();
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
return {
|
||||
load: function () {
|
||||
addProductsIDs();
|
||||
},
|
||||
init: function () {
|
||||
setAjaxUrl();
|
||||
setEvents();
|
||||
}
|
||||
}
|
||||
})();
|
||||
@ -0,0 +1,58 @@
|
||||
{**
|
||||
* Copyright since 2007 PrestaShop SA and Contributors
|
||||
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
|
||||
* that is bundled with this package in the file LICENSE.md.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/licenses/AFL-3.0
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to https://devdocs.prestashop.com/ for more information.
|
||||
*
|
||||
* @author PrestaShop SA and Contributors <contact@prestashop.com>
|
||||
* @copyright Since 2007 PrestaShop SA and Contributors
|
||||
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
|
||||
*}
|
||||
|
||||
{assign var='icon' value=$icon|default:'check_circle'}
|
||||
{assign var='modal_message' value=$modal_message|default:''}
|
||||
|
||||
<script type="text/javascript">
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
const alertModal = $('#{$modal_id}');
|
||||
alertModal.on('hidden.bs.modal', function () {
|
||||
alertModal.modal('hide');
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<div id="{$modal_id}" class="modal fade product-comment-modal" role="dialog" aria-hidden="true">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="h5 modal-title">
|
||||
{$modal_title}
|
||||
</h5>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div id="{$modal_id}-message">
|
||||
{$modal_message}
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-primary btn-text" data-dismiss="modal" aria-label="{l s='OK' d='Modules.Productcomments.Shop'}">
|
||||
{l s='OK' d='Modules.Productcomments.Shop'}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -0,0 +1,30 @@
|
||||
{**
|
||||
* Copyright since 2007 PrestaShop SA and Contributors
|
||||
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
|
||||
* that is bundled with this package in the file LICENSE.md.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/licenses/AFL-3.0
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to https://devdocs.prestashop.com/ for more information.
|
||||
*
|
||||
* @author PrestaShop SA and Contributors <contact@prestashop.com>
|
||||
* @copyright Since 2007 PrestaShop SA and Contributors
|
||||
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
|
||||
*}
|
||||
|
||||
{if $nb_comments != 0}
|
||||
<div class="comments-note">
|
||||
<div class="grade-stars" data-grade="{$grade}"></div>
|
||||
</div>
|
||||
{/if}
|
||||
@ -0,0 +1,69 @@
|
||||
{**
|
||||
* Copyright since 2007 PrestaShop SA and Contributors
|
||||
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
|
||||
* that is bundled with this package in the file LICENSE.md.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/licenses/AFL-3.0
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to https://devdocs.prestashop.com/ for more information.
|
||||
*
|
||||
* @author PrestaShop SA and Contributors <contact@prestashop.com>
|
||||
* @copyright Since 2007 PrestaShop SA and Contributors
|
||||
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
|
||||
*}
|
||||
|
||||
{assign var='icon' value=$icon|default:'check_circle'}
|
||||
{assign var='modal_message' value=$modal_message|default:''}
|
||||
|
||||
<script type="text/javascript">
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
const confirmModal = $('#{$modal_id}');
|
||||
confirmModal.on('hidden.bs.modal', function () {
|
||||
confirmModal.modal('hide');
|
||||
confirmModal.trigger('modal:confirm', false);
|
||||
});
|
||||
|
||||
$('.confirm-button', confirmModal).click(function() {
|
||||
confirmModal.trigger('modal:confirm', true);
|
||||
});
|
||||
$('.refuse-button', confirmModal).click(function() {
|
||||
confirmModal.trigger('modal:confirm', false);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<div id="{$modal_id}" class="modal fade product-comment-modal" role="dialog" aria-hidden="true">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title h5">
|
||||
{$modal_title}
|
||||
</h5>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div id="{$modal_id}-message">
|
||||
{$modal_message}
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-primary confirm-button btn-block" data-dismiss="modal" aria-label="{l s='Yes' d='Modules.Productcomments.Shop'}">
|
||||
{l s='Yes' d='Modules.Productcomments.Shop'}
|
||||
</button>
|
||||
<button type="button" class="btn btn-text refuse-button btn-block" data-dismiss="modal" aria-label="{l s='No' d='Modules.Productcomments.Shop'}">
|
||||
{l s='No' d='Modules.Productcomments.Shop'}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -0,0 +1,37 @@
|
||||
{**
|
||||
* Copyright since 2007 PrestaShop SA and Contributors
|
||||
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
|
||||
* that is bundled with this package in the file LICENSE.md.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/licenses/AFL-3.0
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to https://devdocs.prestashop.com/ for more information.
|
||||
*
|
||||
* @author PrestaShop SA and Contributors <contact@prestashop.com>
|
||||
* @copyright Since 2007 PrestaShop SA and Contributors
|
||||
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
|
||||
*}
|
||||
|
||||
<div id="empty-product-comment" class="product-comment-list-item">
|
||||
{if $post_allowed}
|
||||
<div class="text-center">
|
||||
<button class="btn btn-primary js-post-product-comment">
|
||||
<i class="material-icons btn-icon mr-1">edit</i>
|
||||
{l s='Be the first to write your review' d='Modules.Productcomments.Shop'}
|
||||
</button>
|
||||
</div>
|
||||
{else}
|
||||
{l s='No customer reviews for the moment.' d='Modules.Productcomments.Shop'}
|
||||
{/if}
|
||||
</div>
|
||||
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright since 2007 PrestaShop SA and Contributors
|
||||
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
|
||||
* that is bundled with this package in the file LICENSE.md.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/licenses/AFL-3.0
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to https://devdocs.prestashop.com/ for more information.
|
||||
*
|
||||
* @author PrestaShop SA and Contributors <contact@prestashop.com>
|
||||
* @copyright Since 2007 PrestaShop SA and Contributors
|
||||
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
|
||||
*/
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
||||
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
|
||||
header('Location: ../');
|
||||
exit;
|
||||
@ -0,0 +1,105 @@
|
||||
{**
|
||||
* Copyright since 2007 PrestaShop SA and Contributors
|
||||
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
|
||||
* that is bundled with this package in the file LICENSE.md.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/licenses/AFL-3.0
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to https://devdocs.prestashop.com/ for more information.
|
||||
*
|
||||
* @author PrestaShop SA and Contributors <contact@prestashop.com>
|
||||
* @copyright Since 2007 PrestaShop SA and Contributors
|
||||
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
|
||||
*}
|
||||
|
||||
<script type="text/javascript">
|
||||
var productCommentPostErrorMessage = '{l s='Sorry, your review cannot be posted.' d='Modules.Productcomments.Shop' js=1}';
|
||||
</script>
|
||||
|
||||
<div id="post-product-comment-modal" class="modal fade product-comment-modal" role="dialog" aria-hidden="true">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title h5">{l s='Write your review' d='Modules.Productcomments.Shop'}</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<form id="post-product-comment-form" action="{$post_comment_url nofilter}" method="POST">
|
||||
<div class="modal-body">
|
||||
{if $criterions|@count > 0}
|
||||
<ul id="criterions_list">
|
||||
{foreach from=$criterions item='criterion'}
|
||||
<li>
|
||||
<div class="criterion-rating d-flex">
|
||||
<label class="mb-0 mr-1">{$criterion.name|escape:'html':'UTF-8'}:</label>
|
||||
<div
|
||||
class="grade-stars"
|
||||
data-grade="3"
|
||||
data-input="criterion[{$criterion.id_product_comment_criterion}]">
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
{/if}
|
||||
|
||||
<div class="form-group">
|
||||
<label for="comment_title" class="form-label required">{l s='Title' d='Modules.Productcomments.Shop'}</label>
|
||||
<input class="form-control" id="comment_title" name="comment_title" type="text" value=""/>
|
||||
</div>
|
||||
|
||||
{if !$logged}
|
||||
<div class="form-group">
|
||||
<label class="form-label required" for="customer_name">{l s='Your name' d='Modules.Productcomments.Shop'}</label>
|
||||
<input class="form-control" id="customer_name" name="customer_name" type="text" value=""/>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<div class="form-group">
|
||||
<label class="form-label required" for="comment_content">{l s='Review' d='Modules.Productcomments.Shop'}</label>
|
||||
<textarea class="form-control" rows="4" id="comment_content" name="comment_content"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="submit" class="btn btn-primary btn-block">
|
||||
{l s='Send' d='Modules.Productcomments.Shop'}
|
||||
</button>
|
||||
<button type="button" class="btn btn-text btn-block" data-dismiss="modal" aria-label="{l s='Cancel' d='Modules.Productcomments.Shop'}">
|
||||
{l s='Cancel' d='Modules.Productcomments.Shop'}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{* Comment posted modal *}
|
||||
{if $moderation_active}
|
||||
{assign var='comment_posted_message' value={l s='Your comment has been submitted and will be available once approved by a moderator.' d='Modules.Productcomments.Shop'}}
|
||||
{else}
|
||||
{assign var='comment_posted_message' value={l s='Your comment has been added!' d='Modules.Productcomments.Shop'}}
|
||||
{/if}
|
||||
{include file='module:productcomments/views/templates/hook/alert-modal.tpl'
|
||||
modal_id='product-comment-posted-modal'
|
||||
modal_title={l s='Review sent' d='Modules.Productcomments.Shop'}
|
||||
modal_message=$comment_posted_message
|
||||
}
|
||||
|
||||
{* Comment post error modal *}
|
||||
{include file='module:productcomments/views/templates/hook/alert-modal.tpl'
|
||||
modal_id='product-comment-post-error'
|
||||
modal_title={l s='Your review cannot be sent' d='Modules.Productcomments.Shop'}
|
||||
icon='error'
|
||||
}
|
||||
@ -0,0 +1,39 @@
|
||||
{**
|
||||
* Copyright since 2007 PrestaShop SA and Contributors
|
||||
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
|
||||
* that is bundled with this package in the file LICENSE.md.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/licenses/AFL-3.0
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to https://devdocs.prestashop.com/ for more information.
|
||||
*
|
||||
* @author PrestaShop SA and Contributors <contact@prestashop.com>
|
||||
* @copyright Since 2007 PrestaShop SA and Contributors
|
||||
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
|
||||
*}
|
||||
|
||||
{if $nb_comments != 0}
|
||||
<script type="text/javascript">
|
||||
const $ = jQuery;
|
||||
$('#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>
|
||||
|
||||
<div id="product-quickview-{$product.id}" class="product-quickview-review">
|
||||
<div class="grade-stars"></div>
|
||||
<div class="comments-nb"></div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
@ -0,0 +1,47 @@
|
||||
{**
|
||||
* Copyright since 2007 PrestaShop SA and Contributors
|
||||
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
|
||||
* that is bundled with this package in the file LICENSE.md.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/licenses/AFL-3.0
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to https://devdocs.prestashop.com/ for more information.
|
||||
*
|
||||
* @author PrestaShop SA and Contributors <contact@prestashop.com>
|
||||
* @copyright Since 2007 PrestaShop SA and Contributors
|
||||
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
|
||||
*}
|
||||
|
||||
{if $nb_comments != 0 || $post_allowed}
|
||||
<div class="product-comments-additional-info d-flex align-items-center">
|
||||
{if $nb_comments == 0}
|
||||
{if $post_allowed}
|
||||
<button class="btn btn-text js-post-product-comment">
|
||||
<i class="material-icons btn-icon">edit</i>
|
||||
{l s='Write your review' d='Modules.Productcomments.Shop'}
|
||||
</button>
|
||||
{/if}
|
||||
{else}
|
||||
{include file='module:productcomments/views/templates/hook/average-grade-stars.tpl' grade=$average_grade}
|
||||
<div class="additional-links">
|
||||
{if $post_allowed}
|
||||
<a class="btn btn-text js-post-product-comment ml-2" href="#product-comments-list-header">
|
||||
<i class="material-icons btn-icon">edit</i>
|
||||
{l s='Write your review' d='Modules.Productcomments.Shop'}
|
||||
</a>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
@ -0,0 +1,61 @@
|
||||
{**
|
||||
* Copyright since 2007 PrestaShop SA and Contributors
|
||||
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
|
||||
* that is bundled with this package in the file LICENSE.md.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/licenses/AFL-3.0
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to https://devdocs.prestashop.com/ for more information.
|
||||
*
|
||||
* @author PrestaShop SA and Contributors <contact@prestashop.com>
|
||||
* @copyright Since 2007 PrestaShop SA and Contributors
|
||||
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
|
||||
*}
|
||||
|
||||
<div class="product-comment-list-item pb-4 mb-4 border-bottom" data-product-comment-id="@COMMENT_ID@" data-product-id="@PRODUCT_ID@">
|
||||
<div class="d-flex mb-2 align-items-center">
|
||||
<div class="font-weight-bold">
|
||||
@CUSTOMER_NAME@
|
||||
</div>
|
||||
{* <div class="text-muted font-sm ml-2">
|
||||
@COMMENT_DATE@
|
||||
</div> *}
|
||||
<div class="grade-stars flex-shrink-0 flex-grow-0 ml-auto"></div>
|
||||
</div>
|
||||
|
||||
<div class="comment-content">
|
||||
<p class="h5 mb-3">@COMMENT_TITLE@</p>
|
||||
<p class="font-sm">@COMMENT_COMMENT@</p>
|
||||
<div class="d-flex">
|
||||
{if $usefulness_enabled}
|
||||
<div class="mr-2">
|
||||
<a href="#" role="button" class="btn btn-text btn-sm d-inline-flex align-items-center font-lg js-useful-review">
|
||||
<i class="material-icons text-reset font-reset thumb_up"></i>
|
||||
<span class="js-useful-review-value font-sm ml-1">@COMMENT_USEFUL_ADVICES@</span>
|
||||
</a>
|
||||
<a href="#" role="button" class="btn btn-text btn-sm d-inline-flex align-items-center font-lg js-not-useful-review">
|
||||
<i class="material-icons text-reset font-reset thumb_down"></i>
|
||||
<span class="js-not-useful-review-value font-sm ml-1">@COMMENT_NOT_USEFUL_ADVICES@</span>
|
||||
</a>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<div class="ml-auto">
|
||||
<a href="#" role="button" class="btn btn-text btn-sm d-inline-flex align-items-center font-lg js-report-abuse" title="{l s='Report abuse' d='Modules.Productcomments.Shop'}">
|
||||
<i class="material-icons text-reset font-reset outlined_flag"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -0,0 +1,91 @@
|
||||
{**
|
||||
* Copyright since 2007 PrestaShop SA and Contributors
|
||||
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
|
||||
* that is bundled with this package in the file LICENSE.md.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/licenses/AFL-3.0
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to https://devdocs.prestashop.com/ for more information.
|
||||
*
|
||||
* @author PrestaShop SA and Contributors <contact@prestashop.com>
|
||||
* @copyright Since 2007 PrestaShop SA and Contributors
|
||||
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
|
||||
*}
|
||||
<script type="text/javascript">
|
||||
var productCommentUpdatePostErrorMessage = '{l|escape:'javascript' s='Sorry, your review appreciation cannot be sent.' d='Modules.Productcomments.Shop'}';
|
||||
var productCommentAbuseReportErrorMessage = '{l|escape:'javascript' s='Sorry, your abuse report cannot be sent.' d='Modules.Productcomments.Shop'}';
|
||||
</script>
|
||||
|
||||
<div class="mb-4">
|
||||
<div class="d-flex my-4" id="product-comments-list-header">
|
||||
<div class="comments-nb h3 d-flex align-items-center mr-3 mb-0">
|
||||
<i class="material-icons mr-2">chat</i>
|
||||
{l s='Comments' d='Modules.Productcomments.Shop'} ({$nb_comments})
|
||||
</div>
|
||||
<div class="ml-auto">
|
||||
{include file='module:productcomments/views/templates/hook/average-grade-stars.tpl' grade=$average_grade}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{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'}
|
||||
<div class="row">
|
||||
<div class="col-md-12 col-sm-12"
|
||||
id="product-comments-list"
|
||||
data-list-comments-url="{$list_comments_url nofilter}"
|
||||
data-update-comment-usefulness-url="{$update_comment_usefulness_url nofilter}"
|
||||
data-report-comment-url="{$report_comment_url nofilter}"
|
||||
data-comment-item-prototype="{$comment_prototype}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex-column flex-sm-row d-flex align-items-center" id="product-comments-list-footer">
|
||||
<div id="product-comments-list-pagination" class="comments-pagination ml-sm-auto order-sm-1"></div>
|
||||
{if $post_allowed && $nb_comments != 0}
|
||||
<div class="my-sm-2 mt-3">
|
||||
<button class="btn btn-primary js-post-product-comment">
|
||||
<i class="material-icons btn-icon mr-1">edit</i>
|
||||
{l s='Write your review' d='Modules.Productcomments.Shop'}
|
||||
</button>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
{* Appreciation post error modal *}
|
||||
{include file='module:productcomments/views/templates/hook/alert-modal.tpl'
|
||||
modal_id='update-comment-usefulness-post-error'
|
||||
modal_title={l s='Your review appreciation cannot be sent' d='Modules.Productcomments.Shop'}
|
||||
}
|
||||
|
||||
{* Confirm report modal *}
|
||||
{include file='module:productcomments/views/templates/hook/confirm-modal.tpl'
|
||||
modal_id='report-comment-confirmation'
|
||||
modal_title={l s='Report comment' d='Modules.Productcomments.Shop'}
|
||||
modal_message={l s='Are you sure that you want to report this comment?' d='Modules.Productcomments.Shop'}
|
||||
}
|
||||
|
||||
{* Report comment posted modal *}
|
||||
{include file='module:productcomments/views/templates/hook/alert-modal.tpl'
|
||||
modal_id='report-comment-posted'
|
||||
modal_title={l s='Report sent' d='Modules.Productcomments.Shop'}
|
||||
modal_message={l s='Your report has been submitted and will be considered by a moderator.' d='Modules.Productcomments.Shop'}
|
||||
}
|
||||
|
||||
{* Report abuse error modal *}
|
||||
{include file='module:productcomments/views/templates/hook/alert-modal.tpl'
|
||||
modal_id='report-comment-post-error'
|
||||
modal_title={l s='Your report cannot be sent' d='Modules.Productcomments.Shop'}
|
||||
}
|
||||
</div>
|
||||
|
||||
@ -0,0 +1,30 @@
|
||||
{**
|
||||
* Copyright since 2007 PrestaShop SA and Contributors
|
||||
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
|
||||
* that is bundled with this package in the file LICENSE.md.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/licenses/AFL-3.0
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to https://devdocs.prestashop.com/ for more information.
|
||||
*
|
||||
* @author PrestaShop SA and Contributors <contact@prestashop.com>
|
||||
* @copyright Since 2007 PrestaShop SA and Contributors
|
||||
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
|
||||
*}
|
||||
|
||||
{* Javascript is used to display each product grade, this allows every rating to be udpated as soon as they change *}
|
||||
|
||||
<div class="product-list-reviews" data-id="{$product.id}" data-url="{$product_comment_grade_url nofilter}">
|
||||
<div class="grade-stars small-stars"></div>
|
||||
</div>
|
||||
34
falcon/modules/productcomments/views/templates/index.php
Normal file
34
falcon/modules/productcomments/views/templates/index.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright since 2007 PrestaShop SA and Contributors
|
||||
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
|
||||
* that is bundled with this package in the file LICENSE.md.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/licenses/AFL-3.0
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to https://devdocs.prestashop.com/ for more information.
|
||||
*
|
||||
* @author PrestaShop SA and Contributors <contact@prestashop.com>
|
||||
* @copyright Since 2007 PrestaShop SA and Contributors
|
||||
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
|
||||
*/
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
||||
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
|
||||
header('Location: ../');
|
||||
exit;
|
||||
Reference in New Issue
Block a user