first commit

This commit is contained in:
2024-11-05 12:22:50 +01:00
commit e5682a3912
19641 changed files with 2948548 additions and 0 deletions

View File

@@ -0,0 +1,283 @@
/*
* @Website: apollotheme.com - prestashop template provider
* @author Apollotheme <apollotheme@gmail.com>
* @copyright Apollotheme
* @description: ApPageBuilder is module help you can build content for your shop
*/
import $ from 'jquery';
import prestashop from 'prestashop';
prestashop.cart = prestashop.cart || {};
prestashop.cart.active_inputs = null;
var spinnerSelector = 'input[name="product-quantity-spin"]';
/**
* Attach Bootstrap TouchSpin event handlers
*/
function createSpin()
{
$.each($(spinnerSelector), function (index, spinner) {
$(spinner).TouchSpin({
verticalbuttons: true,
verticalupclass: 'material-icons touchspin-up',
verticaldownclass: 'material-icons touchspin-down',
buttondown_class: 'btn btn-touchspin js-touchspin js-increase-product-quantity',
buttonup_class: 'btn btn-touchspin js-touchspin js-decrease-product-quantity',
min: parseInt($(spinner).attr('min'), 10),
max: 1000000
});
});
}
$(document).ready(() => {
let productLineInCartSelector = '.js-cart-line-product-quantity';
let promises = [];
prestashop.on('updateCart', () => {
$('.quickview').modal('hide');
});
prestashop.on('updatedCart', () => {
createSpin();
});
createSpin();
let $body = $('body');
function isTouchSpin(namespace) {
return namespace === 'on.startupspin' || namespace === 'on.startdownspin';
}
function shouldIncreaseProductQuantity(namespace) {
return namespace === 'on.startupspin';
}
function findCartLineProductQuantityInput($target) {
var $input = $target.parents('.bootstrap-touchspin').find(productLineInCartSelector);
if ($input.is(':focus')) {
return null;
} else {
return $input;
}
}
function camelize(subject) {
let actionTypeParts = subject.split('-');
let i;
let part;
let camelizedSubject = '';
for (i = 0; i < actionTypeParts.length; i++) {
part = actionTypeParts[i];
if (0 !== i) {
part = part.substring(0, 1).toUpperCase() + part.substring(1);
}
camelizedSubject = camelizedSubject + part;
}
return camelizedSubject;
}
function parseCartAction($target, namespace) {
if (!isTouchSpin(namespace)) {
return {
url: $target.attr('href'),
type: camelize($target.data('link-action'))
}
}
let $input = findCartLineProductQuantityInput($target);
if (!$input) {
return;
}
let cartAction = {};
if (shouldIncreaseProductQuantity(namespace)) {
cartAction = {
url: $input.data('up-url'),
type: 'increaseProductQuantity'
};
} else {
cartAction = {
url: $input.data('down-url'),
type: 'decreaseProductQuantity'
}
}
return cartAction;
}
let abortPreviousRequests = () => {
var promise;
while (promises.length > 0) {
promise = promises.pop();
promise.abort();
}
};
var getTouchSpinInput = ($button) => {
return $($button.parents('.bootstrap-touchspin').find('input'));
};
var handleCartAction = (event) => {
event.preventDefault();
let $target = $(event.currentTarget);
let dataset = event.currentTarget.dataset;
let cartAction = parseCartAction($target, event.namespace);
let requestData = {
ajax: '1',
action: 'update'
};
if (typeof cartAction === 'undefined') {
return;
}
abortPreviousRequests();
$.ajax({
url: cartAction.url,
method: 'POST',
data: requestData,
dataType: 'json',
beforeSend: function (jqXHR) {
promises.push(jqXHR);
}
}).then(function (resp) {
var $quantityInput = getTouchSpinInput($target);
$quantityInput.val(resp.quantity);
// Refresh cart preview
prestashop.emit('updateCart', {
reason: dataset
});
}).fail((resp) => {
prestashop.emit('handleError', {
eventType: 'updateProductInCart',
resp: resp,
cartAction: cartAction.type
});
});
};
$body.on(
'click',
'[data-link-action="delete-from-cart"], [data-link-action="remove-voucher"]',
handleCartAction
);
$body.on('touchspin.on.startdownspin', spinnerSelector, handleCartAction);
$body.on('touchspin.on.startupspin', spinnerSelector, handleCartAction);
function sendUpdateQuantityInCartRequest(updateQuantityInCartUrl, requestData, $target) {
abortPreviousRequests();
return $.ajax({
url: updateQuantityInCartUrl,
method: 'POST',
data: requestData,
dataType: 'json',
beforeSend: function (jqXHR) {
promises.push(jqXHR);
}
}).then(function (resp) {
$target.val(resp.quantity);
var dataset;
if ($target && $target.dataset) {
dataset = $target.dataset;
} else {
dataset = resp;
}
// Refresh cart preview
prestashop.emit('updateCart', {
reason: dataset
});
}).fail((resp) => {
prestashop.emit('handleError', {eventType: 'updateProductQuantityInCart', resp: resp})
});
}
function getRequestData(quantity) {
return {
ajax: '1',
qty: Math.abs(quantity),
action: 'update',
op: getQuantityChangeType(quantity)
}
}
function getQuantityChangeType($quantity) {
return ($quantity > 0) ? 'up' : 'down';
}
function updateProductQuantityInCart(event)
{
let $target = $(event.currentTarget);
let updateQuantityInCartUrl = $target.data('update-url');
let baseValue = $target.attr('value');
// There should be a valid product quantity in cart
let targetValue = $target.val();
if (targetValue != parseInt(targetValue) || targetValue < 0 || isNaN(targetValue)) {
$target.val(baseValue);
return;
}
// There should be a new product quantity in cart
let qty = targetValue - baseValue;
if (qty == 0) {
return;
}
var requestData = getRequestData(qty);
sendUpdateQuantityInCartRequest(updateQuantityInCartUrl, requestData, $target);
}
$body.on(
'focusout',
productLineInCartSelector,
(event) => {
updateProductQuantityInCart(event);
}
);
$body.on(
'keyup',
productLineInCartSelector,
(event) => {
if (event.keyCode == 13) {
updateProductQuantityInCart(event);
}
}
);
$body.on(
'click',
'.js-discount .code',
(event) => {
event.stopPropagation();
var $code = $(event.currentTarget);
var $discountInput = $('[name=discount_name]');
$discountInput.val($code.text());
return false;
}
)
});

