Google/Amazon checkout issues if 100+ products in cart

Just noticed today that if I add 100 or more products to my cart I get the following error at the top of the page:

Warning: Invalid argument supplied for foreach() in /home/fastdeca/public_html/shop/payments/google_checkout.php on line 59<br />
<br />
Warning: Invalid argument supplied for foreach() in /home/fastdeca/public_html/shop/payments/amazon_checkout.php on line 82
```<br />
<br />
If I change the quantity to 99 everything works fine.  Suggestion to what is causing this...or a fix?

I should note that it is when I view cart. No issues before then. I should also note that 100 doesn't seem to be the magic number. I can get the error to occur with 5 items in the cart. Oddly, if I update to 6 items the error disappears. The error seems to randomly occur when viewing the cart.

Since Amazon wasn't really generating any sales, I removed it but I am still seeing the random error with Google. Sometimes it's there, sometimes it's not. I can have sometimes the error with 10 items in the cart and it appears. Then I can change the quantity to 8 it disappears. Then change it back to 10 and no errors. It seems totally random. I would like for it to work though as I know if I was on my site and seen some random code at the top of the page during checkout I would be cautious to continue.

And just for quick reference; here are lines 50-63 within the google_checkout.php:

$google_products = $cart_products;

fn_set_hook('google_products', $google_products, $cart);

if (!empty($google_products) && is_array($google_products)) {
foreach ($google_products as $k => $v) {
$item_options = '';
if (!empty($v['product_options'])) {
$_options = fn_get_selected_product_options_info($cart['products'][$k]['product_options']);
foreach ($_options as $opt) {
$item_options .= $opt['option_name'] . ': ' . $opt['variant_name'] . '; ';
$item_options = ' [' . trim($item_options, '; ') . ']';

Wish I could figure out what is causing this random issue. In Internet Explorer it can cause all kinds of layout issues when it happens. See image for how all kinds of things got screwed up:

I can simply change the quantity up or down, update the cart and the problem goes away. Change back to the exact same quantity that caused the issue and it still doesn’t happen. But I’m wondering how many customers I am losing everyday due to this.

For reference (from support):

[quote]In order to resolve this issue, please replace the following line of code:

foreach ($_options as $opt) {

with this one:

foreach(is_array($_options) || is_object($_options) ? $_options : array() as $opt){

in the following files:



Seems to be working so far.