Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2010
    Posts
    31
    Plugin Contributions
    0

    Default Sale Price: Round off to nearest 5 cents

    // Wrapper function for round()
    function zen_round($number, $precision) {
    /// fix rounding error on GVs etc.
    $number = round($number / 5, $precision) * 5;

    return $number;
    }

    I have done the above to /includes/functions/functions_general.php
    and it shows correctly in my website.

    However, the invoice at admin>order is showing without rounding off.

    I then add the above to the file myadmin/includes/functions/functions_general.php, the Price (inc) is showing with round off but Price (ex) is not.

    FYI I don't set tax for my products.

    Please advise.

  2. #2
    Join Date
    Mar 2008
    Posts
    49
    Plugin Contributions
    0

    Default Re: Sale Price: Round off to nearest 5 cents

    I managed to change these in the admin orders page by:

    admin/orders.php

    FIND

    $order->products[$i]['final_price'] X 4 within the products listing table

    and replace with

    (round($order->products[$i]['final_price'] / 5) * 5)


    In my case, I was looking to round to the nearest $5 increment so you can just change the calculation as needed.

    I dont think this is modifying what is in the database. It seems to work though.

  3. #3
    Join Date
    Jan 2010
    Posts
    31
    Plugin Contributions
    0

    Default Re: Sale Price: Round off to nearest 5 cents

    Quote Originally Posted by drbyday View Post
    I managed to change these in the admin orders page by:

    admin/orders.php

    FIND

    $order->products[$i]['final_price'] X 4 within the products listing table

    and replace with

    (round($order->products[$i]['final_price'] / 5) * 5)


    In my case, I was looking to round to the nearest $5 increment so you can just change the calculation as needed.

    I dont think this is modifying what is in the database. It seems to work though.
    I found many $order->products[$i]['final_price'] in the admin/order.php file. Do I need to replace all $order->products[$i]['final_price'] with (round($order->products[$i]['final_price'] / 5) * 5)
    ?

 

 

Similar Threads

  1. Europe : rounding tax to nearest .5 cents (eliminate pennies)
    By nan in forum Currencies & Sales Taxes, VAT, GST, etc.
    Replies: 15
    Last Post: 1 Sep 2017, 09:12 AM
  2. Round prices to nearest dollar.
    By bestbridalprices in forum General Questions
    Replies: 2
    Last Post: 7 Oct 2010, 04:12 PM
  3. Can I round prices to the nearest 5 cents?
    By xeontranq in forum General Questions
    Replies: 0
    Last Post: 3 May 2010, 04:47 AM
  4. ??? how to round taxes up or down to nearest 5 or 10 cent increment
    By nan in forum Currencies & Sales Taxes, VAT, GST, etc.
    Replies: 0
    Last Post: 14 Feb 2008, 03:00 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