uShop English (U.S.) for 179!

uStorekeeper English (U.S.) for 149!

 Tech Support
       Support Policy
       Knowledge Base
       Reference Sites
       Software Piracy
       Legal Notices
       Privacy Policy
       Reseller Info
       Contact Us
       Site Map
Formatting to two decimals

Knowledge Base Lobby : uShop Support Conference : Programmer Tips
Mar-23-18 02:14 PM EST
Original Message
Formatting to two decimals
Author David Futcher on 04-07-2003 at 00:19 (EST)
We're using the 'Receipt Page Footer HTML' feature for PayPal integration. Unfortunately, when the order total ends with a zero, the USHOP_TOTAL variable doesn't pass the trailing zero to the page, so PayPal is saying the amount sent isn't formatted correctly.

I've seen some formatting changes you've recommended for a similar issue on the credit card processing screen, but it doesn't seem to change what we're seeing on the receipt page. Can you let me know how to edit the file to include at least two decimal places?



Table Of Contents
  RE: Formatting to two decimals Bill Weiner, 2003-04-09 05:44:01 (1)

Messages In This Discussion
         1. RE: Formatting to two decimals
        Author Bill Weiner on 04-09-2003 at 05:44 (EST)
Try this:

STEP 1: Make a backup of your script... just in case.

STEP 2: Open your script with any text editor such as WordPad.

STEP 3: Do a search on the following line:

sub substitute_key_fields

(This is the start of the subroutine that handles that substitution.)

STEP 4: About 6 lines down in that subroutine, replace the following line:

$html_string =~ s/USHOP_TOTAL/$totals_total_with_shipping_tax/g;

With these two lines:

$temp_total = sprintf("%.2f",$totals_total_with_shipping_tax);
$html_string =~ s/USHOP_TOTAL/$temp_total/g;

STEP 5: Also, about 4 lines down from there, replace the following line:

$html_string =~ s/USHOP_TOTAL/$totals_total/g;

With these two lines:

$temp_total = sprintf("%.2f",$totals_total);
$html_string =~ s/USHOP_TOTAL/$temp_total/g;

STEP 6: Save the script... as TEXT if your editor asks... and try it out!

(NOTE: We also have a beta version of a more integrated PayPal interface that will be available in the next release of uShop. If you want to try out that beta interface now, then you can send us a support request - with your license number - and we can send you the beta version. Otherwise, look for a more integrated PayPal interface in the next release.)

© 2003 Microburst Technologies, Inc.