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
    69,402
    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.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  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: 2
    Last Post: 31 Aug 2011, 09:38 AM
  2. Price by attributes - quantity discount and minimum quantity required
    By josefine in forum Setting Up Categories, Products, Attributes
    Replies: 14
    Last Post: 24 Sep 2009, 07:28 PM
  3. Replies: 0
    Last Post: 3 Apr 2008, 08:16 PM
  4. Some wrong with setlocal() on windows xp local server
    By wangsclub in forum Installing on a Windows Server
    Replies: 9
    Last Post: 20 Aug 2007, 02:30 PM
  5. Price and Shipping adding Up Wrong price
    By nWo in forum Built-in Shipping and Payment Modules
    Replies: 0
    Last Post: 12 Aug 2007, 04:07 PM

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
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR