Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Errors when trying to install Main Categories contribution


newest_oscer

Recommended Posts

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

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

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

  • 4 weeks later...

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...