first commit
This commit is contained in:
43
modules/ps_facetedsearch/_dev/back/blocklayered.css
Normal file
43
modules/ps_facetedsearch/_dev/back/blocklayered.css
Normal file
@@ -0,0 +1,43 @@
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @author PrestaShop SA <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)
|
||||
*/
|
||||
.bootstrap .filter_list .filter_list_item {
|
||||
display: table;
|
||||
width: 100%;
|
||||
padding: 5px 0;
|
||||
margin-bottom: 4px;
|
||||
background-color: white;
|
||||
box-shadow: rgba(0, 0, 0, 0.3) 0 0 3px, rgba(0, 0, 0, 0.1) 0 -2px 0 inset;
|
||||
border-radius: 3px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.bootstrap .filter_panel {
|
||||
min-height: 20px;
|
||||
padding: 7px 7px 0px 7px;
|
||||
margin-bottom: 20px;
|
||||
background-color: #ebebeb;
|
||||
border: 1px solid #d9d9d9;
|
||||
border-radius: 3px;
|
||||
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
.bootstrap .filter_panel header {
|
||||
margin-bottom: 7px;
|
||||
}
|
||||
.bootstrap .prestashop-switch span {
|
||||
display: none;
|
||||
}/*# sourceMappingURL=blocklayered.css.map */
|
||||
1
modules/ps_facetedsearch/_dev/back/blocklayered.css.map
Normal file
1
modules/ps_facetedsearch/_dev/back/blocklayered.css.map
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["blocklayered.scss","blocklayered.css"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;EAAA;AAmBE;EACC,cAAA;EACA,WAAA;EACA,cAAA;EACA,kBAAA;EACA,uBAAA;EAEA,yEAAA;EAKA,kBAAA;EACC,eAAA;ACAJ;ADGE;EACC,gBAAA;EACA,wBAAA;EACA,mBAAA;EACA,yBAAA;EACA,yBAAA;EACA,kBAAA;EAEA,+CAAA;ACDH;ADGI;EACC,kBAAA;ACDL;ADMI;EACE,aAAA;ACJN","file":"blocklayered.css"}
|
||||
56
modules/ps_facetedsearch/_dev/back/blocklayered.scss
Normal file
56
modules/ps_facetedsearch/_dev/back/blocklayered.scss
Normal file
@@ -0,0 +1,56 @@
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @author PrestaShop SA <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)
|
||||
*/
|
||||
.bootstrap {
|
||||
.filter_list .filter_list_item {
|
||||
display: table;
|
||||
width: 100%;
|
||||
padding: 5px 0;
|
||||
margin-bottom: 4px;
|
||||
background-color: white;
|
||||
-webkit-box-shadow: rgba(0, 0, 0, 0.3) 0 0 3px, rgba(0, 0, 0, 0.1) 0 -2px 0 inset;
|
||||
box-shadow: rgba(0, 0, 0, 0.3) 0 0 3px, rgba(0, 0, 0, 0.1) 0 -2px 0 inset;
|
||||
-webkit-border-radius: 3px;
|
||||
-moz-border-radius: 3px;
|
||||
-ms-border-radius: 3px;
|
||||
-o-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.filter_panel {
|
||||
min-height: 20px;
|
||||
padding: 7px 7px 0px 7px;
|
||||
margin-bottom: 20px;
|
||||
background-color: #ebebeb;
|
||||
border: 1px solid #d9d9d9;
|
||||
border-radius: 3px;
|
||||
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
|
||||
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
|
||||
|
||||
header {
|
||||
margin-bottom: 7px;
|
||||
}
|
||||
}
|
||||
|
||||
.prestashop-switch {
|
||||
span {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
247
modules/ps_facetedsearch/_dev/back/index.js
Normal file
247
modules/ps_facetedsearch/_dev/back/index.js
Normal file
@@ -0,0 +1,247 @@
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @author PrestaShop SA <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)
|
||||
*/
|
||||
import './blocklayered.scss';
|
||||
|
||||
/* eslint-disable no-unused-vars, no-alert */
|
||||
function checkForm() {
|
||||
let isCategorySelected = false;
|
||||
let isFilterSelected = false;
|
||||
|
||||
$('#categories-treeview input[type=checkbox]').each(function checkCategoriesCheckboxes() {
|
||||
if ($(this).prop('checked')) {
|
||||
isCategorySelected = true;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
$('.filter_list_item input[type=checkbox]').each(function checkFilterListCheckboxes() {
|
||||
if ($(this).prop('checked')) {
|
||||
isFilterSelected = true;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
if (!isCategorySelected) {
|
||||
alert(translations.no_selected_categories);
|
||||
$('#categories-treeview input[type=checkbox]').first().focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!isFilterSelected) {
|
||||
alert(translations.no_selected_filters);
|
||||
$('#filter_list_item input[type=checkbox]').first().focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
$(document).ready(() => {
|
||||
$('.ajaxcall').click(function onAjaxCall() {
|
||||
if (this.legend === undefined) {
|
||||
this.legend = $(this).html();
|
||||
}
|
||||
|
||||
if (this.running === undefined) {
|
||||
this.running = false;
|
||||
}
|
||||
|
||||
if (this.running === true) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$('.ajax-message').hide();
|
||||
this.running = true;
|
||||
|
||||
if (typeof (this.restartAllowed) === 'undefined' || this.restartAllowed) {
|
||||
$(this).html(this.legend + translations.in_progress);
|
||||
$('#indexing-warning').show();
|
||||
}
|
||||
|
||||
this.restartAllowed = false;
|
||||
const type = $(this).attr('rel');
|
||||
|
||||
$.ajax({
|
||||
url: `${this.href}&ajax=1`,
|
||||
context: this,
|
||||
dataType: 'json',
|
||||
cache: 'false',
|
||||
success() {
|
||||
this.running = false;
|
||||
this.restartAllowed = true;
|
||||
$('#indexing-warning').hide();
|
||||
$(this).html(this.legend);
|
||||
|
||||
$('#ajax-message-ok span').html(
|
||||
type === 'price' ? translations.url_indexation_finished : translations.attribute_indexation_finished,
|
||||
);
|
||||
|
||||
$('#ajax-message-ok').show();
|
||||
},
|
||||
error() {
|
||||
this.restartAllowed = true;
|
||||
$('#indexing-warning').hide();
|
||||
|
||||
$('#ajax-message-ko span').html(
|
||||
type === 'price' ? translations.url_indexation_failed : translations.attribute_indexation_failed,
|
||||
);
|
||||
|
||||
$('#ajax-message-ko').show();
|
||||
$(this).html(this.legend);
|
||||
this.running = false;
|
||||
},
|
||||
});
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
let totalCount = 0;
|
||||
$('.ajaxcall-recurcive').each((it, elm) => {
|
||||
$(elm).click(function onAjaxRecursiveCall(e) {
|
||||
e.preventDefault();
|
||||
|
||||
if (this.cursor === undefined) {
|
||||
this.cursor = 0;
|
||||
}
|
||||
|
||||
if (this.legend === undefined) {
|
||||
this.legend = $(this).html();
|
||||
}
|
||||
|
||||
if (this.running === undefined) {
|
||||
this.running = false;
|
||||
}
|
||||
|
||||
if (this.running === true) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$('.ajax-message').hide();
|
||||
|
||||
this.running = true;
|
||||
|
||||
if (typeof (this.restartAllowed) === 'undefined' || this.restartAllowed) {
|
||||
$(this).html(this.legend + translations.in_progress);
|
||||
$('#indexing-warning').show();
|
||||
}
|
||||
|
||||
this.restartAllowed = false;
|
||||
|
||||
$.ajax({
|
||||
url: `${this.href}&ajax=1&cursor=${this.cursor}`,
|
||||
context: this,
|
||||
dataType: 'json',
|
||||
cache: 'false',
|
||||
success(res) {
|
||||
this.running = false;
|
||||
if (res.result) {
|
||||
this.cursor = 0;
|
||||
totalCount = 0;
|
||||
$('#indexing-warning').hide();
|
||||
$(this).html(this.legend);
|
||||
$('#ajax-message-ok span').html(translations.price_indexation_finished);
|
||||
$('#ajax-message-ok').show();
|
||||
return;
|
||||
}
|
||||
|
||||
totalCount += parseInt(res.count, 10);
|
||||
this.cursor = parseInt(res.cursor, 10);
|
||||
$(this).html(
|
||||
this.legend + translations.price_indexation_in_progress.replace(
|
||||
'%s',
|
||||
`${totalCount}/${res.total}`,
|
||||
),
|
||||
);
|
||||
$(this).click();
|
||||
},
|
||||
error(res) {
|
||||
this.restartAllowed = true;
|
||||
$('#indexing-warning').hide();
|
||||
$('#ajax-message-ko span').html(translations.price_indexation_failed);
|
||||
$('#ajax-message-ko').show();
|
||||
$(this).html(this.legend);
|
||||
|
||||
this.cursor = 0;
|
||||
this.running = false;
|
||||
},
|
||||
});
|
||||
return false;
|
||||
});
|
||||
});
|
||||
|
||||
if (typeof PS_LAYERED_INDEXED !== 'undefined' && PS_LAYERED_INDEXED) {
|
||||
$('#url-indexe').click();
|
||||
$('#full-index').click();
|
||||
}
|
||||
|
||||
$('.sortable').sortable({
|
||||
forcePlaceholderSize: true,
|
||||
});
|
||||
|
||||
$('.filter_list_item input[type=checkbox]').click(function onFilterLickItemCheckboxesClicked() {
|
||||
const currentSelectedFiltersCount = parseInt($('#selected_filters').html(), 10);
|
||||
|
||||
$('#selected_filters').html(
|
||||
$(this).prop('checked') ? currentSelectedFiltersCount + 1 : currentSelectedFiltersCount - 1,
|
||||
);
|
||||
});
|
||||
|
||||
if (typeof window.filters !== 'undefined') {
|
||||
const filters = JSON.parse(window.filters);
|
||||
let container = null;
|
||||
let $el;
|
||||
Object.keys(filters).forEach((filter) => {
|
||||
$el = $(`#${filter}`);
|
||||
$el.prop('checked', true);
|
||||
$('#selected_filters').html(parseInt($('#selected_filters').html(), 10) + 1);
|
||||
$(`select[name="${filter}_filter_type"]`).val(filters[filter].filter_type);
|
||||
$(`select[name="${filter}_filter_show_limit"]`).val(filters[filter].filter_show_limit);
|
||||
if (container === null) {
|
||||
container = $(`#${filter}`).closest('ul');
|
||||
$el.closest('li').detach().prependTo(container);
|
||||
} else {
|
||||
$el.closest('li').detach().insertAfter(container);
|
||||
}
|
||||
|
||||
container = $el.closest('li');
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on('ready', () => {
|
||||
const layeredDefaultCategory = $('input[name="ps_layered_filter_by_default_category"]');
|
||||
layeredDefaultCategory.on('change', function initializeOptions(event) {
|
||||
const elm = $(this);
|
||||
|
||||
if (!elm.prop('checked')) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (elm.val() === '1') {
|
||||
$('input[name="ps_layered_full_tree"][value="0"]').prop('checked', true);
|
||||
$('input[name="ps_layered_full_tree"]').prop('disabled', true);
|
||||
} else {
|
||||
$('input[name="ps_layered_full_tree"]').prop('disabled', false);
|
||||
}
|
||||
});
|
||||
|
||||
layeredDefaultCategory.filter('[value="1"]').trigger('change');
|
||||
});
|
||||
26
modules/ps_facetedsearch/_dev/cldr/exception/localization.js
Normal file
26
modules/ps_facetedsearch/_dev/cldr/exception/localization.js
Normal file
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @author PrestaShop SA <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)
|
||||
*/
|
||||
class LocalizationException {
|
||||
constructor(message) {
|
||||
this.message = message;
|
||||
this.name = 'LocalizationException';
|
||||
}
|
||||
}
|
||||
|
||||
export default LocalizationException;
|
||||
29
modules/ps_facetedsearch/_dev/cldr/index.js
Normal file
29
modules/ps_facetedsearch/_dev/cldr/index.js
Normal file
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @author PrestaShop SA <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)
|
||||
*/
|
||||
import NumberFormatter from './number-formatter';
|
||||
import NumberSymbol from './number-symbol';
|
||||
import PriceSpecification from './specifications/price';
|
||||
import NumberSpecification from './specifications/number';
|
||||
|
||||
export {
|
||||
PriceSpecification,
|
||||
NumberSpecification,
|
||||
NumberFormatter,
|
||||
NumberSymbol,
|
||||
};
|
||||
317
modules/ps_facetedsearch/_dev/cldr/number-formatter.js
Normal file
317
modules/ps_facetedsearch/_dev/cldr/number-formatter.js
Normal file
@@ -0,0 +1,317 @@
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @author PrestaShop SA <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)
|
||||
*/
|
||||
/**
|
||||
* These placeholders are used in CLDR number formatting templates.
|
||||
* They are meant to be replaced by the correct localized symbols in the number formatting process.
|
||||
*/
|
||||
import NumberSymbol from './number-symbol';
|
||||
import PriceSpecification from './specifications/price';
|
||||
import NumberSpecification from './specifications/number';
|
||||
|
||||
const escapeRE = require('lodash.escaperegexp');
|
||||
|
||||
const CURRENCY_SYMBOL_PLACEHOLDER = '¤';
|
||||
const DECIMAL_SEPARATOR_PLACEHOLDER = '.';
|
||||
const GROUP_SEPARATOR_PLACEHOLDER = ',';
|
||||
const MINUS_SIGN_PLACEHOLDER = '-';
|
||||
const PERCENT_SYMBOL_PLACEHOLDER = '%';
|
||||
const PLUS_SIGN_PLACEHOLDER = '+';
|
||||
|
||||
class NumberFormatter {
|
||||
/**
|
||||
* @param NumberSpecification specification Number specification to be used
|
||||
* (can be a number spec, a price spec, a percentage spec)
|
||||
*/
|
||||
constructor(specification) {
|
||||
this.numberSpecification = specification;
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats the passed number according to specifications.
|
||||
*
|
||||
* @param int|float|string number The number to format
|
||||
* @param NumberSpecification specification Number specification to be used
|
||||
* (can be a number spec, a price spec, a percentage spec)
|
||||
*
|
||||
* @return string The formatted number
|
||||
* You should use this this value for display, without modifying it
|
||||
*/
|
||||
format(number, specification) {
|
||||
if (specification !== undefined) {
|
||||
this.numberSpecification = specification;
|
||||
}
|
||||
|
||||
/*
|
||||
* We need to work on the absolute value first.
|
||||
* Then the CLDR pattern will add the sign if relevant (at the end).
|
||||
*/
|
||||
const num = Math.abs(number).toFixed(this.numberSpecification.getMaxFractionDigits());
|
||||
|
||||
let [majorDigits, minorDigits] = this.extractMajorMinorDigits(num);
|
||||
majorDigits = this.splitMajorGroups(majorDigits);
|
||||
minorDigits = this.adjustMinorDigitsZeroes(minorDigits);
|
||||
|
||||
// Assemble the final number
|
||||
let formattedNumber = majorDigits;
|
||||
|
||||
if (minorDigits) {
|
||||
formattedNumber += DECIMAL_SEPARATOR_PLACEHOLDER + minorDigits;
|
||||
}
|
||||
|
||||
// Get the good CLDR formatting pattern. Sign is important here !
|
||||
const pattern = this.getCldrPattern(number < 0);
|
||||
formattedNumber = this.addPlaceholders(formattedNumber, pattern);
|
||||
formattedNumber = this.replaceSymbols(formattedNumber);
|
||||
|
||||
formattedNumber = this.performSpecificReplacements(formattedNumber);
|
||||
|
||||
return formattedNumber;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get number's major and minor digits.
|
||||
*
|
||||
* Major digits are the "integer" part (before decimal separator),
|
||||
* minor digits are the fractional part
|
||||
* Result will be an array of exactly 2 items: [majorDigits, minorDigits]
|
||||
*
|
||||
* Usage example:
|
||||
* list(majorDigits, minorDigits) = this.getMajorMinorDigits(decimalNumber);
|
||||
*
|
||||
* @param DecimalNumber number
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
extractMajorMinorDigits(number) {
|
||||
// Get the number's major and minor digits.
|
||||
const result = number.toString().split('.');
|
||||
const majorDigits = result[0];
|
||||
const minorDigits = (result[1] === undefined) ? '' : result[1];
|
||||
|
||||
return [majorDigits, minorDigits];
|
||||
}
|
||||
|
||||
/**
|
||||
* Splits major digits into groups.
|
||||
*
|
||||
* e.g.: Given the major digits "1234567", and major group size
|
||||
* configured to 3 digits, the result would be "1 234 567"
|
||||
*
|
||||
* @param string majorDigits The major digits to be grouped
|
||||
*
|
||||
* @return string The grouped major digits
|
||||
*/
|
||||
splitMajorGroups(digit) {
|
||||
if (!this.numberSpecification.isGroupingUsed()) {
|
||||
return digit;
|
||||
}
|
||||
|
||||
// Reverse the major digits, since they are grouped from the right.
|
||||
const majorDigits = digit.split('').reverse();
|
||||
|
||||
// Group the major digits.
|
||||
let groups = [];
|
||||
groups.push(majorDigits.splice(0, this.numberSpecification.getPrimaryGroupSize()));
|
||||
while (majorDigits.length) {
|
||||
groups.push(majorDigits.splice(0, this.numberSpecification.getSecondaryGroupSize()));
|
||||
}
|
||||
|
||||
// Reverse back the digits and the groups
|
||||
groups = groups.reverse();
|
||||
const newGroups = [];
|
||||
groups.forEach((group) => {
|
||||
newGroups.push(group.reverse().join(''));
|
||||
});
|
||||
|
||||
// Reconstruct the major digits.
|
||||
return newGroups.join(GROUP_SEPARATOR_PLACEHOLDER);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds or remove trailing zeroes, depending on specified min and max fraction digits numbers.
|
||||
*
|
||||
* @param string minorDigits Digits to be adjusted with (trimmed or padded) zeroes
|
||||
*
|
||||
* @return string The adjusted minor digits
|
||||
*/
|
||||
adjustMinorDigitsZeroes(minorDigits) {
|
||||
let digit = minorDigits;
|
||||
|
||||
if (digit.length > this.numberSpecification.getMaxFractionDigits()) {
|
||||
// Strip any trailing zeroes.
|
||||
digit = digit.replace(/0+$/, '');
|
||||
}
|
||||
|
||||
if (digit.length < this.numberSpecification.getMinFractionDigits()) {
|
||||
// Re-add needed zeroes
|
||||
digit = digit.padEnd(
|
||||
this.numberSpecification.getMinFractionDigits(),
|
||||
'0',
|
||||
);
|
||||
}
|
||||
|
||||
return digit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the CLDR formatting pattern.
|
||||
*
|
||||
* @see http://cldr.unicode.org/translation/number-patterns
|
||||
*
|
||||
* @param bool isNegative If true, the negative pattern
|
||||
* will be returned instead of the positive one
|
||||
*
|
||||
* @return string The CLDR formatting pattern
|
||||
*/
|
||||
getCldrPattern(isNegative) {
|
||||
if (isNegative) {
|
||||
return this.numberSpecification.getNegativePattern();
|
||||
}
|
||||
|
||||
return this.numberSpecification.getPositivePattern();
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace placeholder number symbols with relevant numbering system's symbols.
|
||||
*
|
||||
* @param string number
|
||||
* The number to process
|
||||
*
|
||||
* @return string
|
||||
* The number with replaced symbols
|
||||
*/
|
||||
replaceSymbols(number) {
|
||||
const symbols = this.numberSpecification.getSymbol();
|
||||
|
||||
const map = {};
|
||||
map[DECIMAL_SEPARATOR_PLACEHOLDER] = symbols.getDecimal();
|
||||
map[GROUP_SEPARATOR_PLACEHOLDER] = symbols.getGroup();
|
||||
map[MINUS_SIGN_PLACEHOLDER] = symbols.getMinusSign();
|
||||
map[PERCENT_SYMBOL_PLACEHOLDER] = symbols.getPercentSign();
|
||||
map[PLUS_SIGN_PLACEHOLDER] = symbols.getPlusSign();
|
||||
|
||||
return this.strtr(number, map);
|
||||
}
|
||||
|
||||
/**
|
||||
* strtr() for JavaScript
|
||||
* Translate characters or replace substrings
|
||||
*/
|
||||
strtr(str, pairs) {
|
||||
const substrs = Object.keys(pairs).map(escapeRE);
|
||||
|
||||
return str.split(RegExp(`(${substrs.join('|')})`))
|
||||
.map((part) => pairs[part] || part)
|
||||
.join('');
|
||||
}
|
||||
|
||||
/**
|
||||
* Add missing placeholders to the number using the passed CLDR pattern.
|
||||
*
|
||||
* Missing placeholders can be the percent sign, currency symbol, etc.
|
||||
*
|
||||
* e.g. with a currency CLDR pattern:
|
||||
* - Passed number (partially formatted): 1,234.567
|
||||
* - Returned number: 1,234.567 ¤
|
||||
* ("¤" symbol is the currency symbol placeholder)
|
||||
*
|
||||
* @see http://cldr.unicode.org/translation/number-patterns
|
||||
*
|
||||
* @param formattedNumber
|
||||
* Number to process
|
||||
* @param pattern
|
||||
* CLDR formatting pattern to use
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
addPlaceholders(formattedNumber, pattern) {
|
||||
/*
|
||||
* Regex groups explanation:
|
||||
* # : literal "#" character. Once.
|
||||
* (,#+)* : any other "#" characters group, separated by ",". Zero to infinity times.
|
||||
* 0 : literal "0" character. Once.
|
||||
* (\.[0#]+)* : any combination of "0" and "#" characters groups, separated by '.'.
|
||||
* Zero to infinity times.
|
||||
*/
|
||||
return pattern.replace(/#?(,#+)*0(\.[0#]+)*/, formattedNumber);
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform some more specific replacements.
|
||||
*
|
||||
* Specific replacements are needed when number specification is extended.
|
||||
* For instance, prices have an extended number specification in order to
|
||||
* add currency symbol to the formatted number.
|
||||
*
|
||||
* @param string formattedNumber
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
performSpecificReplacements(formattedNumber) {
|
||||
if (this.numberSpecification instanceof PriceSpecification) {
|
||||
return formattedNumber
|
||||
.split(CURRENCY_SYMBOL_PLACEHOLDER)
|
||||
.join(this.numberSpecification.getCurrencySymbol());
|
||||
}
|
||||
|
||||
return formattedNumber;
|
||||
}
|
||||
|
||||
static build(specifications) {
|
||||
let symbol;
|
||||
|
||||
if (undefined !== specifications.numberSymbols) {
|
||||
symbol = new NumberSymbol(...specifications.numberSymbols);
|
||||
} else {
|
||||
symbol = new NumberSymbol(...specifications.symbol);
|
||||
}
|
||||
|
||||
let specification;
|
||||
|
||||
if (specifications.currencySymbol) {
|
||||
specification = new PriceSpecification(
|
||||
specifications.positivePattern,
|
||||
specifications.negativePattern,
|
||||
symbol,
|
||||
parseInt(specifications.maxFractionDigits, 10),
|
||||
parseInt(specifications.minFractionDigits, 10),
|
||||
specifications.groupingUsed,
|
||||
specifications.primaryGroupSize,
|
||||
specifications.secondaryGroupSize,
|
||||
specifications.currencySymbol,
|
||||
specifications.currencyCode,
|
||||
);
|
||||
} else {
|
||||
specification = new NumberSpecification(
|
||||
specifications.positivePattern,
|
||||
specifications.negativePattern,
|
||||
symbol,
|
||||
parseInt(specifications.maxFractionDigits, 10),
|
||||
parseInt(specifications.minFractionDigits, 10),
|
||||
specifications.groupingUsed,
|
||||
specifications.primaryGroupSize,
|
||||
specifications.secondaryGroupSize,
|
||||
);
|
||||
}
|
||||
|
||||
return new NumberFormatter(specification);
|
||||
}
|
||||
}
|
||||
|
||||
export default NumberFormatter;
|
||||
222
modules/ps_facetedsearch/_dev/cldr/number-symbol.js
Normal file
222
modules/ps_facetedsearch/_dev/cldr/number-symbol.js
Normal file
@@ -0,0 +1,222 @@
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @author PrestaShop SA <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)
|
||||
*/
|
||||
import LocalizationException from './exception/localization';
|
||||
|
||||
class NumberSymbol {
|
||||
/**
|
||||
* NumberSymbolList constructor.
|
||||
*
|
||||
* @param string decimal Decimal separator character
|
||||
* @param string group Digits group separator character
|
||||
* @param string list List elements separator character
|
||||
* @param string percentSign Percent sign character
|
||||
* @param string minusSign Minus sign character
|
||||
* @param string plusSign Plus sign character
|
||||
* @param string exponential Exponential character
|
||||
* @param string superscriptingExponent Superscripting exponent character
|
||||
* @param string perMille Permille sign character
|
||||
* @param string infinity The infinity sign. Corresponds to the IEEE infinity bit pattern.
|
||||
* @param string nan The NaN (Not A Number) sign. Corresponds to the IEEE NaN bit pattern.
|
||||
*
|
||||
* @throws LocalizationException
|
||||
*/
|
||||
constructor(
|
||||
decimal,
|
||||
group,
|
||||
list,
|
||||
percentSign,
|
||||
minusSign,
|
||||
plusSign,
|
||||
exponential,
|
||||
superscriptingExponent,
|
||||
perMille,
|
||||
infinity,
|
||||
nan,
|
||||
) {
|
||||
this.decimal = decimal;
|
||||
this.group = group;
|
||||
this.list = list;
|
||||
this.percentSign = percentSign;
|
||||
this.minusSign = minusSign;
|
||||
this.plusSign = plusSign;
|
||||
this.exponential = exponential;
|
||||
this.superscriptingExponent = superscriptingExponent;
|
||||
this.perMille = perMille;
|
||||
this.infinity = infinity;
|
||||
this.nan = nan;
|
||||
|
||||
this.validateData();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the decimal separator.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
getDecimal() {
|
||||
return this.decimal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the digit groups separator.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
getGroup() {
|
||||
return this.group;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the list elements separator.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
getList() {
|
||||
return this.list;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the percent sign.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
getPercentSign() {
|
||||
return this.percentSign;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the minus sign.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
getMinusSign() {
|
||||
return this.minusSign;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the plus sign.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
getPlusSign() {
|
||||
return this.plusSign;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the exponential character.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
getExponential() {
|
||||
return this.exponential;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the exponent character.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
getSuperscriptingExponent() {
|
||||
return this.superscriptingExponent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gert the per mille symbol (often "‰").
|
||||
*
|
||||
* @see https://en.wikipedia.org/wiki/Per_mille
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
getPerMille() {
|
||||
return this.perMille;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the infinity symbol (often "∞").
|
||||
*
|
||||
* @see https://en.wikipedia.org/wiki/Infinity_symbol
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
getInfinity() {
|
||||
return this.infinity;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the NaN (not a number) sign.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
getNan() {
|
||||
return this.nan;
|
||||
}
|
||||
|
||||
/**
|
||||
* Symbols list validation.
|
||||
*
|
||||
* @throws LocalizationException
|
||||
*/
|
||||
validateData() {
|
||||
if (!this.decimal || typeof this.decimal !== 'string') {
|
||||
throw new LocalizationException('Invalid decimal');
|
||||
}
|
||||
|
||||
if (!this.group || typeof this.group !== 'string') {
|
||||
throw new LocalizationException('Invalid group');
|
||||
}
|
||||
|
||||
if (!this.list || typeof this.list !== 'string') {
|
||||
throw new LocalizationException('Invalid symbol list');
|
||||
}
|
||||
|
||||
if (!this.percentSign || typeof this.percentSign !== 'string') {
|
||||
throw new LocalizationException('Invalid percentSign');
|
||||
}
|
||||
|
||||
if (!this.minusSign || typeof this.minusSign !== 'string') {
|
||||
throw new LocalizationException('Invalid minusSign');
|
||||
}
|
||||
|
||||
if (!this.plusSign || typeof this.plusSign !== 'string') {
|
||||
throw new LocalizationException('Invalid plusSign');
|
||||
}
|
||||
|
||||
if (!this.exponential || typeof this.exponential !== 'string') {
|
||||
throw new LocalizationException('Invalid exponential');
|
||||
}
|
||||
|
||||
if (!this.superscriptingExponent || typeof this.superscriptingExponent !== 'string') {
|
||||
throw new LocalizationException('Invalid superscriptingExponent');
|
||||
}
|
||||
|
||||
if (!this.perMille || typeof this.perMille !== 'string') {
|
||||
throw new LocalizationException('Invalid perMille');
|
||||
}
|
||||
|
||||
if (!this.infinity || typeof this.infinity !== 'string') {
|
||||
throw new LocalizationException('Invalid infinity');
|
||||
}
|
||||
|
||||
if (!this.nan || typeof this.nan !== 'string') {
|
||||
throw new LocalizationException('Invalid nan');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default NumberSymbol;
|
||||
170
modules/ps_facetedsearch/_dev/cldr/specifications/number.js
Normal file
170
modules/ps_facetedsearch/_dev/cldr/specifications/number.js
Normal file
@@ -0,0 +1,170 @@
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @author PrestaShop SA <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)
|
||||
*/
|
||||
import LocalizationException from '../exception/localization';
|
||||
import NumberSymbol from '../number-symbol';
|
||||
|
||||
class NumberSpecification {
|
||||
/**
|
||||
* Number specification constructor.
|
||||
*
|
||||
* @param string positivePattern CLDR formatting pattern for positive amounts
|
||||
* @param string negativePattern CLDR formatting pattern for negative amounts
|
||||
* @param NumberSymbol symbol Number symbol
|
||||
* @param int maxFractionDigits Maximum number of digits after decimal separator
|
||||
* @param int minFractionDigits Minimum number of digits after decimal separator
|
||||
* @param bool groupingUsed Is digits grouping used ?
|
||||
* @param int primaryGroupSize Size of primary digits group in the number
|
||||
* @param int secondaryGroupSize Size of secondary digits group in the number
|
||||
*
|
||||
* @throws LocalizationException
|
||||
*/
|
||||
constructor(
|
||||
positivePattern,
|
||||
negativePattern,
|
||||
symbol,
|
||||
maxFractionDigits,
|
||||
minFractionDigits,
|
||||
groupingUsed,
|
||||
primaryGroupSize,
|
||||
secondaryGroupSize,
|
||||
) {
|
||||
this.positivePattern = positivePattern;
|
||||
this.negativePattern = negativePattern;
|
||||
this.symbol = symbol;
|
||||
|
||||
this.maxFractionDigits = maxFractionDigits;
|
||||
// eslint-disable-next-line
|
||||
this.minFractionDigits = maxFractionDigits < minFractionDigits ? maxFractionDigits : minFractionDigits;
|
||||
|
||||
this.groupingUsed = groupingUsed;
|
||||
this.primaryGroupSize = primaryGroupSize;
|
||||
this.secondaryGroupSize = secondaryGroupSize;
|
||||
|
||||
if (!this.positivePattern || typeof this.positivePattern !== 'string') {
|
||||
throw new LocalizationException('Invalid positivePattern');
|
||||
}
|
||||
|
||||
if (!this.negativePattern || typeof this.negativePattern !== 'string') {
|
||||
throw new LocalizationException('Invalid negativePattern');
|
||||
}
|
||||
|
||||
if (!this.symbol || !(this.symbol instanceof NumberSymbol)) {
|
||||
throw new LocalizationException('Invalid symbol');
|
||||
}
|
||||
|
||||
if (typeof this.maxFractionDigits !== 'number') {
|
||||
throw new LocalizationException('Invalid maxFractionDigits');
|
||||
}
|
||||
|
||||
if (typeof this.minFractionDigits !== 'number') {
|
||||
throw new LocalizationException('Invalid minFractionDigits');
|
||||
}
|
||||
|
||||
if (typeof this.groupingUsed !== 'boolean') {
|
||||
throw new LocalizationException('Invalid groupingUsed');
|
||||
}
|
||||
|
||||
if (typeof this.primaryGroupSize !== 'number') {
|
||||
throw new LocalizationException('Invalid primaryGroupSize');
|
||||
}
|
||||
|
||||
if (typeof this.secondaryGroupSize !== 'number') {
|
||||
throw new LocalizationException('Invalid secondaryGroupSize');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get symbol.
|
||||
*
|
||||
* @return NumberSymbol
|
||||
*/
|
||||
getSymbol() {
|
||||
return this.symbol;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the formatting rules for this number (when positive).
|
||||
*
|
||||
* This pattern uses the Unicode CLDR number pattern syntax
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
getPositivePattern() {
|
||||
return this.positivePattern;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the formatting rules for this number (when negative).
|
||||
*
|
||||
* This pattern uses the Unicode CLDR number pattern syntax
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
getNegativePattern() {
|
||||
return this.negativePattern;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the maximum number of digits after decimal separator (rounding if needed).
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
getMaxFractionDigits() {
|
||||
return this.maxFractionDigits;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the minimum number of digits after decimal separator (fill with "0" if needed).
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
getMinFractionDigits() {
|
||||
return this.minFractionDigits;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the "grouping" flag. This flag defines if digits
|
||||
* grouping should be used when formatting this number.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
isGroupingUsed() {
|
||||
return this.groupingUsed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the size of primary digits group in the number.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
getPrimaryGroupSize() {
|
||||
return this.primaryGroupSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the size of secondary digits groups in the number.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
getSecondaryGroupSize() {
|
||||
return this.secondaryGroupSize;
|
||||
}
|
||||
}
|
||||
|
||||
export default NumberSpecification;
|
||||
108
modules/ps_facetedsearch/_dev/cldr/specifications/price.js
Normal file
108
modules/ps_facetedsearch/_dev/cldr/specifications/price.js
Normal file
@@ -0,0 +1,108 @@
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @author PrestaShop SA <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)
|
||||
*/
|
||||
import LocalizationException from '../exception/localization';
|
||||
import NumberSpecification from './number';
|
||||
|
||||
/**
|
||||
* Currency display option: symbol notation.
|
||||
*/
|
||||
const CURRENCY_DISPLAY_SYMBOL = 'symbol';
|
||||
|
||||
class PriceSpecification extends NumberSpecification {
|
||||
/**
|
||||
* Price specification constructor.
|
||||
*
|
||||
* @param string positivePattern CLDR formatting pattern for positive amounts
|
||||
* @param string negativePattern CLDR formatting pattern for negative amounts
|
||||
* @param NumberSymbol symbol Number symbol
|
||||
* @param int maxFractionDigits Maximum number of digits after decimal separator
|
||||
* @param int minFractionDigits Minimum number of digits after decimal separator
|
||||
* @param bool groupingUsed Is digits grouping used ?
|
||||
* @param int primaryGroupSize Size of primary digits group in the number
|
||||
* @param int secondaryGroupSize Size of secondary digits group in the number
|
||||
* @param string currencySymbol Currency symbol of this price (eg. : €)
|
||||
* @param currencyCode Currency code of this price (e.g.: EUR)
|
||||
*
|
||||
* @throws LocalizationException
|
||||
*/
|
||||
constructor(
|
||||
positivePattern,
|
||||
negativePattern,
|
||||
symbol,
|
||||
maxFractionDigits,
|
||||
minFractionDigits,
|
||||
groupingUsed,
|
||||
primaryGroupSize,
|
||||
secondaryGroupSize,
|
||||
currencySymbol,
|
||||
currencyCode,
|
||||
) {
|
||||
super(
|
||||
positivePattern,
|
||||
negativePattern,
|
||||
symbol,
|
||||
maxFractionDigits,
|
||||
minFractionDigits,
|
||||
groupingUsed,
|
||||
primaryGroupSize,
|
||||
secondaryGroupSize,
|
||||
);
|
||||
this.currencySymbol = currencySymbol;
|
||||
this.currencyCode = currencyCode;
|
||||
|
||||
if (!this.currencySymbol || typeof this.currencySymbol !== 'string') {
|
||||
throw new LocalizationException('Invalid currencySymbol');
|
||||
}
|
||||
|
||||
if (!this.currencyCode || typeof this.currencyCode !== 'string') {
|
||||
throw new LocalizationException('Invalid currencyCode');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get type of display for currency symbol.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
static getCurrencyDisplay() {
|
||||
return CURRENCY_DISPLAY_SYMBOL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the currency symbol
|
||||
* e.g.: €.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
getCurrencySymbol() {
|
||||
return this.currencySymbol;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the currency ISO code
|
||||
* e.g.: EUR.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
getCurrencyCode() {
|
||||
return this.currencyCode;
|
||||
}
|
||||
}
|
||||
|
||||
export default PriceSpecification;
|
||||
33
modules/ps_facetedsearch/_dev/front/events.js
Normal file
33
modules/ps_facetedsearch/_dev/front/events.js
Normal file
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @author PrestaShop SA <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)
|
||||
*/
|
||||
import refreshSliders from './slider';
|
||||
import {showOverlay, hideOverlay} from './overlay';
|
||||
|
||||
$(document).ready(() => {
|
||||
prestashop.on('updateProductList', () => {
|
||||
hideOverlay();
|
||||
refreshSliders();
|
||||
});
|
||||
|
||||
refreshSliders();
|
||||
|
||||
prestashop.on('updateFacets', () => {
|
||||
showOverlay();
|
||||
});
|
||||
});
|
||||
48
modules/ps_facetedsearch/_dev/front/facet.css
Normal file
48
modules/ps_facetedsearch/_dev/front/facet.css
Normal file
@@ -0,0 +1,48 @@
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @author PrestaShop SA <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)
|
||||
*/
|
||||
#search_filters .facet .title {
|
||||
display: flex;
|
||||
}
|
||||
#search_filters .facet .title .collapse-icons {
|
||||
margin-left: auto;
|
||||
}
|
||||
#search_filters .facet .facet-title {
|
||||
width: calc(100% - 30px);
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
#search_filters .facet .facet-label {
|
||||
width: 100%;
|
||||
text-align: left;
|
||||
}
|
||||
#search_filters .facet .facet-label .custom-checkbox,
|
||||
#search_filters .facet .facet-label .custom-radio {
|
||||
top: -7px;
|
||||
margin-right: 0;
|
||||
}
|
||||
#search_filters .facet .facet-label .color {
|
||||
margin-left: 0;
|
||||
}
|
||||
#search_filters .facet .facet-label a {
|
||||
width: calc(100% - 30px);
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}/*# sourceMappingURL=facet.css.map */
|
||||
1
modules/ps_facetedsearch/_dev/front/facet.css.map
Normal file
1
modules/ps_facetedsearch/_dev/front/facet.css.map
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["facet.scss","facet.css"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;EAAA;AA2BI;EACE,aAAA;ACRN;ADSM;EACE,iBAAA;ACPR;ADWI;EAfF,wBAAA;EACA,gBAAA;EACA,uBAAA;EACA,mBAAA;ACOF;ADSI;EACE,WAAA;EACA,gBAAA;ACPN;ADQM;;EAEE,SAAA;EACA,eAAA;ACNR;ADQM;EACE,cAAA;ACNR;ADSM;EA/BJ,wBAAA;EACA,gBAAA;EACA,uBAAA;EACA,mBAAA;ACyBF","file":"facet.css"}
|
||||
56
modules/ps_facetedsearch/_dev/front/facet.scss
Normal file
56
modules/ps_facetedsearch/_dev/front/facet.scss
Normal file
@@ -0,0 +1,56 @@
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @author PrestaShop SA <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)
|
||||
*/
|
||||
@mixin text-ellipsis() {
|
||||
width: calc(100% - 30px);
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
#search_filters {
|
||||
.facet {
|
||||
.title {
|
||||
display: flex;
|
||||
.collapse-icons {
|
||||
margin-left: auto;
|
||||
}
|
||||
}
|
||||
|
||||
.facet-title {
|
||||
@include text-ellipsis();
|
||||
}
|
||||
|
||||
.facet-label {
|
||||
width: 100%;
|
||||
text-align: left;
|
||||
.custom-checkbox,
|
||||
.custom-radio {
|
||||
top: -7px;
|
||||
margin-right: 0;
|
||||
}
|
||||
.color {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
a {
|
||||
@include text-ellipsis();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
22
modules/ps_facetedsearch/_dev/front/index.js
Normal file
22
modules/ps_facetedsearch/_dev/front/index.js
Normal file
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @author PrestaShop SA <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)
|
||||
*/
|
||||
import 'jquery-ui-touch-punch';
|
||||
import './events';
|
||||
import './slider.scss';
|
||||
import './facet.scss';
|
||||
57
modules/ps_facetedsearch/_dev/front/overlay.css
Normal file
57
modules/ps_facetedsearch/_dev/front/overlay.css
Normal file
@@ -0,0 +1,57 @@
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @author PrestaShop SA <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)
|
||||
*/
|
||||
.faceted-overlay {
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: fixed;
|
||||
background-color: rgba(25, 25, 25, 0.5);
|
||||
z-index: 100;
|
||||
}
|
||||
.faceted-overlay .overlay__inner {
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: absolute;
|
||||
}
|
||||
.faceted-overlay .overlay__content {
|
||||
left: 50%;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
.faceted-overlay .spinner {
|
||||
width: 75px;
|
||||
height: 75px;
|
||||
display: inline-block;
|
||||
border-width: 2px;
|
||||
border-color: rgba(255, 255, 255, 0.05);
|
||||
border-top-color: #fff;
|
||||
animation: spin 1s infinite linear;
|
||||
border-radius: 100%;
|
||||
border-style: solid;
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
100% {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}/*# sourceMappingURL=overlay.css.map */
|
||||
1
modules/ps_facetedsearch/_dev/front/overlay.css.map
Normal file
1
modules/ps_facetedsearch/_dev/front/overlay.css.map
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["overlay.scss","overlay.css"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;EAAA;AAkBA;EACE,OAAA;EACA,MAAA;EACA,WAAA;EACA,YAAA;EACA,eAAA;EACA,uCAAA;EACA,YAAA;ACCF;ADCE;EACE,OAAA;EACA,MAAA;EACA,WAAA;EACA,YAAA;EACA,kBAAA;ACCJ;ADEE;EACE,SAAA;EACA,kBAAA;EACA,QAAA;EACA,gCAAA;ACAJ;ADGE;EACE,WAAA;EACA,YAAA;EACA,qBAAA;EACA,iBAAA;EACA,uCAAA;EACA,sBAAA;EACA,kCAAA;EACA,mBAAA;EACA,mBAAA;ACDJ;;ADKA;EACE;IACE,yBAAA;ECFF;AACF","file":"overlay.css"}
|
||||
43
modules/ps_facetedsearch/_dev/front/overlay.js
Normal file
43
modules/ps_facetedsearch/_dev/front/overlay.js
Normal file
@@ -0,0 +1,43 @@
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @author PrestaShop SA <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)
|
||||
*/
|
||||
|
||||
import './overlay.scss';
|
||||
|
||||
const template = `<div class="faceted-overlay">
|
||||
<div class="overlay__inner">
|
||||
<div class="overlay__content"><span class="spinner"></span></div>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
function show() {
|
||||
if ($('.faceted-overlay').length === 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
$('body').append(template);
|
||||
}
|
||||
|
||||
function hide() {
|
||||
$('.faceted-overlay').remove();
|
||||
}
|
||||
|
||||
export {
|
||||
show as showOverlay,
|
||||
hide as hideOverlay,
|
||||
};
|
||||
60
modules/ps_facetedsearch/_dev/front/overlay.scss
Normal file
60
modules/ps_facetedsearch/_dev/front/overlay.scss
Normal file
@@ -0,0 +1,60 @@
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @author PrestaShop SA <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)
|
||||
*/
|
||||
.faceted-overlay {
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: fixed;
|
||||
background-color: rgba(25, 25, 25, 0.5);
|
||||
z-index: 100;
|
||||
|
||||
.overlay__inner {
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.overlay__content {
|
||||
left: 50%;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
|
||||
.spinner {
|
||||
width: 75px;
|
||||
height: 75px;
|
||||
display: inline-block;
|
||||
border-width: 2px;
|
||||
border-color: rgba(255, 255, 255, 0.05);
|
||||
border-top-color: #fff;
|
||||
animation: spin 1s infinite linear;
|
||||
border-radius: 100%;
|
||||
border-style: solid;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
100% {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
34
modules/ps_facetedsearch/_dev/front/slider.css
Normal file
34
modules/ps_facetedsearch/_dev/front/slider.css
Normal file
@@ -0,0 +1,34 @@
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @author PrestaShop SA <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)
|
||||
*/
|
||||
#search_filters .ui-slider-horizontal .ui-slider-handle {
|
||||
margin-left: -1px;
|
||||
cursor: pointer;
|
||||
}
|
||||
#search_filters .ui-widget-header {
|
||||
background: #555;
|
||||
}
|
||||
#search_filters .ui-slider .ui-slider-handle {
|
||||
top: -0.45em;
|
||||
width: 0.4em;
|
||||
background: #fff;
|
||||
border: 1px solid #555;
|
||||
}
|
||||
#search_filters .ui-slider-horizontal {
|
||||
height: 0.4em;
|
||||
}/*# sourceMappingURL=slider.css.map */
|
||||
1
modules/ps_facetedsearch/_dev/front/slider.css.map
Normal file
1
modules/ps_facetedsearch/_dev/front/slider.css.map
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["slider.scss","slider.css"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;EAAA;AAoBI;EACE,iBAAA;EACA,eAAA;ACDN;ADIE;EACE,gBAAA;ACFJ;ADKI;EACE,YAAA;EACA,YAAA;EACA,gBAAA;EACA,sBAAA;ACHN;ADME;EACE,aAAA;ACJJ","file":"slider.css"}
|
||||
129
modules/ps_facetedsearch/_dev/front/slider.js
Normal file
129
modules/ps_facetedsearch/_dev/front/slider.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.
|
||||
*
|
||||
* @author PrestaShop SA <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)
|
||||
*/
|
||||
|
||||
import getQueryParameters from './urlparser';
|
||||
import NumberFormatter from '../cldr/number-formatter';
|
||||
|
||||
const formatters = {};
|
||||
|
||||
const displayLabelBlock = (formatterId, displayBlock, min, max) => {
|
||||
if (formatters[formatterId] === undefined) {
|
||||
displayBlock.text(
|
||||
displayBlock.text().replace(
|
||||
/([^\d]*)(?:[\d\s.,]+)([^\d]+)(?:[\d\s.,]+)(.*)/,
|
||||
`$1${min}$2${max}$3`,
|
||||
),
|
||||
);
|
||||
} else {
|
||||
displayBlock.text(
|
||||
`${formatters[formatterId].format(min)} - ${formatters[formatterId].format(max)}`,
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Refresh facets sliders
|
||||
*/
|
||||
const refreshSliders = () => {
|
||||
$('.faceted-slider').each(function initializeSliders() {
|
||||
const $el = $(this);
|
||||
const values = $el.data('slider-values');
|
||||
const specifications = $el.data('slider-specifications');
|
||||
|
||||
if (specifications !== null && specifications !== undefined) {
|
||||
formatters[$el.data('slider-id')] = NumberFormatter.build(specifications);
|
||||
}
|
||||
|
||||
displayLabelBlock(
|
||||
$el.data('slider-id'),
|
||||
$(`#facet_label_${$el.data('slider-id')}`),
|
||||
values === null ? $el.data('slider-min') : values[0],
|
||||
values === null ? $el.data('slider-max') : values[1],
|
||||
);
|
||||
|
||||
$(`#slider-range_${$el.data('slider-id')}`).slider({
|
||||
range: true,
|
||||
min: $el.data('slider-min'),
|
||||
max: $el.data('slider-max'),
|
||||
values: [
|
||||
values === null ? $el.data('slider-min') : values[0],
|
||||
values === null ? $el.data('slider-max') : values[1],
|
||||
],
|
||||
stop(event, ui) {
|
||||
const nextEncodedFacetsURL = $el.data('slider-encoded-url');
|
||||
const urlsSplitted = nextEncodedFacetsURL.split('?');
|
||||
let queryParams = [];
|
||||
|
||||
// Retrieve parameters if exists
|
||||
if (urlsSplitted.length > 1) {
|
||||
queryParams = getQueryParameters(urlsSplitted[1]);
|
||||
}
|
||||
|
||||
let found = false;
|
||||
queryParams.forEach((query) => {
|
||||
if (query.name === 'q') {
|
||||
found = true;
|
||||
}
|
||||
});
|
||||
|
||||
if (!found) {
|
||||
queryParams.push({name: 'q', value: ''});
|
||||
}
|
||||
|
||||
// Update query parameter
|
||||
queryParams.forEach((query) => {
|
||||
if (query.name === 'q') {
|
||||
// eslint-disable-next-line
|
||||
query.value += [
|
||||
query.value.length > 0 ? '/' : '',
|
||||
$el.data('slider-label'),
|
||||
'-',
|
||||
$el.data('slider-unit'),
|
||||
'-',
|
||||
ui.values[0],
|
||||
'-',
|
||||
ui.values[1],
|
||||
].join('');
|
||||
}
|
||||
});
|
||||
|
||||
const requestUrl = [
|
||||
urlsSplitted[0],
|
||||
'?',
|
||||
$.param(queryParams),
|
||||
].join('');
|
||||
|
||||
prestashop.emit(
|
||||
'updateFacets',
|
||||
requestUrl,
|
||||
);
|
||||
},
|
||||
slide(event, ui) {
|
||||
displayLabelBlock(
|
||||
$el.data('slider-id'),
|
||||
$(`#facet_label_${$el.data('slider-id')}`),
|
||||
ui.values[0],
|
||||
ui.values[1],
|
||||
);
|
||||
},
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
export default refreshSliders;
|
||||
40
modules/ps_facetedsearch/_dev/front/slider.scss
Normal file
40
modules/ps_facetedsearch/_dev/front/slider.scss
Normal file
@@ -0,0 +1,40 @@
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @author PrestaShop SA <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)
|
||||
*/
|
||||
#search_filters {
|
||||
.ui-slider-horizontal {
|
||||
.ui-slider-handle {
|
||||
margin-left: -1px;
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
.ui-widget-header {
|
||||
background: #555;
|
||||
}
|
||||
.ui-slider {
|
||||
.ui-slider-handle {
|
||||
top: -.45em;
|
||||
width: 0.4em;
|
||||
background: #fff;
|
||||
border: 1px solid #555;
|
||||
}
|
||||
}
|
||||
.ui-slider-horizontal {
|
||||
height: .4em;
|
||||
}
|
||||
}
|
||||
29
modules/ps_facetedsearch/_dev/front/urlparser.js
Normal file
29
modules/ps_facetedsearch/_dev/front/urlparser.js
Normal file
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @author PrestaShop SA <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)
|
||||
*/
|
||||
|
||||
const getQueryParameters = (params) => params.split('&').map((str) => {
|
||||
const [key, val] = str.split('=');
|
||||
|
||||
return {
|
||||
name: key,
|
||||
value: decodeURIComponent(val).replace(/\+/g, ' '),
|
||||
};
|
||||
});
|
||||
|
||||
export default getQueryParameters;
|
||||
28
modules/ps_facetedsearch/_dev/index.php
Normal file
28
modules/ps_facetedsearch/_dev/index.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?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.
|
||||
*
|
||||
* @author PrestaShop SA <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