View File

@@ -0,0 +1,68 @@
/**
* 2007-2017 PrestaShop
*
* 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.txt.
* 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 http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright PrestaShop SA
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
import $ from 'jquery';
import prestashop from 'prestashop';
function setUpCheckout() {
if ($('.js-cancel-address').length !== 0) {
$('.checkout-step:not(.js-current-step) .step-title').addClass('not-allowed');
}
$('.js-terms a').on('click', (event) => {
event.preventDefault();
var url = $(event.target).attr('href');
if (url) {
// TODO: Handle request if no pretty URL
url += `?content_only=1`;
$.get(url, (content) => {
$('#modal').find('.js-modal-content').html($(content).find('.page-cms').contents());
}).fail((resp) => {
prestashop.emit('handleError', {eventType: 'clickTerms', resp: resp});
});
}
$('#modal').modal('show');
});
$('.js-gift-checkbox').on('click', (event) => {
$('#gift').collapse('toggle');
});
}
$(document).ready(() => {
if ($('body#checkout').length === 1) {
setUpCheckout();
}
prestashop.on('updatedDeliveryForm', (params) => {
if (typeof params.deliveryOption === 'undefined' || 0 === params.deliveryOption.length) {
return;
}
// Hide all carrier extra content ...
$(".carrier-extra-content").hide();
// and show the one related to the selected carrier
params.deliveryOption.next(".carrier-extra-content").slideDown();
});
});

View File

@@ -0,0 +1,49 @@
/**
* 2007-2017 PrestaShop
*
* 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.txt.
* 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 http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright PrestaShop SA
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
import prestashop from 'prestashop';
import $ from 'jquery';
prestashop.blockcart = prestashop.blockcart || {};
prestashop.blockcart.showModal = (html) => {
function getBlockCartModal() {
return $('#blockcart-modal');
}
let $blockCartModal = getBlockCartModal();
if ($blockCartModal.length){
$blockCartModal.remove();
}
$('body').append(html);
$blockCartModal = getBlockCartModal();
$blockCartModal.modal('show').on('hidden.bs.modal', (event) => {
prestashop.emit('updateProduct', {
reason: event.currentTarget.dataset
});
});
};

View File

@@ -0,0 +1,54 @@
/**
* 2007-2017 PrestaShop
*
* 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.txt.
* 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 http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright PrestaShop SA
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
import $ from 'jquery';
export default class DropDown {
constructor(el) {
this.el = el;
}
init() {
this.el.on('show.bs.dropdown', function(e, el) {
if (el) {
$(`#${el}`).find('.dropdown-menu').first().stop(true, true).slideDown();
} else {
$(e.target).find('.dropdown-menu').first().stop(true, true).slideDown();
}
});
this.el.on('hide.bs.dropdown', function(e, el) {
if (el) {
$(`#${el}`).find('.dropdown-menu').first().stop(true, true).slideUp();
} else {
$(e.target).find('.dropdown-menu').first().stop(true, true).slideUp();
}
});
this.el.find('select.link').each(function(idx, el) {
$(el).on('change', function(event) {
window.location = $(this).val();
});
});
}
}

View File

@@ -0,0 +1,55 @@
/**
* 2007-2017 PrestaShop
*
* 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.txt.
* 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 http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright PrestaShop SA
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
import $ from 'jquery';
export default class Form {
init(){
this.parentFocus();
this.togglePasswordVisibility();
}
parentFocus() {
$('.js-child-focus').focus(function () {
$(this).closest('.js-parent-focus').addClass('focus');
});
$('.js-child-focus').focusout(function () {
$(this).closest('.js-parent-focus').removeClass('focus');
});
}
togglePasswordVisibility() {
$('button[data-action="show-password"]').on('click', function () {
var elm = $(this).closest('.input-group').children('input.js-visible-password');
if (elm.attr('type') === 'password') {
elm.attr('type', 'text');
$(this).text($(this).data('textHide'));
} else {
elm.attr('type', 'password');
$(this).text($(this).data('textShow'));
}
});
}
}

View File

@@ -0,0 +1,35 @@
<?php
/**
* 2007-2017 PrestaShop
*
* 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.txt.
* 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 http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright PrestaShop SA
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
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,56 @@
/**
* 2007-2017 PrestaShop
*
* 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.txt.
* 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 http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright PrestaShop SA
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
import $ from 'jquery';
export default class ProductMinitature {
init(){
$('.js-product-miniature').each((index, element) => {
/**
const FLAG_MARGIN = 10;
let $percent = $(element).find('.discount-percentage');
let $onsale = $(element).find('.on-sale');
let $new = $(element).find('.new');
if($percent.length){
$new.css('top', $percent.height() * 2 + FLAG_MARGIN);
$percent.css('top',-$(element).find('.thumbnail-container').height() + $(element).find('.product-description').height() + FLAG_MARGIN);
}
if($onsale.length){
$percent.css('top', parseFloat($percent.css('top')) + $onsale.height() + FLAG_MARGIN);
$new.css('top', ($percent.height() * 2 + $onsale.height()) + FLAG_MARGIN * 2);
}
*/
if($(element).find('.color').length > 5){
let count = 0;
$(element).find('.color').each((index, element) =>{
if(index > 4){
$(element).hide();
count ++;
}
});
$(element).find('.js-count').append(`+${count}`);
}
});
}
}

