Results 1 to 6 of 6
  1. #1
    Join Date
    Jun 2011
    Posts
    3
    Plugin Contributions
    0

    Default 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

    Code:
    //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.

  2. #2
    Join Date
    Jan 2004
    Location
    N of San Antonio TX
    Posts
    9,103
    Plugin Contributions
    11

    Default 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.

  3. #3
    Join Date
    Jun 2011
    Posts
    3
    Plugin Contributions
    0

    Default 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.

  4. #4
    Join Date
    Jan 2004
    Location
    N of San Antonio TX
    Posts
    9,103
    Plugin Contributions
    11

    Default 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.

  5. #5
    Join Date
    Jun 2011
    Posts
    3
    Plugin Contributions
    0

    Default 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

    Thanks for the advice.

    I'll be back with a fresh install.

    Cheers

  6. #6
    Join Date
    Jan 2004
    Location
    N of San Antonio TX
    Posts
    9,103
    Plugin Contributions
    11

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

    Best of Luck

    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.

 

 

Similar Threads

  1. v151 Invalid argument supplied for foreach()
    By DML73 in forum General Questions
    Replies: 3
    Last Post: 31 Dec 2013, 04:47 AM
  2. Replies: 1
    Last Post: 3 Jul 2013, 04:00 AM
  3. Replies: 7
    Last Post: 4 Jan 2013, 09:21 PM
  4. v139g Invalid argument supplied for foreach()
    By rstar23 in forum General Questions
    Replies: 3
    Last Post: 16 Apr 2012, 05:48 AM
  5. Debug: USPS.php PHP Warning: Invalid argument supplied for foreach()
    By divinelighting in forum Addon Shipping Modules
    Replies: 2
    Last Post: 11 Jun 2011, 03:17 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR