Page 1 of 1
replace point with comma for input price
Posted: Tue Nov 08, 2011 2:48 am
by skip
When i enter a price like : 2,55 the program change it to 2,00. when I use ","
I want to change input price decimal "." to ","
How to do it
My opencart is 1.4.9.3.
thanx
Re: product price decimal places
Posted: Sun Nov 13, 2011 12:41 am
by skip
In this locked post (
http://forum.opencart.com/viewtopic.php?t=839) member "lepotros" say:
In fact, i thought the problem was a SQL configuration in Decimal.
I changed, in SQL-Product-decimal the value of 15,4 for 15,2, that correspond to the configuration of Opencart, and it works.
But I dont know what he mean under "SQL-Product-decimal" ?
anybody understood ?
Re: product price decimal places
Posted: Sun Nov 13, 2011 1:44 am
by skip
Aha I know now
Go to phpmyadmin-> product table-> structure tab ->change the value to 15,2
But its not work now is admin price in this format 100.00 This number cut last 2 decimal places
(100.0000 to 100.00) but for input price I still must use "."
Re: replace point with comma for input price
Posted: Wed Nov 16, 2011 6:36 am
by skip
In file settings-library-currency change this
$decimal_point = '.'; to
$decimal_point = ',';
no result very strange hmm
Re: replace point with comma for input price
Posted: Wed Nov 16, 2011 8:29 am
by Qphoria
skip wrote:In file settings-library-currency change this
$decimal_point = '.'; to
$decimal_point = ',';
no result very strange hmm
There is no such setting in that file.
Decimal point is set in the language file
catalog/language/<yourlang>/yourlang.php
at the top.
Re: replace point with comma for input price
Posted: Thu Nov 17, 2011 3:33 am
by skip
I"ll try this first but without result
In admin/language/mylanguage/mylanguage.php I change
$_['decimal_point'] = ',';
but product price input is posible only with point !
If I use comma -> all number behind cooma is lost
input 200,45 -> produce 200.00
Re: replace point with comma for input price
Posted: Fri Nov 18, 2011 3:46 am
by 1047138246@qq.com
easy one, contact me on skype: ken_nz2
Re: replace point with comma for input price
Posted: Sat Nov 02, 2013 6:25 am
by mgolf1
I also have the same problem. Can anyone help me? Al those solutions doesn't work for price input fields.
Re: replace point with comma for input price
Posted: Mon Sep 26, 2016 10:26 pm
by laptoper
I have problem for price also. instead of . or , the string "thousand_point" and "decimal_point" is showing with the price.
Ex: 5,240.00
it is showing 5thousand_point240decimal_point00
I attached the screenshot for your reference.
Re: replace point with comma for input price
Posted: Tue Sep 27, 2016 2:05 am
by IP_CAM
There was an old VqMod, possibly basically explaining, where it shoud be done:
Code: Select all
<modification>
<id>Comma as decimal point when saving product</id>
<version>1.5.4</version>
<vqmver>2.2.1</vqmver>
<author>Istvan Dobrentei, http://www.dobrenteiistvan.hu</author>
<file name="admin/model/catalog/product.php">
<operation>
<search position="after"><![CDATA[function editProduct($product_id, $data) {]]></search>
<add><![CDATA[
$data['price'] = str_replace(",", ".", $data['price']);
]]></add>
</operation>
<operation>
<search position="after"><![CDATA[function addProduct($data) {]]></search>
<add><![CDATA[
$data['price'] = str_replace(",", ".", $data['price']);
]]></add>
</operation>
</file>
</modification>
Ernie
Re: replace point with comma for input price
Posted: Thu May 03, 2018 7:39 pm
by guidone
Hello,
the vQmod it works fine, it should be great if someone could add same mod for option price too.
Re: replace point with comma for input price
Posted: Fri May 04, 2018 3:26 am
by IP_CAM
for Version 1.5.4, really !?
Ernie
Re: replace point with comma for input price
Posted: Fri May 04, 2018 3:45 am
by guidone
I'm using on OC 2.2 and it works fine so I would like to have same mod for option price too
Re: replace point with comma for input price
Posted: Fri May 04, 2018 9:12 am
by IP_CAM
Well, this could possibly at least solve your problem on the front side,
and it comes for free, so, you can find out free of charge!
Good Luck
Ernie
---
Change default weight settings, separators, add weight units
0_decimals
- First, it will define the language setting of the user. For example from the English language 1,000.00 will become 1.000,00 in French.
- Second, will reduce the decimals to zero. It means that 30.00 will become 30.
1_decimal
- First, it will define the language setting of the user. For example from the English language 1,000.00 will become 1.000,00 in French.
- Second, will reduce the decimals to one. It means that 1,030.00 will become 1,030.0. For example in French 1,030.00 will become 1.030,0.
3_decimals
- First, it will define the language setting of the user. For example from the English language 1,000.00 will become 1.000,00 in French.
- Second, will set the decimals to 3. It means that 1030.00 will become 1,030.000. For example in French 1,030.00 will become 1.030,000. Nice when working in kilograms.
language_defined
- It will define the language setting of the user. For example from the English language 1,000.00 will become 1.000,00 in French. !!! NOTE !!! Only install this ocmod when the 0_decimals, 1_decimal or 3_decimals are NOT installed or used.
https://www.opencart.com/index.php?rout ... n_id=32974
---
Re: replace point with comma for input price
Posted: Sat May 26, 2018 6:12 pm
by victorj
It can not be changed.
Its how number are handeled in the database.
A comma is a data separator ie something in front of comma is a separate value something behind comma is a separate value.
15.0000 will be treated as a nummeric value with 4 decimals, 15,0000 will be treated as 2 separate pieces of data, 15 and 0000
This behavior is not limited to oc only, every e-commerce Application works like this.
Re: replace point with comma for input price
Posted: Sat May 26, 2018 6:27 pm
by guidone
Yes but this code
Code: Select all
<modification>
<id>Comma as decimal point when saving product</id>
<version>1.5.4</version>
<vqmver>2.2.1</vqmver>
<author>Istvan Dobrentei, http://www.dobrenteiistvan.hu</author>
<file name="admin/model/catalog/product.php">
<operation>
<search position="after"><![CDATA[function editProduct($product_id, $data) {]]></search>
<add><![CDATA[
$data['price'] = str_replace(",", ".", $data['price']);
]]></add>
</operation>
<operation>
<search position="after"><![CDATA[function addProduct($data) {]]></search>
<add><![CDATA[
$data['price'] = str_replace(",", ".", $data['price']);
]]></add>
</operation>
</file>
</modification>
allows to write comma but saves point in the db and i would like to have the same for price options