Jump to content
  • Checkout
  • Login
  • Get in touch


The e-commerce.

Warning: Invalid argument supplied for foreach()


Recommended Posts



New shop, published two weeks ago and then this little nightmare appears. (w00t) I don't know how long this problem has been there because the shop got first customers yesterday, and today I heard that there is some problems with payment. Some customers can't pay, they get this warning:


Warning: Invalid argument supplied for foreach() in /dir/catalog/includes/modules/payment/checkoutfi.php on line 219


I don't get this error. Neither the shop owner :mellow: My php skills are quite poor and I don't know how I managed this far without major problems. But if anyone would spend few minute with this I would be very happy! Any ideas are welcome!


checkoutfi.php code looks like this (finnish payment module with bank buttons, whole package here ->

http://checkout.fi/ohjelmistopaketit.html -> Ohjelmistopaketit ->Oscommerce):


// row 218 Create form for each payment method
 foreach($xml->payments->payment->banks as $bankX)
  foreach($bankX as $bank)
$process_button_string .= "\n<div class='Checkout_C1' style='float: left; margin-right: 20px; min-height: 100px;'>\n<form action='{$bank['url']}' method='post'>\n";
foreach($bank as $key => $value)
 $process_button_string .= "<input type='hidden' name='$key' value='$value' />\n";
$process_button_string .= "<span><input type='image' src='{$bank['icon']}' /></span><div>".iconv('utf-8','iso-8859-1',$bank['name'])."</div>\n</form>\n</div>\n\n";
[font="'lucida grande"][color="#ff0000"]  $process_button_string .= '<form onsubmit="return false;" class="CheckoutUniqClassName">';[/color][/font]
[font="'lucida grande"][color="#ff0000"]  return $process_button_string;
[font="'lucida grande"][color="#ff0000"]function haeSeparaattori()
 if (is_numeric("2.2"))
  return ".";
  return ",";
Link to comment
Share on other sites

I suspect you have not included the full error message.


Your code is saying $xml->payments->payment->banks should return an array of arrays of arrays so that $bankX becomes an array of arrays and hence $bank an array


assuming line 219 is foreach($xml->payments->payment->banks as $bankX)


$xml->payments->payment->banks is not returning array, so you need to look where that comes from



Remember, What you think I ment may not be what I thought I ment when I said it.




Auto Backup your Database, Easy way


Multi Images with Fancy Pop-ups, Easy way


Products in columns with multi buy etc etc


Disable any Category or Product, Easy way


Secure & Improve your account pages et al.

Link to comment
Share on other sites

Thank you for reply!

That's all I got, but yes, It's possible that this wasn't the whole error-message. I try to get more information about the error from people who has it. I also ask help from checkout.fi's customer service.

Link to comment
Share on other sites

Now I got some more info. This really is the whole error-message. It appears when customer chooses the payment method and clicks Continue. Any ideas where this might come from?

Link to comment
Share on other sites

Ok, now we have found the true problem, but no solution. Error shows if there is any ä or ö in customers details. MySql-problem? I have try to use utf-8 everywhere, but in checkout_confirmation.php has some problem still... In bank buttons there is also one Ä and thas has not been showing either. So I think the solution would fix it too.


Now any helping hands? :)

Link to comment
Share on other sites


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

  • Create New...