I have OpenCart 1.4.9.2 installed. I am using currency US Dollars.
Simple question I am sure, but currently in the Admin when I look at a Product the Product Price is display with 4 places after the decimal places. This only happens in the Admin. The catalog displays correctly and only displays 2 places after the decimal for the Product Price.
Example: If the Product Price is $1,500 then the price in the Admin would display as 1500.0000
How do I change the Product Price to only display with only 2 places after the decimal? Ex. 1500.00
Simple question I am sure, but currently in the Admin when I look at a Product the Product Price is display with 4 places after the decimal places. This only happens in the Admin. The catalog displays correctly and only displays 2 places after the decimal for the Product Price.
Example: If the Product Price is $1,500 then the price in the Admin would display as 1500.0000
How do I change the Product Price to only display with only 2 places after the decimal? Ex. 1500.00
Try this -
Backup admin/view/template/catalog/product_form.tpl
change the line:
to
That will change the display to 2 decimals though it is still stored as 4 decimals
I think I did it by changing the database to 2 decimals or maybe I changed it in the controller file. Changing it in the .tpl is safer and easier if you are unfamilar with coding.
Backup admin/view/template/catalog/product_form.tpl
change the line:
Code: Select all
<td><input type="text" name="price" value="<?php echo $price; ?>" /></td>
Code: Select all
<td><input type="text" name="price" value="<?php echo number_format($price,2); ?>" /></td>
I think I did it by changing the database to 2 decimals or maybe I changed it in the controller file. Changing it in the .tpl is safer and easier if you are unfamilar with coding.
I did the database update with ease, here is how:
1. login to your mysqladmin
2. backup database table
3. go to your table and select STRUCTURE
4. click change on the price column
5. under length values enter: 15,2
I had problems with the totals, when paying with paypal, and this change fix my problems, this probably will fix yours.
1. login to your mysqladmin
2. backup database table
3. go to your table and select STRUCTURE
4. click change on the price column
5. under length values enter: 15,2
I had problems with the totals, when paying with paypal, and this change fix my problems, this probably will fix yours.
No Needs to Change in controller or anything Else Just go db and change in price structure as decimal(15,4) as decimal (15,2) in database .......
Hi
I'm trying to achieve the same thing. In my opencart admin it has prices like:
£4.9900
I want just £4.99
I want just 2 decimal places because I find it a little confusing with everything having 4 decimal places.
Thanks for any help guys!
I'm trying to achieve the same thing. In my opencart admin it has prices like:
£4.9900
I want just £4.99
I want just 2 decimal places because I find it a little confusing with everything having 4 decimal places.
I'm in the db but can't find the "price structure" section, does anyone know whats it called?No Needs to Change in controller or anything Else Just go db and change in price structure as decimal(15,4) as decimal (15,2) in database
Thanks for any help guys!

This question has been asked so many times in the past on the forum. The problem why the decimal doesn't show by specific ended point is because the prices in the admin products page does not show by currency settings.
The controller does need to be modified to accomplish your request since the prices are loaded from the database field and not as a converted field. The 15,4 demonstrates already that the decimal won't appear as a 2 ended decimal point.
In admin/controller/catalog/product.php file,
find:
replace with:
Then, find:
replace with:
Then, find:
replace with:
Then, find:
replace with:
Then, find:
replace with:
This should return the expected results. Also ensure to configurable your decimal values from your admin - > systems - > settings and from your admin - > systems - > localisation tree.
The controller does need to be modified to accomplish your request since the prices are loaded from the database field and not as a converted field. The 15,4 demonstrates already that the decimal won't appear as a 2 ended decimal point.
In admin/controller/catalog/product.php file,
find:
Code: Select all
$special = $product_special['price'];
Code: Select all
$special = $this->currency->format($product_special['price'], $this->config->get('config_currency');
Code: Select all
'price' => $result['price'],
Code: Select all
'price' => $this->currency->format($result['price'], $this->config->get('config_currency'),
Code: Select all
if (isset($this->request->post['price'])) {
$this->data['price'] = $this->request->post['price'];
} elseif (!empty($product_info)) {
$this->data['price'] = $product_info['price'];
} else {
$this->data['price'] = '';
}
Code: Select all
if (isset($this->request->post['price'])) {
$this->data['price'] = $this->currency->format($this->request->post['price'], $this->config->get('config_currency');
} elseif (!empty($product_info)) {
$this->data['price'] = $this->currency->format($product_info['price'], $this->config->get('config_currency');
} else {
$this->data['price'] = '';
}
Code: Select all
'price' => $product_option_value['price'],
Code: Select all
'price' => $this->currency->format($product_option_value['price'], $this->config->get('config_currency'),
Code: Select all
'price' => $result['price']
Code: Select all
'price' => $this->currency->format($result['price'], $this->config->get('config_currency'),
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
No problem.
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
change in the DB worked for me
--- please reply only with verified data, that is: no 'I think', 'maybe' etc. ---
Go to PHPMyAdmin Then Select Your Database: oc_db »Table: oc_product then select Structure then change price»Length/Values to the number you want.
Attachments
Decimal Point In Product Prices On Admin Side - try.jpg (378.03 KiB) Viewed 4668 times
=======
Regards
M.Taleb
=======
Who is online
Users browsing this forum: No registered users and 73 guests