Results 1 to 9 of 9
  1. #1
    Join Date
    Jul 2007
    Posts
    51
    Plugin Contributions
    0

    Default Round Total to .50 during checkout

    Hi.

    I need to round the Total price to .50. I will simply double the number, round it and then divide it by 2. It will give me the value I need. But I don't know where to place the code. I assume to put it to ot_total module, but I have no idea where and what. I am not very fluent in PHP and would like someone to write the line for me. I just need to modify the final total price so that instead of 1234.61 I'll get 1234.50.

    Thank you in advance for any help.

  2. #2
    Join Date
    Jun 2003
    Posts
    33,721
    Plugin Contributions
    0

    Default Re: Round Total to .50 during checkout

    Aren't your customers going to wonder what is going on with their total when it doesn't add up? ... not to mention the IRS
    Please do not PM for support issues: a private solution doesn't benefit the community.

    Be careful with unsolicited advice via email or PM - Make sure the person you are talking to is a reliable source.

  3. #3
    Join Date
    Jul 2007
    Posts
    51
    Plugin Contributions
    0

    Default Re: Round Total to .50 during checkout

    No because it's not an American shop, but Slovak. Here, we have to round up total prices to .50. The government (or whoever it was) cancelled smaller coins ( .10, .20) because they cost more to produce than was their real value. We still use prices as 4.90 but in the end, the total is rounded to .50. It's perfectly normal here.

  4. #4
    Join Date
    Jul 2007
    Posts
    77
    Plugin Contributions
    0

    Default Re: Round Total to .50 during checkout

    Weird. Do you want people to be able to see the unrounded total until they go to checkout, or should the total displayed always be rounded.

  5. #5
    Join Date
    Jul 2007
    Posts
    51
    Plugin Contributions
    0

    Default Re: Round Total to .50 during checkout

    Weird is a very relative adjective. I want it to be rounded in the last step, just before the last confirmation "click". As I said, it is completly normal in Slovak Republic to have the Total Price rounded to .50 whereever you use coins and banks. And since our customers can choose to pay in cash, they must have the possibility of paying in .50 "units", because there are no smaller coins to pay with.
    I am glad that people are interested in this thread, but asking why I need it is not going to solve my problem. Please don't take any offence, I just want to put this thread to the right direction.

  6. #6
    Join Date
    Jan 2004
    Posts
    66,450
    Plugin Contributions
    81

    Default Re: Round Total to .50 during checkout

    What tax rate do you apply to your products?
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    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.

  7. #7
    Join Date
    Jul 2007
    Posts
    51
    Plugin Contributions
    0

    Default Re: Round Total to .50 during checkout

    Quote Originally Posted by DrByte View Post
    What tax rate do you apply to your products?
    19% VAT.

  8. #8
    Join Date
    Jan 2004
    Posts
    66,450
    Plugin Contributions
    81

    Default Re: Round Total to .50 during checkout

    Quote Originally Posted by breadfan View Post
    I need to round the Total price to .50. I will simply double the number, round it and then divide it by 2. It will give me the value I need. But I don't know where to place the code. I assume to put it to ot_total module, but I have no idea where and what. ... I just need to modify the final total price so that instead of 1234.61 I'll get 1234.50.
    Quote Originally Posted by breadfan View Post
    I want it to be rounded in the last step, just before the last confirmation "click". As I said, it is completly normal in Slovak Republic to have the Total Price rounded to .50 whereever you use coins and banks. And since our customers can choose to pay in cash, they must have the possibility of paying in .50 "units", because there are no smaller coins to pay with.
    I have no idea what other implications this will have elsewhere in the system, and whether any other calculations will be adversely affected, but this seems to work on a very simple checkout with a single taxable product without coupons or sales or discounts applied:

    ot_total.php
    change this:
    Code:
        function process() {
          global $order, $currencies;
          $this->output[] = array('title' => $this->title . ':',
                                  'text' => $currencies->format($order->info['total'], true, $order->info['currency'], $order->info['currency_value']),
                                  'value' => $order->info['total']);
        }
    to this, by adding 2 new lines, as shown:
    Code:
        function process() {
          global $order, $currencies;
          $val = $order->info['total'];
          $order->info['total'] = (round($val * 2) / 2);
          $this->output[] = array('title' => $this->title . ':',
                                  'text' => $currencies->format($order->info['total'], true, $order->info['currency'], $order->info['currency_value']),
                                  'value' => $order->info['total']);
        }
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    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
    Jul 2007
    Posts
    51
    Plugin Contributions
    0

    Default Re: Round Total to .50 during checkout

    Wow, thank you very much DrByte. I am going to try it tomorrow and will let you know about the results. But I'll back up the files and database before doing any modifications.
    One more question: Do you think that the modified result will be also written to the database? I need it that way because the invoices are printed from admin interface.
    Thank you once again :)

 

 

Similar Threads

  1. v152 Incorrect Sub-total and Total amount during checkout_payment page
    By ZkullGraveAce in forum General Questions
    Replies: 4
    Last Post: 10 Jan 2014, 02:45 AM
  2. Checkout blank page during checkout - authorize.net
    By gandalfsmith in forum General Questions
    Replies: 0
    Last Post: 6 Jan 2012, 09:05 PM
  3. Order total items flipped during checkout
    By tamalita in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 12 Aug 2011, 04:32 PM
  4. sub total and total on checkout
    By Ms_X in forum General Questions
    Replies: 0
    Last Post: 29 Oct 2010, 04:40 PM
  5. Replies: 2
    Last Post: 4 Oct 2009, 04:28 PM

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