View File

@@ -0,0 +1,87 @@
/**
* 2007-2017 PrestaShop
*
* 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.txt.
* 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 http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright PrestaShop SA
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
import $ from 'jquery';
import 'velocity-animate';
export default class ProductSelect {
init() {
const MAX_THUMBS = 5;
const FLAG_MARGIN = 10;
let $arrows = $('.js-modal-arrows');
let $thumbnails = $('.js-modal-product-images');
/**let $onsale = $('.on-sale');*/
$('body').on('click','.js-modal-thumb', (event) => {
if($('.js-modal-thumb').hasClass('selected')){
$('.js-modal-thumb').removeClass('selected');
}
$(event.currentTarget).addClass('selected');
$('.js-modal-product-cover').attr('src', $(event.target).data('image-large-src'));
$('.js-modal-product-cover').attr('title', $(event.target).attr('title'));
$('.js-modal-product-cover').attr('alt', $(event.target).attr('alt'));
})
.on('click', 'aside#thumbnails', (event) => {
if (event.target.id == 'thumbnails'){
$('#product-modal').modal('hide');
}
});
/**
if($onsale.length && $('#product').length){
$('.new').css('top',$onsale.height() + FLAG_MARGIN);
}
*/
if ($('.js-modal-product-images li').length <= MAX_THUMBS) {
$arrows.css('opacity', '.2');
} else {
/**
$arrows.on('click', (event) => {
if ($(event.target).hasClass('arrow-up') && $thumbnails.position().top < 0) {
this.move('up');
$('.js-modal-arrow-down').css('opacity','1');
} else if ($(event.target).hasClass('arrow-down') && $thumbnails.position().top + $thumbnails.height() > $('.js-modal-mask').height()) {
this.move('down');
$('.js-modal-arrow-up').css('opacity','1');
}
});
*/
}
}
move(direction) {
const THUMB_MARGIN = 10;
var $thumbnails = $('.js-modal-product-images');
var thumbHeight = $('.js-modal-product-images li img').height() + THUMB_MARGIN;
var currentPosition = $thumbnails.position().top;
$thumbnails.velocity({
translateY: (direction === 'up') ? currentPosition + thumbHeight : currentPosition - thumbHeight
},function(){
if ($thumbnails.position().top >= 0) {
$('.js-modal-arrow-up').css('opacity','.2');
} else if ($thumbnails.position().top + $thumbnails.height() <= $('.js-modal-mask').height()) {
$('.js-modal-arrow-down').css('opacity','.2');
}
});
}
}

