Zen Cart Logo
Forums / General Questions / Warning: Invalid argument supplied for foreach

Warning: Invalid argument supplied for foreach

Locked

Views: 3,949

Results 1 to 10 of 10
This thread is locked. New replies are disabled.
12 Aug 2006, 5:40 PM
#1
harlyman avatar

harlyman

Zen Follower

Join Date:
Jan 2004
Posts:
100
Plugin Contributions:
1

Warning: Invalid argument supplied for foreach

hi

i got this problem after a new install today, this error shows up when a user log in at there user account to edit details, any ideas??

Warning: Invalid argument supplied for foreach() in /home/1/s/user/includes/templates/user/templates/tpl_account_default.php on line 37

12 Aug 2006, 6:06 PM
#2
superprg avatar

superprg

Totally Zenned

Join Date:
Feb 2006
Location:
Chicago
Posts:
1,349
Plugin Contributions:
0

Re: Warning: Invalid argument supplied for foreach

harlyman:

hi

i got this problem after a new install today, this error shows up when a user log in at there user account to edit details, any ideas??

Warning: Invalid argument supplied for foreach() in /home/1/s/user/includes/templates/user/templates/tpl_account_default.php on line 37

What do you have at line 37?

<?php foreach($ordersArray as $orders) { ?>

??
Also. is it customised template?

12 Aug 2006, 6:42 PM
#3
harlyman avatar

harlyman

Zen Follower

Join Date:
Jan 2004
Posts:
100
Plugin Contributions:
1

Re: Warning: Invalid argument supplied for foreach

superprg:

What do you have at line 37?

<?php foreach($ordersArray as $orders) { ?>

??
Also. is it customised template?

i have at line 37

<?php foreach($ordersArray as $orders) { ?>

and yes i have customised my template but only stylesheets, have not changed anything in the code..

13 Aug 2006, 3:19 AM
#4
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Warning: Invalid argument supplied for foreach

You are using an old version. A bug related to that was fixed in a more recent release.

As of today, the latest is v1.3.0.2

13 Aug 2006, 9:37 AM
#5
harlyman avatar

harlyman

Zen Follower

Join Date:
Jan 2004
Posts:
100
Plugin Contributions:
1

Re: Warning: Invalid argument supplied for foreach

DrByte:

You are using an old version. A bug related to that was fixed in a more recent release.

As of today, the latest is v1.3.0.2

i do use v1.3.0.2, a fresh install from a fresh tar ball:)

13 Aug 2006, 9:49 AM
#6
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Warning: Invalid argument supplied for foreach

Then you've made an error when customizing the page
/includes/templates/user/templates/tpl_account_default.php

or maybe that file has come from a template you obtained from someone else?

If you switch back to classic, or delete that file, does the problem persist?

13 Aug 2006, 5:17 PM
#7
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Warning: Invalid argument supplied for foreach

harlyman:

i do use v1.3.0.2, a fresh install from a fresh tar ball:)

I am guessing when you said tar ball you were referring to that loosely as Zen Cart is in a Zip format ... :smile:

Otherwise, where did you get it as a tar ball? :blink:

13 Aug 2006, 5:46 PM
#8
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Warning: Invalid argument supplied for foreach

I'm gonna take that back.

While I can't reproduce what you're describing on a fresh v1.3.0.2 install here, there is an error related to what you're describing, which has been fixed for the next release.

/includes/modules/pages/account/header_php.php
around line 48, you have:```php
$orders = $db->Execute($orders_query);

while (!orders->EOF) {


Between those two lines, add this:```php
$ordersArray=array();
19 Aug 2006, 9:57 PM
#9
milkyway avatar

milkyway

Inactive

Join Date:
Aug 2006
Location:
Singapore
Posts:
167
Plugin Contributions:
1

Re: Warning: Invalid argument supplied for foreach

I had the same problem, I applied the fix and it works.

The problem appeared when I made second test order to one of my dummy account (with group pricing on). Not sure the real culprit though.

Thanks Dr Byte.

23 Aug 2006, 10:39 AM
#10
tonyinabox avatar

tonyinabox

New Zenner

Join Date:
Jun 2006
Posts:
33
Plugin Contributions:
0

Re: Warning: Invalid argument supplied for foreach

got this problem also and apply that line and it works :smartass: