Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Nochex gives Syntax Error


ppollock

Recommended Posts

HI,

 

I just switched on the Nochex payment module in but when I did a test purchase of ?1340.83, the nochex site gave the error:

 

Syntax error: 1,340.83 is not a valid number. Use the format xx.xx

 

It only seems to happen with values over ?999.99 so it must be the thousands separator.

 

I don't use a thousands separator on my site though.

 

Does anyone know what the problem could be?

 

Thanks

 

Peter

Link to comment
Share on other sites

Hi. This is my first post, so I hope I get this right!

 

(All the following is assuming the nochex APC contrib, latest version)

 

I had the same problem trying to get a "Declined" message to test that functionality... It seems to be the number format in the Nochex form submission, not the currency format in the Admin form.

 

In checkout_nochex.php, around line 242, you'll find:

 

 tep_draw_hidden_field('amount', number_format($order->info['total'] * $currencies->currencies['GBP']['value'], $currencies->currencies['GBP']['decimal_places']))

 

Replace that with

 

tep_draw_hidden_field('amount', number_format($order->info['total'] * $currencies->currencies['GBP']['value'], $currencies->currencies['GBP']['decimal_places'], '.', ''))

 

This changes the result of the PHP "number_format" function to use "." as the decimal and nothing as the thousands separator.

 

For others with the same issue on other payment systems, check the PHP doc at this page

 

As always, backup and test and don't blame me!

 

Best of luck,

 

Ian

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...