View File

@@ -0,0 +1,82 @@
/**
* 2007-2017 PrestaShop
*
* 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.txt.
* 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 http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright PrestaShop SA
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
import $ from 'jquery';
import DropDown from './drop-down';
export default class TopMenu extends DropDown {
init() {
let elmId;
let self = this;
this.el.find('li').hover((e) => {
if (this.el.parent().hasClass('mobile')) {
return;
}
if (elmId !== $(e.currentTarget).attr('id')) {
if ($(e.target).data('depth') === 0) {
$(`#${elmId} .js-sub-menu`).hide();
}
elmId = $(e.currentTarget).attr('id');
}
if (elmId && $(e.target).data('depth') === 0) {
$(`#${elmId} .js-sub-menu`).show().css({
top: $(`#${elmId}`).height() + $(`#${elmId}`).position().top
});
}
});
$('#menu-icon').on('click', function() {
$('#mobile_top_menu_wrapper').toggle();
self.toggleMobileMenu();
});
$('.js-top-menu').mouseleave(() => {
if (this.el.parent().hasClass('mobile')) {
return;
}
$(`#${elmId} .js-sub-menu`).hide();
});
this.el.on('click', (e) => {
if (this.el.parent().hasClass('mobile')) {
return;
}
e.stopPropagation();
});
prestashop.on('responsive update', function(event) {
$('.js-sub-menu').removeAttr('style');
self.toggleMobileMenu();
});
super.init();
}
toggleMobileMenu() {
if ($('#mobile_top_menu_wrapper').is(":visible")) {
$('#notifications').hide();
$('#wrapper').hide();
$('#footer').hide();
} else {
$('#notifications').show();
$('#wrapper').show();
$('#footer').show();
}
}
}

View File

@@ -0,0 +1,42 @@
/**
* 2007-2017 PrestaShop
*
* 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.txt.
* 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 http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright PrestaShop SA
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
import $ from 'jquery';
function initRmaItemSelector() {
$('#order-return-form table thead input[type=checkbox]').on('click', function() {
var checked = $(this).prop('checked');
$('#order-return-form table tbody input[type=checkbox]').each(function(_, checkbox) {
$(checkbox).prop('checked', checked);
});
});
}
function setupCustomerScripts() {
if ($('body#order-detail')) {
initRmaItemSelector();
}
}
$(document).ready(setupCustomerScripts);

View File

@@ -0,0 +1,35 @@
<?php
/**
* 2007-2017 PrestaShop
*
* 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.txt.
* 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 http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright PrestaShop SA
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
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;

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,35 @@
<?php
/**
* 2007-2017 PrestaShop
*
* 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.txt.
* 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 http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright PrestaShop SA
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
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;

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,205 @@
/**
* 2007-2017 PrestaShop
*
* 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.txt.
* 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 http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright PrestaShop SA
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
import $ from 'jquery';
import prestashop from 'prestashop';
import 'velocity-animate';
import ProductMinitature from './components/product-miniature';
$(document).ready(() => {
prestashop.on('clickQuickView', function (elm) {
let data = {
'action': 'quickview',
'id_product': elm.dataset.idProduct,
'id_product_attribute': elm.dataset.idProductAttribute,
};
$.post(prestashop.urls.pages.product, data, null, 'json').then(function (resp) {
$('body').append(resp.quickview_html);
let productModal = $(`#quickview-modal-${resp.product.id}-${resp.product.id_product_attribute}`);
productModal.modal('show');
productConfig(productModal);
productModal.on('hidden.bs.modal', function () {
productModal.remove();
});
}).fail((resp) => {
prestashop.emit('handleError', {eventType: 'clickQuickView', resp: resp});
});
});
var productConfig = (qv) => {
const MAX_THUMBS = 4;
var $arrows = $('.js-arrows');
var $thumbnails = qv.find('.js-qv-product-images');
$('.js-thumb').on('click', (event) => {
if ($('.js-thumb').hasClass('selected')) {
$('.js-thumb').removeClass('selected');
}
$(event.currentTarget).addClass('selected');
$('.js-qv-product-cover').attr('src', $(event.target).data('image-large-src'));
});
/**DONGND:: fix scroll product image - quickview*/
var number_thumb = $thumbnails.find('li').length;
if (style_scroll_quickview == 'vertical')
{
var mask_size = $thumbnails.parent().height();
// size_item_quickview = $thumbnails.find('li').height();
}
else
{
var mask_size = $thumbnails.parent().width();
// size_item_quickview = $thumbnails.find('li').width();
}
// console.log($thumbnails);
var size_scroll = size_item_quickview*number_thumb;
var check_arrow_exists = size_scroll - mask_size;
// console.log(size_item_quickview);
// console.log(number_thumb);
// console.log(check_arrow_exists);
if (check_arrow_exists >= size_item_quickview)
{
/** LEO_THEME : FIX QUICKVIEW NOT SCROLL IMAGE*/
$('.quickview .js-qv-mask').addClass('scroll');
$('.js-arrows').addClass('scroll');
$arrows.show();
$('.quickview .js-qv-mask').unbind('backward');
$('.quickview .js-qv-mask').unbind('forward');
$('.quickview .js-qv-mask').scrollbox({
direction: style_scroll_quickview,
distance: size_item_quickview,
autoPlay: false,
step: 1,
});
$('.arrow-up').click(function () {
$('.quickview .js-qv-mask').trigger('backward');
});
$('.arrow-down').click(function () {
$('.quickview .js-qv-mask').trigger('forward');
});
}
else
{
$('.quickview .js-qv-mask').removeClass('scroll');
$arrows.hide();
$('.js-arrows').removeClass('scroll');
}
qv.find('#quantity_wanted').TouchSpin({
verticalbuttons: true,
verticalupclass: 'material-icons touchspin-up',
verticaldownclass: 'material-icons touchspin-down',
buttondown_class: 'btn btn-touchspin js-touchspin',
buttonup_class: 'btn btn-touchspin js-touchspin',
min: 1,
max: 1000000
});
};
var move = (direction) => {
const THUMB_MARGIN = 20;
var $thumbnails = $('.js-qv-product-images');
var thumbHeight = $('.js-qv-product-images li img').height() + THUMB_MARGIN;
var currentPosition = $thumbnails.position().top;
$thumbnails.velocity({
translateY: (direction === 'up') ? currentPosition + thumbHeight : currentPosition - thumbHeight
}, function () {
if ($thumbnails.position().top >= 0) {
$('.arrow-up').css('opacity', '.2');
} else if ($thumbnails.position().top + $thumbnails.height() <= $('.js-qv-mask').height()) {
$('.arrow-down').css('opacity', '.2');
}
});
};
$('body').on('click', '#search_filter_toggler', function () {
$('#search_filters_wrapper').removeClass('hidden-sm-down');
$('#content-wrapper').addClass('hidden-sm-down');
$('#footer').addClass('hidden-sm-down');
});
$('#search_filter_controls .clear').on('click', function () {
$('#search_filters_wrapper').addClass('hidden-sm-down');
$('#content-wrapper').removeClass('hidden-sm-down');
$('#footer').removeClass('hidden-sm-down');
});
$('#search_filter_controls .ok').on('click', function () {
$('#search_filters_wrapper').addClass('hidden-sm-down');
$('#content-wrapper').removeClass('hidden-sm-down');
$('#footer').removeClass('hidden-sm-down');
});
const parseSearchUrl = function (event) {
// if (event.target.dataset.searchUrl !== undefined) {
// return event.target.dataset.searchUrl;
// }
// if ($(event.target).parent()[0].dataset.searchUrl === undefined) {
// throw new Error('Can not parse search URL');
// }
// return $(event.target).parent()[0].dataset.searchUrl;
if (event.target.getAttribute('data-search-url') !== undefined) {
return event.target.getAttribute('data-search-url');
}
if ($(event.target).parent()[0].getAttribute('data-search-url') === undefined) {
throw new Error('Can not parse search URL');
}
return $(event.target).parent()[0].getAttribute('data-search-url');
};
$('body').on('change', '#search_filters input[data-search-url]', function (event) {
prestashop.emit('updateFacets', parseSearchUrl(event));
});
$('body').on('click', '.js-search-filters-clear-all', function (event) {
prestashop.emit('updateFacets', parseSearchUrl(event));
});
$('body').on('click', '.js-search-link', function (event) {
event.preventDefault();
prestashop.emit('updateFacets',$(event.target).closest('a').get(0).href);
});
$('body').on('change', '#search_filters select', function (event) {
const form = $(event.target).closest('form');
prestashop.emit('updateFacets', '?' + form.serialize());
});
prestashop.on('updateProductList', (data) => {
updateProductListDOM(data);
});
});
function updateProductListDOM (data) {
$('#search_filters').replaceWith(data.rendered_facets);
$('#js-active-search-filters').replaceWith(data.rendered_active_filters);
$('#js-product-list-top').replaceWith(data.rendered_products_top);
$('#js-product-list').replaceWith(data.rendered_products);
$('#js-product-list-bottom').replaceWith(data.rendered_products_bottom);
let productMinitature = new ProductMinitature();
productMinitature.init();
}

