Page 1 of 2 12 LastLast
Results 1 to 10 of 18
  1. #1
    Join Date
    Mar 2010
    Location
    Finland
    Posts
    234
    Plugin Contributions
    0

    Default Correct price for a quantity of products

    Is there any way to make sure that e.g. 10 pcs of a products that "seems" to cost 1.25 (reality 1.2534) becomes 12.50 and NOT 12.53.
    By introducing zen_round() to the function zen_add_tax($price, $tax) I get the shopping cart ok, but subtotal and thereby total still hangs (erroneously) on to the decimals.... I use 1.3.9h

  2. #2
    Join Date
    Mar 2010
    Location
    Finland
    Posts
    234
    Plugin Contributions
    0

    Default Erroneous rounding of item price

    10 pcs of a products that "seems" to cost 1.25 (reality 1.2534) should become 12.50 and NOT 12.53.
    By introducing zen_round() to the function zen_add_tax($price, $tax) I get the shopping cart ok, but subtotal and thereby total still hangs (erroneously) on to the decimals.... I use 1.3.9h

  3. #3
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    66,825
    Plugin Contributions
    6

    Default Re: Erroneous rounding of item price

    How much are 3 suppose to be?

    How much are 5 suppose to be?

    How much are 7 suppose to be?
    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 ...

  4. #4
    Join Date
    Mar 2010
    Location
    Finland
    Posts
    234
    Plugin Contributions
    0

    Default Re: Erroneous rounding of item price

    I used zen_round() when testing - hopefully it's working correctly.... The point was that the "extra" digits should be rounded BEFORE multiplying with quantity! As a reply to the "wise man": as far as I know 1-4 goes down, 6-9 goes up and 5 goes to even.

  5. #5
    Join Date
    Mar 2010
    Location
    Finland
    Posts
    234
    Plugin Contributions
    0

    Default Re: Correct price for a quantity of products

    Anybody!?

  6. #6
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    66,825
    Plugin Contributions
    6

    Default Re: Correct price for a quantity of products

    You might try to directly answer the questions on post #3 ... it would help to know ...
    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 ...

  7. #7
    Join Date
    Mar 2010
    Location
    Finland
    Posts
    234
    Plugin Contributions
    0

    Default Re: Correct price for a quantity of products

    What did I not answer?
    as far as I know 1-4 goes down, 6-9 goes up and 5 goes to even
    0.1-0.4 => 0
    0.6-0.9 => 1
    0.5 => 0

  8. #8
    Join Date
    Jan 2004
    Posts
    59,773
    Blog Entries
    4
    Plugin Contributions
    133

    Default Re: Correct price for a quantity of products

    Ajeh was talking about quantities, not "how does rounding work".

    ie: if you have 3 items at 1.2534 or have 45 items at 1.2534, how exactly do you think the rounding should work then? There's a huge difference when you look at it that way.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donations always welcome: www.zen-cart.com/donate

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  9. #9
    Join Date
    Mar 2010
    Location
    Finland
    Posts
    234
    Plugin Contributions
    0

    Default Re: Correct price for a quantity of products

    There's NO DIFFERENCE: Quite simple, if the product price is shown as 1.25 (although adding tax has made it actually 1.2543) it's 1.25 - it doesn't matter how many products you buy, the unit price should be 1.25! (3pcs 3.75, 45pcs 56.25)

    The problem arises, as you well know, because it stores the price without taxes and then adds the tax "on the fly" if so requested. So if the price (with no tax) contains cents and the tax is a number (almost anything but a 100%) you get fractions of a cent - e.g. 1.11 * 1.13 (13% tax) = 1.2543 AND this is shown as a unit price of 1.25 when you look at the product (as it should)! BUT when you buy 10 pcs, the price is suddenly 12.54 - not much, but it makes the shop look "adequate" not good!

    And I managed to get it half right - as I said:
    By introducing zen_round() to the function zen_add_tax($price, $tax) I get the shopping cart ok, but subtotal and thereby total still hangs (erroneously) on to the decimals.
    PS. Nice that you "wise" guys stick together....

  10. #10
    Join Date
    Mar 2010
    Location
    Finland
    Posts
    234
    Plugin Contributions
    0

    Default Re: Correct price for a quantity of products

    PPS. THE POINT being that if the price is defined to have e.g. 2 decimals, that should determine the rounding - I mean that's why it's there, isn't it?

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. price not showing correct
    By joroco in forum Basic Configuration
    Replies: 2
    Last Post: 13 Feb 2010, 06:31 PM
  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. Correct price attribute not transfering to checkout
    By monmouthtaxis in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 6 Feb 2009, 11:58 AM
  4. Remove Price from Quantity 0 Products?
    By Lisk in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 21 Dec 2007, 04:54 PM
  5. Replies: 2
    Last Post: 1 Jul 2007, 05:23 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
  •