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:
2025-11-18 14:04:01 +01:00
parent 3a7f2db331
commit 6849b8eefd
605 changed files with 49820 additions and 0 deletions

View 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;

View 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);
}
}
});
}

View 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);
});

View 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();
});

View File

@ -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();
}
}
})();