View File

@@ -0,0 +1,272 @@
/**
* 2007-2017 PrestaShop
*
* 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.txt.
* 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 http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright PrestaShop SA
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
import $ from 'jquery';
$(document).ready(function () {
/**DONGND:: check if display arrow*/
createProductSpin();
createInputFile();
coverImage();
imageScrollBox(false, false);
prestashop.on('updatedProduct', function (event) {
createInputFile();
coverImage();
if (event && event.product_minimal_quantity) {
const minimalProductQuantity = parseInt(event.product_minimal_quantity, 10);
const quantityInputSelector = '#quantity_wanted';
let quantityInput = $(quantityInputSelector);
// @see http://www.virtuosoft.eu/code/bootstrap-touchspin/ about Bootstrap TouchSpin
quantityInput.trigger('touchspin.updatesettings', {min: minimalProductQuantity});
}
/**LEO_THEME : FIX PRODUCT PAGE NOT SCROLL IMAGE*/
$('.js-product-images-modal').replaceWith(event.product_images_modal);
imageScrollBox(false, true);
$($('.tabs .nav-link.active').attr('href')).addClass('active').removeClass('fade');
});
/**DONGND:: fix scroll product image when resize*/
$(window).resize(function () {
if (style_scroll_quickview_attr == 'vertical')
{
var check_li_item_first_load = $('.quickview .js-qv-product-images li').height();
}
else
{
var check_li_item_first_load = $('.quickview .js-qv-product-images li').width();
};
if (check_li_item_first_load > 0)
{
imageScrollBox(true, true);
}
else
{
imageScrollBox(true, false);
}
});
function coverImage() {
$('.js-thumb').on(
'click',
(event) => {
$('.js-modal-product-cover').attr('src',$(event.target).data('image-large-src'));
$('.selected').removeClass('selected');
$(event.target).addClass('selected');
$('.js-qv-product-cover').prop('src', $(event.currentTarget).data('image-large-src'));
}
);
}
function imageScrollBox(checkupdate, checkupdatequickview)
{
/**DONGND:: fix scroll product image - product page*/
var number_thumb_page = $('#main .js-qv-product-images li').length;
if (style_scroll_page == 'vertical')
{
var mask_size_page = $('#main .js-qv-mask').height();
if (checkupdate == true)
{
size_item_page = $('#main .js-qv-product-images li').height();
};
}
else
{
var mask_size_page = $('#main .js-qv-mask').width();
if (checkupdate == true)
{
size_item_page = $('#main .js-qv-product-images li').width();
};
};
var size_scroll_page = size_item_page*number_thumb_page;
var check_arrow_page_exists = size_scroll_page - mask_size_page;
if (check_arrow_page_exists >= size_item_page)
{
$('#main .js-qv-mask').addClass('scroll');
$('#main .scroll-box-arrows').addClass('scroll');
$('#main .js-qv-mask').unbind('backward');
$('#main .js-qv-mask').unbind('forward');
$('#main .js-qv-mask').scrollbox({
direction: style_scroll_page,
distance: size_item_page,
autoPlay: false,
step: 1,
});
$('#main .scroll-box-arrows .left').click(function () {
$('#main .js-qv-mask').trigger('backward');
});
$('#main .scroll-box-arrows .right').click(function () {
$('#main .js-qv-mask').trigger('forward');
});
} else {
$('#main .js-qv-mask').removeClass('scroll');
$('#main .scroll-box-arrows').removeClass('scroll');
};
/**DONGND:: fix scroll product image - quickview when change attribute*/
if (checkupdatequickview == true)
{
var number_thumb_quickview = $('.quickview .js-qv-product-images li').length;
if (style_scroll_quickview_attr == 'vertical')
{
var mask_size_quickview = $('.quickview .js-qv-mask').height();
if (checkupdate == true || checkupdate == false)
{
size_item_quickview_attr = $('.quickview .js-qv-product-images li').height();
}
}
else
{
var mask_size_quickview = $('.quickview .js-qv-mask').width();
if (checkupdate == true || checkupdate == false)
{
size_item_quickview_attr = $('.quickview .js-qv-product-images li').width();
}
};
var size_scroll_quickview = size_item_quickview_attr*number_thumb_quickview;
var check_arrow_quickview_exists = size_scroll_quickview - mask_size_quickview;
// console.log(checkupdate);
// console.log(size_item_quickview_attr);
// console.log(number_thumb_quickview);
// console.log(size_scroll_quickview);
// console.log(mask_size_quickview);
// console.log(check_arrow_quickview_exists);
if (check_arrow_quickview_exists >= size_item_quickview_attr)
{
$('.quickview .js-qv-mask').addClass('scroll');
$('.quickview .js-arrows').addClass('scroll');
$('.quickview .js-arrows').show();
$('.quickview .js-qv-mask').unbind('backward');
$('.quickview .js-qv-mask').unbind('forward');
$('.quickview .js-qv-mask').scrollbox({
direction: style_scroll_quickview_attr,
distance: size_item_quickview_attr,
autoPlay: false,
step: 1,
});
$('.quickview .arrow-up').click(function () {
$('.quickview .js-qv-mask').trigger('backward');
});
$('.quickview .arrow-down').click(function () {
$('.quickview .js-qv-mask').trigger('forward');
});
} else {
$('.quickview .js-qv-mask').removeClass('scroll');
$('.quickview .js-arrows').removeClass('scroll');
$('.quickview .js-arrows').hide();
};
}
/**DONGND:: fix scroll product image at popup - product page*/
var number_thumb_popup = $('.js-product-images-modal .js-modal-product-images li').length;
if (style_scroll_popup == 'vertical')
{
var mask_size_popup = $('.js-product-images-modal .js-modal-mask').height();
if (checkupdate == true && $('.js-product-images-modal .js-modal-product-images li').height() != 0)
{
size_item_popup = $('.js-product-images-modal .js-modal-product-images li').height();
};
}
else
{
var mask_size_popup = $('.js-product-images-modal .js-modal-mask').width();
if (checkupdate == true && $('.js-product-images-modal .js-modal-product-images li').width() != 0)
{
size_item_popup = $('.js-product-images-modal .js-modal-product-images li').width();
};
};
var size_scroll_popup = size_item_popup*number_thumb_popup;
var check_arrow_popup_exists = size_scroll_popup - mask_size_popup;
if (check_arrow_popup_exists >= size_item_popup)
{
$('.js-product-images-modal .js-modal-mask').addClass('scroll');
$('.js-modal-arrows').addClass('scroll');
$('.js-product-images-modal .js-modal-mask').unbind('backward');
$('.js-product-images-modal .js-modal-mask').unbind('forward');
$('.js-product-images-modal .js-modal-mask').scrollbox({
direction: style_scroll_popup,
distance: size_item_popup,
autoPlay: false,
step: 1,
});
$('.arrow-up').click(function () {
$('.js-product-images-modal .js-modal-mask').trigger('backward');
});
$('.arrow-down').click(function () {
$('.js-product-images-modal .js-modal-mask').trigger('forward');
});
} else {
$('.js-modal-arrows').hide();
};
}
function createInputFile()
{
$('.js-file-input').on('change', (event) => {
let target, file;
if ((target = $(event.currentTarget)[0]) && (file = target.files[0])) {
$(target).prev().text(file.name);
}
});
}
function createProductSpin()
{
let quantityInput = $('#quantity_wanted');
quantityInput.TouchSpin({
verticalbuttons: true,
verticalupclass: 'material-icons touchspin-up',
verticaldownclass: 'material-icons touchspin-down',
buttondown_class: 'btn btn-touchspin js-touchspin',
buttonup_class: 'btn btn-touchspin js-touchspin',
min: parseInt(quantityInput.attr('min'), 10),
max: 1000000
});
var quantity = quantityInput.val();
quantityInput.on('keyup change', function (event) {
const newQuantity = $(this).val();
if (newQuantity !== quantity) {
quantity = newQuantity;
let $productRefresh = $('.product-refresh');
$(event.currentTarget).trigger('touchspin.stopspin');
$productRefresh.trigger('click', {eventType: 'updatedProductQuantity'});
}
event.preventDefault();
return false;
});
}
});

