www.uburst.com www.uburst.com

"Formatting to two decimals"

Go back to the LobbyClick here to Go Back to Main ListingClick here to see helpClick here to Search the Forum

Programmer Tips
Forum Type: Public
Moderator: edmunds
Time Zone: EST
Printer Friendly Format
Original Message
 
"Formatting to two decimals"
Posted by David Futcher on Apr-07-03 at 00:19 AM (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 ushop-lib.pl file to include at least two decimal places?

Thanks,

David

Click to Send Alert Message to the Administrator Click to edit this messageClick to EMail Click here to reply to this messageClick here to reply to this message with quotesClick to goto the Table of Contents

 Table of Contents

RE: Formatting to two decimals, Bill Weiner, Apr-09-03, (1)

 

 
Click here to goto Click here to goto the Lobby
Messages in this discussion
 
1 . "RE: Formatting to two decimals"
Posted by Bill Weiner on Apr-09-03 at 05:44 AM (EST)
Try this:

STEP 1: Make a backup of your ushop-lib.pl script... just in case.

STEP 2: Open your ushop-lib.pl 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.)

Remove this Message: Administrator and Moderator onlyClick to Send Alert Message to the Administrator Click to edit this messageClick here to reply to this messageClick here to reply to this message with quotesClick to goto the Table of Contents


Archive This Thread: Admin and Moderator OnlyRemove This Thread: Admin and Moderator Only
Click here to goto Click here to goto the Lobby

 

 

 

 

 

 

 

 

 

 

 

 
Questions or problems regarding this bulletin board should be directed to Webmaster
©1997-1999 by DCScripts. All rights reserved.