News:

Looking for documentation? Take a look on our wiki

Main Menu

VM 3:Price could not be set over 1000000000

Started by rebelhn, May 01, 2016, 11:22:15 AM

Previous topic - Next topic

rebelhn

I'm using VM 3.0.14, Joomla version, 3.5.1 and my currency is Vietnamdong. When i put Cost price over 1 billion, ex 1230000000, after click Save all will be set 1000000000. How do i fix this problem?

rebelhn


Milbo

#2
Your numbers uses already 10 digits of 15 available. PHP works as far as I know only precisly with 16 digits.
We use ini_set('serialize_precision',16);

So you cannot have more digits than 16. The db decimal field is 15,5 => This means you can store a number with 15 digits all together. When you store 123456789, it stores 123456789.00000 and that works. But your number is 1234567891, But only 123456789 fits in the db, because 5 digits are reserved. So the db rounds it.

In your case you must change your install.sql and BEWARE you must do that for ANY update!!! Any time you update VM, you must open the installer and change the sql again. Adding a update proof config for this wouldnt be easy.
Search in your install.sql for any decimal(15,6) and change it to decimal(18,2). Then add a hidden config roundindig = 2

If there is still a problem, then I have to change the calculationh.php in line 484

foreach($this->productPrices as $k => &$price){
if(!is_array($price)){
$price = round($price,$this->_internalDigits-4);
}
}

This $this->_internalDigits-4 could make trouble in your case. Maybe you just set it to 2. $price = round($price,2);

If you are interested that I write a hidden config for this problem, so that updates dont need any further modification, consider to buy a gold membership http://extensions.virtuemart.net/support/virtuemart-supporter-membership-detail
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

rebelhn

Thank a lot for your help. I was changed database design in products_price table and it worked.