View File

@@ -0,0 +1,79 @@
/**
* 2007-2017 PrestaShop
*
* 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.txt.
* 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 http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright PrestaShop SA
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
import $ from 'jquery';
import prestashop from 'prestashop';
prestashop.responsive = prestashop.responsive || {};
prestashop.responsive.current_width = window.innerWidth;
prestashop.responsive.min_width = 768;
prestashop.responsive.mobile = prestashop.responsive.current_width < prestashop.responsive.min_width;
function swapChildren(obj1, obj2)
{
var temp = obj2.children().detach();
obj2.empty().append(obj1.children().detach());
obj1.append(temp);
}
function toggleMobileStyles()
{
if (prestashop.responsive.mobile) {
$("*[id^='_desktop_']").each(function(idx, el) {
var target = $('#' + el.id.replace('_desktop_', '_mobile_'));
if (target.length) {
swapChildren($(el), target);
}
});
} else {
$("*[id^='_mobile_']").each(function(idx, el) {
var target = $('#' + el.id.replace('_mobile_', '_desktop_'));
if (target.length) {
swapChildren($(el), target);
}
});
}
prestashop.emit('responsive update', {
mobile: prestashop.responsive.mobile
});
}
$(window).on('resize', function() {
var _cw = prestashop.responsive.current_width;
var _mw = prestashop.responsive.min_width;
var _w = window.innerWidth;
var _toggle = (_cw >= _mw && _w < _mw) || (_cw < _mw && _w >= _mw);
prestashop.responsive.current_width = _w;
prestashop.responsive.mobile = prestashop.responsive.current_width < prestashop.responsive.min_width;
if (_toggle) {
toggleMobileStyles();
}
});
$(document).ready(function() {
if (prestashop.responsive.mobile) {
toggleMobileStyles();
}
});

View File

@@ -0,0 +1,69 @@
/**
* 2007-2017 PrestaShop
*
* 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.txt.
* 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 http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright PrestaShop SA
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
import 'expose-loader?Tether!tether';
import 'bootstrap/dist/js/bootstrap.min';
import 'flexibility';
import 'bootstrap-touchspin';
import './responsive';
import './checkout';
import './customer';
import './listing';
import './product';
import './cart';
import DropDown from './components/drop-down';
import Form from './components/form';
import ProductMinitature from './components/product-miniature';
import ProductSelect from './components/product-select';
import TopMenu from './components/top-menu';
import prestashop from 'prestashop';
import EventEmitter from 'events';
import './lib/bootstrap-filestyle.min';
import './lib/jquery.scrollbox.min';
import './components/block-cart';
// "inherit" EventEmitter
for (var i in EventEmitter.prototype) {
prestashop[i] = EventEmitter.prototype[i];
}
$(document).ready(() => {
let dropDownEl = $('.js-dropdown');
const form = new Form();
let topMenuEl = $('.js-top-menu ul[data-depth="0"]');
let dropDown = new DropDown(dropDownEl);
let topMenu = new TopMenu(topMenuEl);
let productMinitature = new ProductMinitature();
let productSelect = new ProductSelect();
dropDown.init();
form.init();
topMenu.init();
productMinitature.init();
productSelect.init();
});