newest_oscer Posted March 26, 2003 Share Posted March 26, 2003 I am getting the following error during installation: Warning: Invalid argument supplied for foreach() in /home/mysite/www/html/includes/modules/main_categories.php on line 52 The block of code it is referring to reads: // Traverse category tree foreach ($foo as $key => $value) { if ($foo[$key]['parent'] == $cid) { // print "$key, $level, $cid, $cpath<br>"; preorder($key, $level+1, $foo, ($level != 0 ? $cpath . $cid . '_' : '')) ; } I am using version 2.2 snapshot dated 02-17-03 Any help in solving this problem? I know when I was installing, it referred to this code in default.php, which did not exist. <tr> <td class="main"><br><?php include(DIR_WS_LANGUAGES . $language . '/' . FILENAME_MAINPAGE); ?></td> </tr> I'm thinking this was made for a different version & it doesn't work on 2.2? Link to comment Share on other sites More sharing options...
newest_oscer Posted March 26, 2003 Author Share Posted March 26, 2003 Has anyone had this happen. I am still working on this & cannot figure it out? Does the Main Categories contribution work with the new 2.2 version of OSC?? Link to comment Share on other sites More sharing options...
newest_oscer Posted March 28, 2003 Author Share Posted March 28, 2003 Does anyone have this contribution working with the current version??? I need to know whether I should remove it or keep working on the problem. Thanks! Link to comment Share on other sites More sharing options...
64sp Posted March 31, 2003 Share Posted March 31, 2003 Hello The code you are looking for in default.php is this (approx. line 317) <tr> <td class="main"><br><?php echo TEXT_MAIN; ?></td> </tr> This is assuming you want to insert the contribution after your starting "main" text on the default page and before the New Products for March... info box. The other things you should do regarding this install (just to bring the coding in line with osc standards) are: in application_top.php when it says insert define('MAIN_CATEGORIES', 'main_categories.php'); This should really be: define('FILENAME_MAIN_CATEGORIES', 'main_categories.php'); and then you would alter the code <tr> <td><?php include(DIR_WS_MODULES . MAIN_CATEGORIES); ?></td> </tr> to be: <tr> <td><?php include(DIR_WS_MODULES . FILENAME_MAIN_CATEGORIES); ?></td> </tr> Hope this helps. *************************************** I've been contemplating thinking about thinking *************************************** Link to comment Share on other sites More sharing options...
newest_oscer Posted March 31, 2003 Author Share Posted March 31, 2003 Thanks for your help, but unfortunately the error is still there: Warning: Invalid argument supplied for foreach() in /home/mysite/includes/modules/main_categories.php on line 52 :( Link to comment Share on other sites More sharing options...
newest_oscer Posted March 31, 2003 Author Share Posted March 31, 2003 For anyone else having this problem, I've figured out the fix..... change this code in main_categories.php: // Traverse category tree foreach ($foo as $key => $value) { if ($foo[$key]['parent'] == $cid) { // print "$key, $level, $cid, $cpath<br>"; preorder($key, $level+1, $foo, ($level != 0 ? $cpath . $cid . '_' : '')) ; } To this: function tep_show_category($counter) { global $foo, $categories_string, $id; for ($a=0; $a<$foo[$counter]['level']; $a++) { $categories_string .= " "; } } } Link to comment Share on other sites More sharing options...
Yiorgis Posted April 24, 2003 Share Posted April 24, 2003 After trying the code above, I get a new error: Fatal error: Cannot redeclare tep_show_category() (previously declared in /home/specialw/public_html/catalog/includes/boxes/categories.php:13) in /home/specialw/public_html/catalog/includes/modules/main_categories.php on line 51 If I refreash the page it goes away... Any thoughts as to may be wrong? Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.