Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2008
    Posts
    21
    Plugin Contributions
    1

    bug Quantity and Final Price wrong with Portuguese Local

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

  2. #2
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    64,700
    Plugin Contributions
    6

    Default Re: Quantity and Final Price wrong with Portuguese Local

    What are your Currency settings for this?
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.1]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...

  3. #3
    Join Date
    Nov 2008
    Posts
    21
    Plugin Contributions
    1

    Default Re: Quantity and Final Price wrong with Portuguese Local

    here you go.
    Attached Images Attached Images  

 

 

Similar Threads

  1. Replies: 0
    Last Post: 3 Apr 2008, 08:16 PM
  2. which field shows final price?
    By doubletiger in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 26 Mar 2008, 06:15 PM
  3. final price is incorrect every time. Please help
    By redgirl in forum Setting Up Categories, Products, Attributes
    Replies: 3
    Last Post: 27 Oct 2007, 07:24 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •