// Blocklayered : Adaptation for the 1.4
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@15325 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -187,15 +187,14 @@ function initSliders()
|
||||
|
||||
var from = '';
|
||||
var to = '';
|
||||
console.log(slider);
|
||||
switch (slider['format'])
|
||||
{
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
from = formatCurrency($('#layered_'+slider['type']+'_slider').slider('values', 0), slider['format'], slider['unit']);
|
||||
to = formatCurrency($('#layered_'+slider['type']+'_slider').slider('values', 1), slider['format'], slider['unit']);
|
||||
from = blocklayeredFormatCurrency($('#layered_'+slider['type']+'_slider').slider('values', 0), slider['format'], slider['unit']);
|
||||
to = blocklayeredFormatCurrency($('#layered_'+slider['type']+'_slider').slider('values', 1), slider['format'], slider['unit']);
|
||||
break;
|
||||
case 5:
|
||||
from = $('#layered_'+slider['type']+'_slider').slider('values', 0)+slider['unit']
|
||||
@@ -530,6 +529,8 @@ function updateProductUrl()
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Copy of the php function utf8_decode()
|
||||
*/
|
||||
@@ -558,4 +559,51 @@ function utf8_decode (utfstr) {
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return a formatted price
|
||||
* Copy from tools.js
|
||||
*/
|
||||
function blocklayeredFormatCurrency(price, currencyFormat, currencySign, currencyBlank)
|
||||
{
|
||||
// if you modified this function, don't forget to modify the PHP function displayPrice (in the Tools.php class)
|
||||
blank = '';
|
||||
price = parseFloat(price.toFixed(6));
|
||||
price = ps_round(price, priceDisplayPrecision);
|
||||
if (currencyBlank > 0)
|
||||
blank = ' ';
|
||||
if (currencyFormat == 1)
|
||||
return currencySign + blank + blocklayeredFormatNumber(price, priceDisplayPrecision, ',', '.');
|
||||
if (currencyFormat == 2)
|
||||
return (blocklayeredFormatNumber(price, priceDisplayPrecision, ' ', ',') + blank + currencySign);
|
||||
if (currencyFormat == 3)
|
||||
return (currencySign + blank + blocklayeredFormatNumber(price, priceDisplayPrecision, '.', ','));
|
||||
if (currencyFormat == 4)
|
||||
return (blocklayeredFormatNumber(price, priceDisplayPrecision, ',', '.') + blank + currencySign);
|
||||
return price;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return a formatted number
|
||||
* Copy from tools.js
|
||||
*/
|
||||
function blocklayeredFormatNumber(value, numberOfDecimal, thousenSeparator, virgule)
|
||||
{
|
||||
value = value.toFixed(numberOfDecimal);
|
||||
var val_string = value+'';
|
||||
var tmp = val_string.split('.');
|
||||
var abs_val_string = (tmp.length == 2) ? tmp[0] : val_string;
|
||||
var deci_string = ('0.' + (tmp.length == 2 ? tmp[1] : 0)).substr(2);
|
||||
var nb = abs_val_string.length;
|
||||
|
||||
for (var i = 1 ; i < 4; i++)
|
||||
if (value >= Math.pow(10, (3 * i)))
|
||||
abs_val_string = abs_val_string.substring(0, nb - (3 * i)) + thousenSeparator + abs_val_string.substring(nb - (3 * i));
|
||||
|
||||
if (parseInt(numberOfDecimal) == 0)
|
||||
return abs_val_string;
|
||||
return abs_val_string + virgule + (deci_string > 0 ? deci_string : '00');
|
||||
}
|
||||
@@ -167,8 +167,8 @@ param_product_url = '';
|
||||
{/literal}
|
||||
{if $filter.format < 5}
|
||||
{literal}
|
||||
from = formatCurrency(ui.values[0], {/literal}{$filter.format}{literal}, '{/literal}{$filter.unit}{literal}');
|
||||
to = formatCurrency(ui.values[1], {/literal}{$filter.format}{literal}, '{/literal}{$filter.unit}{literal}');
|
||||
from = blocklayeredFormatCurrency(ui.values[0], {/literal}{$filter.format}{literal}, '{/literal}{$filter.unit}{literal}');
|
||||
to = blocklayeredFormatCurrency(ui.values[1], {/literal}{$filter.format}{literal}, '{/literal}{$filter.unit}{literal}');
|
||||
{/literal}
|
||||
{else}
|
||||
{literal}
|
||||
|
||||
Reference in New Issue
Block a user