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
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.
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.
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!

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'),
The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.
Regards,
Straightlight
Programmer / Opencart Tester
The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.
Regards,
Straightlight
Programmer / Opencart Tester
--- please reply only with verified data, that is: no 'I think', 'maybe' etc. ---
Attachments
Decimal Point In Product Prices On Admin Side - try.jpg (378.03 KiB) Viewed 2367 times
=======
Regards
M.Taleb
=======
Users browsing this forum: No registered users and 34 guests