VirtueMart

WooCommerce

Others

Docs

Support

Demo

Blog

About

Forum
Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: [SOLVED] problem with decimals

problem with decimals 19 Sep 2016 15:28 #1

  • herr_schoen
  • herr_schoen's Avatar Topic Author
  • Offline
  • Posts: 2
Hi,
first of all I'd like to say that I really like this plugin. However, I have problem with decimals. I am running a shop with currency EURO only. And of course I use a "," (comma) to separate the cents from the Euro. But, when adding Cents they seem to be cut off. When I use a "." (dot) instead, the cents are shown in the price and also in the basket.
Is there a trick to change to commas?
Thanks and regards
Andreas

Please Log in or Create an account to join the conversation.

problem with decimals 25 Sep 2016 13:58 #2

Dear Andreas,
Unfortunately, that's a JavaScript issue. The interpretation of the number entered is done by JavaScript in the customer's browser, and JS by default uses the dot as a seperator. The plugin simply takes what JS handles it...

Best regards,
Reinhold

Please Log in or Create an account to join the conversation.

problem with decimals 06 Oct 2016 14:25 #3

  • herr_schoen
  • herr_schoen's Avatar Topic Author
  • Offline
  • Posts: 2
We have made a small modification in the template file to replace the ",". Seems to work:

//javascript to update price
	$script = '
/* <![CDATA[ */
var namethepricefunction = function(formProduct) {
	virtuemart_product_id = formProduct.find(\'input[name="virtuemart_product_id[]"]\').val();
	Virtuemart.setproducttype(formProduct,virtuemart_product_id);
};
var registernamethepricefunc = function($) {
	jQuery(".vmcustom-nametheprice").keyup(function() {
		formProduct = $(this).parents("form.product");
		$(this).val($(this).val().replace(",","."));     // This line has beed added.
		namethepricefunction(formProduct);
	});
};
jQuery("body").on("updateVirtueMartProductDetail", registernamethepricefunc);
jQuery(document).ready(registernamethepricefunc);
jQuery(document).ready(function() {
	jQuery(document).find("form.product").each(function() {
		namethepricefunction(jQuery(this));
	});
});
/* ]]> */
	';
$document = JFactory::getDocument()->addScriptDeclaration($script);
	

Please Log in or Create an account to join the conversation.

[SOLVED] problem with decimals 14 Oct 2016 18:27 #4

Problem solved.

Please Log in or Create an account to join the conversation.

  • Page:
  • 1

VM - Shopping cart

 x 

Cart empty

Login Formular