motorskillz Posted February 15, 2006 Posted February 15, 2006 My store is here: http://www.substitutemag.com/store/index.php If i click on my account or checkout i get this error Fatal error: Cannot redeclare tep_show_category() (previously declared in /var/www/html/substitutemag.com/store/includes/header.php:136) in /var/www/html/substitutemag.com/store/includes/boxes/categories.php on line 13 How can i fix this? Cant find anthing when i search for it,.. and yes i took out my server info when i search thanks
Guest Posted February 15, 2006 Posted February 15, 2006 search your files for tep_show_category Looks somehow is present in more than one file. Should only be present in catalog\includes\boxes\categories.php. Also the categories box should be included once only. So check the catalog\includes\column_left.php and catalog\includes\column_right.php for duplicates of the box file.
motorskillz Posted February 16, 2006 Author Posted February 16, 2006 I check my fiels and fould the tep_show_category line in too files categories.pho and header.php. But if i take it out of the header.. the catorgories dont show up on the site. Althought the error goes away haha. search your files for tep_show_category Looks somehow is present in more than one file. Should only be present in catalog\includes\boxes\categories.php. Also the categories box should be included once only. So check the catalog\includes\column_left.php and catalog\includes\column_right.php for duplicates of the box file.
Guest Posted February 16, 2006 Posted February 16, 2006 ok no problem there just move the tep_show_category into the catalog\includes\functions\general.php. Then remove the functions from both the other files. In other words they both will still use it but it will only be declared once.
motorskillz Posted February 16, 2006 Author Posted February 16, 2006 Can you please explain what you mean by remove it. Becuase when I orignally did the search in the files for tep_show_category is comes up 3 times on both pages. The code have an entire section commented labled "categories" that contain these tages along with other code. Do i remove the entore catgories section? Because thats what i did before. and the categories didnt show up at all anymore. tep_show_category seems to be part of other code: example here: <?php/* $Id: categories.php,v 1.25 2003/07/09 01:13:58 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright © 2003 osCommerce Released under the GNU General Public License */ function tep_show_category($counter) { global $tree, $categories_string, $cPath_array; for ($i=0; $i<$tree[$counter]['level']; $i++) { $categories_string .= " "; } $categories_string .= '<a href="'; if ($tree[$counter]['parent'] == 0) { $cPath_new = 'cPath=' . $counter; } else { $cPath_new = 'cPath=' . $tree[$counter]['path']; } $categories_string .= tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">'; if (isset($cPath_array) && in_array($counter, $cPath_array)) { $categories_string .= '<b>'; } // display category name $categories_string .= $tree[$counter]['name']; if (isset($cPath_array) && in_array($counter, $cPath_array)) { $categories_string .= '</b>'; } if (tep_has_category_subcategories($counter)) { $categories_string .= '->'; } $categories_string .= '</a>'; if (SHOW_COUNTS == 'true') { $products_in_category = tep_count_products_in_category($counter); if ($products_in_category > 0) { $categories_string .= ' (' . $products_in_category . ')'; } } $categories_string .= '<br>'; if ($tree[$counter]['next_id'] != false) { tep_show_category($tree[$counter]['next_id']); } } ?> <!-- categories //--> ok no problem there just move the tep_show_category into the catalog\includes\functions\general.php. Then remove the functions from both the other files. In other words they both will still use it but it will only be declared once.
Guest Posted February 16, 2006 Posted February 16, 2006 Yes so you move this part of the code you posted into the general.php function tep_show_category($counter) { global $tree, $categories_string, $cPath_array; for ($i=0; $i<$tree[$counter]['level']; $i++) { $categories_string .= " "; } $categories_string .= '<a href="'; if ($tree[$counter]['parent'] == 0) { $cPath_new = 'cPath=' . $counter; } else { $cPath_new = 'cPath=' . $tree[$counter]['path']; } $categories_string .= tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">'; if (isset($cPath_array) && in_array($counter, $cPath_array)) { $categories_string .= '<b>'; } // display category name $categories_string .= $tree[$counter]['name']; if (isset($cPath_array) && in_array($counter, $cPath_array)) { $categories_string .= '</b>'; } if (tep_has_category_subcategories($counter)) { $categories_string .= '->'; } $categories_string .= '</a>'; if (SHOW_COUNTS == 'true') { $products_in_category = tep_count_products_in_category($counter); if ($products_in_category > 0) { $categories_string .= ' (' . $products_in_category . ')'; } } $categories_string .= '<br>'; if ($tree[$counter]['next_id'] != false) { tep_show_category($tree[$counter]['next_id']); } } Thats the function code and if it's replicated in the box and header it will cause the error. Now check the other files if they contain the function definition like this: function tep_show_category should be declared once. So by moving it into a common file like "general.php" every script can simply call it. Backup files first
Guest Posted April 5, 2006 Posted April 5, 2006 Thanks solved my problem. The only contribution I have installed is CCGV1.51a. caio :-)
Recommended Posts
Archived
This topic is now archived and is closed to further replies.