When you set the locale to other language that has the decimal separator as "," and ZC is going to update the table orders_products, the final_price field is truncated.
eg. Products Price US$1.00 when exchange to BRL, let's say R$1,80.
So when you change the locale into the language file to
PHP Code:
@setlocale(LC_ALL, 'pt_BR', 'pt_BR.iso-8859-1', 'pt_BR.utf-8', 'portuguese');
The price goes to 1,80 instead of 1.80
as a result, when the query is executed to insert the orders_products, the value is truncated to 1.00.
So I have to change the following:
At line 744 of includes/classes/order.php
changed
PHP Code:
'final_price' => $this->products[$i]['final_price'],
to
PHP Code:
'final_price' => str_replace(',', '.', $this->products[$i]['final_price']),
also, at line
734 of the same file, I have to change the line
PHP Code:
$db->Execute("update " . TABLE_PRODUCTS . " set products_ordered = products_ordered + " . sprintf('%f', $this->products[$i]['qty']) . " where products_id = '" . zen_get_prid($this->products[$i]['id']) . "'");
back to
PHP Code:
$db->Execute("update " . TABLE_PRODUCTS . " set products_ordered = products_ordered + " . sprintf('%d', $order->products[$i]['qty']) . " where products_id = '" . zen_get_prid($order->products[$i]['id']) . "'");
because if you leave as "%f" instead of "%d" when inserting the products into orders_products, the following error comes:
PHP Code:
1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '000000 where products_id = '1017'' at line 1
in:
[update zen_products set products_ordered = products_ordered + 1,000000 where products_id = '1017']
notice the 1,0000
hope that this makes sense.
Bookmarks