- Автор темы
- #1
Версия wordpress 4.7.3
Сайт локально
На сайте используются: Woocommerce, wc measurement price calculator, contact form, rev slider
Используется тема Betheme
Добрый вечер, уважаемые форумчане, подскажите пожалуйста как в плагине (wc measurement price calculator) изменить разделитель точку на запятую. Если пользователь забивает произвольное значение через запятую, то итоговая цена не отображается, а если через точку то все в порядке. Насколько вижу то за калькулцию отвечает wc-measurement-price-calculator.min.js В js не разираюсь, потому прошу Вашей помощи. Пробовала вместо woocommerce_price_decimal_sep,"." поставить woocommerce_price_decimal_sep,"," но не работает
Сайт локально
На сайте используются: Woocommerce, wc measurement price calculator, contact form, rev slider
Используется тема Betheme
Добрый вечер, уважаемые форумчане, подскажите пожалуйста как в плагине (wc measurement price calculator) изменить разделитель точку на запятую. Если пользователь забивает произвольное значение через запятую, то итоговая цена не отображается, а если через точку то все в порядке. Насколько вижу то за калькулцию отвечает wc-measurement-price-calculator.min.js В js не разираюсь, потому прошу Вашей помощи. Пробовала вместо woocommerce_price_decimal_sep,"." поставить woocommerce_price_decimal_sep,"," но не работает
Код:
jQuery(document).ready(function(a){function b(b){var c=null;return a.each(wc_price_calculator_params.pricing_rules,function(a,d){if(b>=parseFloat(d.range_start)&&(""===d.range_end||b<=d.range_end))return c=d,!1}),c}function c(a,b,c,d){a=(a+"").replace(/[^0-9+\-Ee.]/g,"");var e=isFinite(+a)?+a:0,f=isFinite(+b)?Math.abs(b):0,g="undefined"==typeof d?",":d,h="undefined"==typeof c?".":c,i="",j=function(a,b){var c=Math.pow(10,b);return""+Math.round(a*c)/c};return i=(f?j(e,f):""+Math.round(e)).split("."),i[0].length>3&&(i[0]=i[0].replace(/\B(?=(?:\d{3})+(?!\d))/g,g)),(i[1]||"").length<f&&(i[1]=i[1]||"",i[1]+=new Array(f-i[1].length+1).join("0")),i.join(h)}function d(a,b){return(a+"").replace(new RegExp("[.\\\\+*?\\[\\^\\]$(){}=!<>|:\\"+(b||"")+"-]","g"),"\\$&")}function e(a,b,c){return"undefined"!=typeof wc_price_calculator_params.unit_normalize_table[b]&&("undefined"!=typeof wc_price_calculator_params.unit_normalize_table[b].inverse&&wc_price_calculator_params.unit_normalize_table[b].inverse?a/=wc_price_calculator_params.unit_normalize_table[b].factor:a*=wc_price_calculator_params.unit_normalize_table[b].factor,b=wc_price_calculator_params.unit_normalize_table[b].unit),"undefined"!=typeof wc_price_calculator_params.unit_conversion_table[b]&&"undefined"!=typeof wc_price_calculator_params.unit_conversion_table[b][c]&&("undefined"!=typeof wc_price_calculator_params.unit_conversion_table[b][c].inverse&&wc_price_calculator_params.unit_conversion_table[b][c].inverse?a/=wc_price_calculator_params.unit_conversion_table[b][c].factor:a*=wc_price_calculator_params.unit_conversion_table[b][c].factor),a}function f(a){var b;return(b=a.match(/(\d+)\s+(\d+)\/(\d+)/))?0!==b[3]?parseFloat(b[1])+b[2]/b[3]:parseFloat(b[1]):(b=a.match(/(\d+)\/(\d+)/))?0!==b[2]?b[1]/b[2]:0:""===a?0:parseFloat(a)}function g(a){var b="",d=wc_price_calculator_params.woocommerce_price_num_decimals,e=wc_price_calculator_params.woocommerce_currency_pos,f=wc_price_calculator_params.woocommerce_currency_symbol;switch(a=c(a,d,wc_price_calculator_params.woocommerce_price_decimal_sep,wc_price_calculator_params.woocommerce_price_thousand_sep),"yes"===wc_price_calculator_params.woocommerce_price_trim_zeros&&d>0&&(a=h(a)),e){case"left":b='<span class="amount">'+f+a+"</span>";break;case"right":b='<span class="amount">'+a+f+"</span>";break;case"left_space":b='<span class="amount">'+f+" "+a+"</span>";break;case"right_space":b='<span class="amount">'+a+" "+f+"</span>"}return b}function h(a){return a.replace(new RegExp(d(wc_price_calculator_params.woocommerce_price_decimal_sep,"/")+"0+$"),"")}a(document).bind("reset_image",function(){wc_price_calculator_params.product_price="",wc_price_calculator_params.product_measurement_value="",wc_price_calculator_params.product_measurement_unit="",a(".variable_price_calculator").hide()}),"undefined"!=typeof wc_price_calculator_params&&"pricing"===wc_price_calculator_params.calculator_type&&(a("form.cart").bind("wc-measurement-price-calculator-update",function(){var c;if(a("input.amount_needed, select.amount_needed").each(function(b,c){c=a(c);var d=c.val().replace(wc_price_calculator_params.woocommerce_price_decimal_sep,"."),e=f(d);c.trigger("wc-measurement-price-calculator-product-measurement-change",[e])}),a("input.amount_needed, select.amount_needed").each(function(b,d){d=a(d);var g=d.val().replace(wc_price_calculator_params.woocommerce_price_decimal_sep,"."),h=f(g);if(!h||h<0)return c=0,!1;if(h=e(h,d.data("unit"),d.data("common-unit")),"area-linear"===wc_price_calculator_params.measurement_type)c?c+=2*h:c=2*h;else if("area-surface"===wc_price_calculator_params.measurement_type){if(!c){var i=a("#length_needed").val().replace(wc_price_calculator_params.woocommerce_price_decimal_sep,".");i=e(f(i),a("#length_needed").data("unit"),a("#length_needed").data("common-unit"));var j=a("#width_needed").val().replace(wc_price_calculator_params.woocommerce_price_decimal_sep,".");j=e(f(j),a("#width_needed").data("unit"),a("#width_needed").data("common-unit"));var k=a("#height_needed").val().replace(wc_price_calculator_params.woocommerce_price_decimal_sep,".");return k=e(f(k),a("#height_needed").data("unit"),a("#height_needed").data("common-unit")),void(c=2*(i*j+j*k+i*k))}}else c?c*=h:c=h}),c=e(c,wc_price_calculator_params.product_total_measurement_common_unit,wc_price_calculator_params.product_price_unit),c=parseFloat(c.toFixed(wc_price_calculator_params.measurement_precision)),wc_price_calculator_params.pricing_rules){var d=b(c);d?(wc_price_calculator_params.product_price=parseFloat(d.price),a(".single_variation span.price").html(d.price_html)):(wc_price_calculator_params.product_price="",a(".single_variation span.price").html(""))}a("#_measurement_needed").val(c),a("#_measurement_needed_unit").val(wc_price_calculator_params.product_price_unit);var h="";if(c?(h=wc_price_calculator_params.product_price*c,wc_price_calculator_params.minimum_price>h&&(h=parseFloat(wc_price_calculator_params.minimum_price)),a(".product_price").html(g(h)).trigger("wc-measurement-price-calculator-product-price-change",[c,h])):a(".product_price").html("").trigger("wc-measurement-price-calculator-product-price-change"),a(".wc-measurement-price-calculator-total-amount")){var i=e(c,wc_price_calculator_params.product_price_unit,a(".wc-measurement-price-calculator-total-amount").data("unit"));i=parseFloat(c.toFixed(wc_price_calculator_params.measurement_precision)),a(".wc-measurement-price-calculator-total-amount").text(i)}if("undefined"!=typeof woocommerce_addons_params&&a("form.cart").find("#product-addons-total").length>0){var j=""===h?0:h;woocommerce_addons_params.product_price=j.toFixed(2),a("form.cart").trigger("woocommerce-product-addons-update")}}),a("form.cart").trigger("wc-measurement-price-calculator-update"),a("input.amount_needed").keyup(function(){var b=a(this).closest("form.cart");b.trigger("wc-measurement-price-calculator-update")}),a("select.amount_needed").change(function(){var b=a(this).closest("form.cart");b.trigger("wc-measurement-price-calculator-update")}),a(".single_variation, .single_variation_wrap").bind("show_variation",function(b,c){var d=parseFloat(c.price);wc_price_calculator_params.product_price=d,a("form.cart").trigger("wc-measurement-price-calculator-show-variation",c),a("form.cart").trigger("wc-measurement-price-calculator-update"),a(".variable_price_calculator").show()}),a(document.body).bind("updated_addons",function(){var b=a("form.cart"),c=b.find("#product-addons-total"),d=c.data("price");d!==woocommerce_addons_params.product_price&&c.length>0&&(c.data("price",woocommerce_addons_params.product_price),b.trigger("woocommerce-product-addons-update"))})),"undefined"!=typeof wc_price_calculator_params&&"quantity"===wc_price_calculator_params.calculator_type&&(a("form.cart").bind("wc-measurement-price-calculator-quantity-changed",function(b,c){wc_price_calculator_params.product_measurement_value&&(a(".amount_needed, .amount_actual").each(function(b,d){if(d=a(d),d.hasClass("amount_needed")&&a(".amount_needed").length>1)return!0;var f=e(wc_price_calculator_params.product_measurement_value,wc_price_calculator_params.product_measurement_unit,d.data("unit"));f=parseFloat((f*c).toFixed(2)),d.is("input")?d.val(f):d.text(f)}),a(".total_price").html(g(c*wc_price_calculator_params.product_price)).trigger("wc-measurement-price-calculator-quantity-total-price-change",[c,wc_price_calculator_params.product_price]))}),a("form.cart").bind("wc-measurement-price-calculator-update",function(){if(wc_price_calculator_params.product_measurement_value){var b;if(a("input.amount_needed").each(function(c,d){d=a(d);var g=d.val().replace(wc_price_calculator_params.woocommerce_price_decimal_sep,"."),h=f(g);return!h||h<0?(b=0,!1):(h=e(h,d.data("unit"),d.data("common-unit")),void(b?b*=h:b=h))}),b){var c=e(wc_price_calculator_params.product_measurement_value,wc_price_calculator_params.product_measurement_unit,wc_price_calculator_params.product_total_measurement_common_unit),d=Math.ceil((b/c).toFixed(wc_price_calculator_params.measurement_precision));d<parseFloat(wc_price_calculator_params.quantity_range_min_value)&&(d=parseFloat(wc_price_calculator_params.quantity_range_min_value)),parseFloat(wc_price_calculator_params.quantity_range_max_value)&&d>parseFloat(wc_price_calculator_params.quantity_range_max_value)&&(d=parseFloat(wc_price_calculator_params.quantity_range_max_value)),a("input[name=quantity]").val(d),a(".amount_actual").each(function(b,c){c=a(c);var f=e(wc_price_calculator_params.product_measurement_value,wc_price_calculator_params.product_measurement_unit,c.data("unit"));f=parseFloat((f*d).toFixed(2)),c.is("input")?c.val(f):c.text(f)}),a(".total_price").html(g(d*wc_price_calculator_params.product_price)).trigger("wc-measurement-price-calculator-total-price-change",[d,wc_price_calculator_params.product_price])}}}),a("input.amount_needed").keyup(function(){var b=a(this).closest("form.cart");b.trigger("wc-measurement-price-calculator-update")}),a("input[name=quantity]").keyup(function(b){var c=a(this).closest("form.cart");c.trigger("wc-measurement-price-calculator-quantity-changed",[b.target.value])}),a("input[name=quantity]").bind("change",function(b){var c=a(this).closest("form.cart");c.trigger("wc-measurement-price-calculator-quantity-changed",[b.target.value])}).change(),a(".single_variation, .single_variation_wrap").bind("show_variation",function(b,c){wc_price_calculator_params.product_price=parseFloat(c.price),wc_price_calculator_params.product_measurement_value=parseFloat(c.product_measurement_value),wc_price_calculator_params.product_measurement_unit=c.product_measurement_unit,c.product_measurement_value?(a("input.amount_needed").length>0&&a("input.amount_needed").val()?a("form.cart").trigger("wc-measurement-price-calculator-update"):a("form.cart").trigger("wc-measurement-price-calculator-quantity-changed",[a("input[name=quantity]").val()]),a(".variable_price_calculator").show()):a(".variable_price_calculator").hide()}))});
Последнее редактирование: