Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Tax decimal place problems...any suggestions?


Sathington Willoby

Recommended Posts

Posted

I am having problems with the total dollar amount, including taxes, being sent over to the credit card module.

If a customer buys something for $19.99 and the 7% tax is added, the amount being sent to the credit card module is $21.3893. The amount that appears on the credit card screen is then $2138.93.

How can I get it so that the amount of decimal placed sent to the credit card module is only 2? I've tried everything I can think of and had no luck.

Any suggestions would be appreciated!!

Posted

admin -> configuration -> my store -> "Tax Decimal Places".

 

(second from the bottom)

Local: Mac OS X 10.5.8 - Apache 2.2/php 5.3.0/MySQL 5.4.10 • Web Servers: Linux

Tools: BBEdit, Coda, Versions (Subversion), Sequel Pro (db management)

Posted

I tried changing the tax decimal place in the admin section with many combinations, and still had no luck. The amount being sent to the credit card module still has the additional "hidden" decimal places included in the total.

  • 3 months later...
Posted

was this ever resolved? I have a similar situation. oscommerce has been ticking away just fine until I upgraded php to php4.3.7 the other day - now what is sent to the credit card processing has two additional decimals places making $6.98 $698.

 

Thanks,

 

Tim

Posted

Two in a row, our lucky night :P

 

In admin re-enter the period as the character to be used as the decimal figure.

Local: Mac OS X 10.5.8 - Apache 2.2/php 5.3.0/MySQL 5.4.10 • Web Servers: Linux

Tools: BBEdit, Coda, Versions (Subversion), Sequel Pro (db management)

Posted

That does not seem to work - I replaced the '.' character with '*' just to make sure it was reflected in the store and then changed it back to '.'

 

I ran another test transaction and the decimal place is still moved two placed to the right.

 

Again - this happened only AFTER I upgraded my php install to php 4.3.7 - no changes or edits were made to osCommerce.

Posted
That does not seem to work - I replaced the '.' character with '*' just to make sure it was reflected in the store and then changed it back to '.'

 

I ran another test transaction and the decimal place is still moved two placed to the right.

 

Again - this happened only AFTER I upgraded my php install to php 4.3.7 - no changes or edits were made to osCommerce.

I guess you'll have to dig into the code for the payment module.

 

What happens if you set the COD payment module? Does it should the correct amount?

Local: Mac OS X 10.5.8 - Apache 2.2/php 5.3.0/MySQL 5.4.10 • Web Servers: Linux

Tools: BBEdit, Coda, Versions (Subversion), Sequel Pro (db management)

Posted
I guess you'll have to dig into the code for the payment module.

 

What happens if you set the COD payment module? Does it should the correct amount?

 

Thanks for the quick replies. I tried as you suggest using COD and my invoice (email, etc.) shows the correct amount.

 

I found this " ▪ Fixed bug #28228 (number_format() does not allow empty decimal separator) " on PHP Changelog - so I'll try and find this function in the code, see if there is any connection.

 

FYI - I am using a PayflowPro contribution as my payment module.

 

Thanks,

 

Tim

Posted

To anyone interested -

 

I found the solution to my problem. The upgrade of PHP to version 4.3.7 results in a stricter implementation of the number_format() function that was being used in this contribution:

 

$Id: payflowpro.php,v 1.0 2002/05/10 01:22:51 hpdl Exp $ Payflowpro Contribution

 

See PHP Bug #28228 for a full explanation of the change to this function.

 

One only needs to change this block:

 

        $process_button_string .= tep_draw_hidden_field('AMT', number_format($order->info['total'], 2, '', '')).
                              tep_draw_hidden_field('FREIGHTAMT', number_format($order->info['shipping_cost'], 2, '', '')).
                              tep_draw_hidden_field('TAXAMT', number_format($order->info['tax'], 2, '', '')).

 

to this:

        $process_button_string .= tep_draw_hidden_field('AMT', number_format($order->info['total'], 2, '.', '')).
                              tep_draw_hidden_field('FREIGHTAMT', number_format($order->info['shipping_cost'], 2, '.', '')).
                              tep_draw_hidden_field('TAXAMT', number_format($order->info['tax'], 2, '.', '')).

 

Basically, just add a decimal point to the third attribute of the function, which was previously left blank.

 

Good luck.

 

Tim

Posted
To anyone interested -

 

I found the solution to my problem. The upgrade of PHP to version 4.3.7 results in a stricter implementation of the number_format() function that was being used in this contribution:

 

$Id: payflowpro.php,v 1.0 2002/05/10 01:22:51 hpdl Exp $ Payflowpro Contribution

 

See PHP Bug #28228 for a full explanation of the change to this function.

 

One only needs to change this block:

 

 ? ? ? ?$process_button_string .= tep_draw_hidden_field('AMT', number_format($order->info['total'], 2, '', '')).
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? tep_draw_hidden_field('FREIGHTAMT', number_format($order->info['shipping_cost'], 2, '', '')).
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? tep_draw_hidden_field('TAXAMT', number_format($order->info['tax'], 2, '', '')).

 

to this:

 ? ? ? ?$process_button_string .= tep_draw_hidden_field('AMT', number_format($order->info['total'], 2, '.', '')).
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? tep_draw_hidden_field('FREIGHTAMT', number_format($order->info['shipping_cost'], 2, '.', '')).
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? tep_draw_hidden_field('TAXAMT', number_format($order->info['tax'], 2, '.', '')).

 

Basically, just add a decimal point to the third attribute of the function, which was previously left blank.

 

Good luck.

 

Tim

just an fyi, you'll have to add a decimal place to the first and second line as well, if you're getting 8.00 turning into 800 in verisign payflow pro. (first line is for your price of product, second line for freight, third for tax.. most people use lines 1 and 3, but change it for all three to make sure)

 

this problem is for those of you who use the payflowpro.php (payflow pro fix modules) and have recently upgraded to php 4.3.7. For some odd reason their decimal place system is a bit askew, so we have to edit a few lines to make things work.

 

 

 

so in detail (BTW THANKS KESTRELE FOR THE EDIT BRO, WORKS AWESOME)

 

go into /catalog/includes/modules/payment/ .. edit payflowpro.php

 

go down to those lines, and change

 

 

 

     $process_button_string .= tep_draw_hidden_field('AMT', number_format($order->info['total'], 2, '', '')).
                             tep_draw_hidden_field('FREIGHTAMT', number_format($order->info['shipping_cost'], 2, '', '')).
                             tep_draw_hidden_field('TAXAMT', number_format($order->info['tax'], 2, '', '')).

to

 

      $process_button_string .= tep_draw_hidden_field('AMT', number_format($order->info['total'], 2, '.', '')).
                             tep_draw_hidden_field('FREIGHTAMT', number_format($order->info['shipping_cost'], 2, '.', '')).
                             tep_draw_hidden_field('TAXAMT', number_format($order->info['tax'], 2, '.', '')).

 

this will insure all your prices/taxes/freight costs are accurate to the right decimal, and not 100x off!

 

 

thanks again krestele for the fix, I just thought i'd add this because I had to do a bit of a modification for it to work for me. ;)

  • 2 weeks later...
Posted

FOR payflowlink.php

 

CHANGE THIS CODE

 

 

$process_button_string = tep_draw_hidden_field('LOGIN',MODULE_PAYMENT_PAYFLOWLINK_LOGIN).

tep_draw_hidden_field('PARTNER',MODULE_PAYMENT_PAYFLOWLINK_PARTNER).

tep_draw_hidden_field('TYPE',MODULE_PAYMENT_PAYFLOWLINK_TYPE) .

tep_draw_hidden_field('EXPDATE', $this->cc_expiry_month . $this->cc_expiry_year) .

tep_draw_hidden_field('AMOUNT', number_format($order->info['total'], 2, '', '')).

/********************************************************************************

*************

Shippen cost was hideen , there has been a error shown up. Concatinating the total and shipping.

********************************************************************************

*************/

tep_draw_hidden_field('SHIPAMOUNT', number_format($order->info['shipping_cost'], 2, '', '')).

tep_draw_hidden_field('TAX', number_format($order->info['tax'], 2, '', '')).

tep_draw_hidden_field('CARDNUM', $this->cc_card_number);

 

CHANGE THIS WAY

 

$process_button_string = tep_draw_hidden_field('LOGIN',MODULE_PAYMENT_PAYFLOWLINK_LOGIN).

tep_draw_hidden_field('PARTNER',MODULE_PAYMENT_PAYFLOWLINK_PARTNER).

tep_draw_hidden_field('TYPE',MODULE_PAYMENT_PAYFLOWLINK_TYPE) .

tep_draw_hidden_field('EXPDATE', $this->cc_expiry_month . $this->cc_expiry_year) .

tep_draw_hidden_field('AMOUNT', number_format($order->info['total'], 2, '.', '')).

/********************************************************************************

*************

Shippen cost was hideen , there has been a error shown up. Concatinating the total and shipping.

********************************************************************************

*************/

tep_draw_hidden_field('SHIPAMOUNT', number_format($order->info['shipping_cost'], 2, '.', '')).

tep_draw_hidden_field('TAX', number_format($order->info['tax'], 2, '.', '')).

tep_draw_hidden_field('CARDNUM', $this->cc_card_number);

  • 2 months later...
Posted

I had the same problem with PayFlow Pro. Adding the decimals got it working perfectly.

 

This fix should be posted to PayFlow Pro contribution area also.

 

Thanks for the fix!!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...