Forums / General Questions / Invalid argument supplied for foreach() in ...custom_config.php on line 33

Invalid argument supplied for foreach() in ...custom_config.php on line 33

Views: 1,055

Results 1 to 6 of 6
29 Jun 2011, 2:07 AM
#1
adaptable avatar

adaptable

New Zenner

Join Date:
Jun 2011
Posts:
3
Plugin Contributions:
0

Invalid argument supplied for foreach() in ...custom_config.php on line 33

Hi
I am using ZC V 1.3.7

I have inherited a zen cart installation and I have encountered a small issue. We sell computers and parts. The company was abandoned a while back but it is being resurrected.

a d a p t a b l e p c . c o m . a u

Above my list of products I have a menu entry "Custom PC Quote" which points to
http://www.mydomain.com.au/index.php?main_page=page_2

This is a page that allows clients to build a custom PC from our range of products.

When clicked it gives the error in the subject line of this post, 5 times.

Snippet of custom_config.php
Line 33 is the 3rd line

//Get products for each category
foreach($categories as $category){
	foreach($category['sub'] as $sub){
		$query = "SELECT * FROM ".DB_PREFIX."products JOIN ".DB_PREFIX."products_description ON ".DB_PREFIX."products.products_id = ".DB_PREFIX."products_description.products_id WHERE master_categories_id = ".$sub['id'];
		$result = mysql_query($query) or die('Query failed: ' . mysql_error());

		if(mysql_num_rows($result) > 0){
			while($row = mysql_fetch_array($result,MYSQL_ASSOC)){
				$products[$row['master_categories_id']][$row['products_id']]['id'] = $row['products_id'];
				$products[$row['master_categories_id']][$row['products_id']]['name'] = $row['products_name'];
				$products[$row['master_categories_id']][$row['products_id']]['price'] = $row['products_price']*1.1;
			}//while
		}//if
	}//foreach
}//foreach
?>

Below the error it loads up the drop downs of the various components. If a component is selected and Place Order is clicked, the same error appears.

Assistance in fixing this is appreciated.

29 Jun 2011, 2:19 AM
#2
dbltoe avatar

dbltoe

Totally Zenned

Join Date:
Jan 2004
Location:
N of San Antonio TX
Posts:
9,845
Plugin Contributions:
17

Re: Invalid argument supplied for foreach() in ...custom_config.php on line 33

Hate to be the bearer of bad news, but you have a cart that is WAAAY outdated. AND... It looks like you have some custom code that was done for the old site.

  1. Nothing you do to 1.3.7 will help as there are MANY security problems with it.
  2. You need to upgrade to 1.3.9h FIRST, then have someone look at the custom code.
    Unfortunately, 1.3.7 is no longer supported and, unless, you can find the original developer for the add-on, you may be SOL there as well.

Need a hand with Zen Cart? Hire the team at myZenCartZone.com for upgrades, repairs, and custom plugins.
Zen Cart Certified hosting at myZenCartHost.com

29 Jun 2011, 2:38 AM
#3
adaptable avatar

adaptable

New Zenner

Join Date:
Jun 2011
Posts:
3
Plugin Contributions:
0

Re: Invalid argument supplied for foreach() in ...custom_config.php on line 33

Thanks.

I knew it was out of date but not Waaaaaay out.

Is there an upgrade path from 1.3.7

It is good news really as I now know what I have to do.

29 Jun 2011, 2:48 AM
#4
dbltoe avatar

dbltoe

Totally Zenned

Join Date:
Jan 2004
Location:
N of San Antonio TX
Posts:
9,845
Plugin Contributions:
17

Re: Invalid argument supplied for foreach() in ...custom_config.php on line 33

Depending on the complexity and amount of product, you may want to just start fresh. And, if this bit of code is any indicator, you may have even more fun along the way.
Do read the tutorials for upgrade. You might be able to load a new install, create a custom template, and use the old database to save product and some settings. Keep in mind that the replacement for your cart was released four and one half years ago. I don't have to tell you what that equates to computer years to real years.

Need a hand with Zen Cart? Hire the team at myZenCartZone.com for upgrades, repairs, and custom plugins.
Zen Cart Certified hosting at myZenCartHost.com

29 Jun 2011, 2:57 AM
#5
adaptable avatar

adaptable

New Zenner

Join Date:
Jun 2011
Posts:
3
Plugin Contributions:
0

Re: Invalid argument supplied for foreach() in ...custom_config.php on line 33

OK

I am convinced. Fresh install it is.

The only products I left in there were some ink cartridges and monitors.

4 1/2 years means the same for computer parts :smile:

Thanks for the advice.

I'll be back with a fresh install.

Cheers

29 Jun 2011, 3:16 AM
#6
dbltoe avatar

dbltoe

Totally Zenned

Join Date:
Jan 2004
Location:
N of San Antonio TX
Posts:
9,845
Plugin Contributions:
17

Re: Invalid argument supplied for foreach() in ...custom_config.php on line 33

Best of Luck:bigups:

  1. DO NOT use an "autoinstaller" of any kind. Download the zip and install it according to the information in the docs folder.
  2. Read the tutorials about custom or override templates. Big help.
  3. Zen Cart will validate out of the box. And, it's VERY manageable if you know where the occasional prize is buried.
  4. Don't be afraid to rip off the shrink wrap from time to time on the docs folder.
  5. DO search and ask here if you run into a problem.

Need a hand with Zen Cart? Hire the team at myZenCartZone.com for upgrades, repairs, and custom plugins.
Zen Cart Certified hosting at myZenCartHost.com