LioMandi Posted April 9, 2007 Posted April 9, 2007 I get this error : Fatal error: Cannot redeclare tep_show_category () (previously declared in ***/includes/categories.php: 13) in ***/includes/boxes/categories.php on LINE 64 Can someone please help me? Ive search the boards for days but had no luck in resolving this issue. My shop cannot function without this correction. Here's the code for categories.php: <?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 (c) 2003 osCommerce Released under the GNU General Public License */ function tep_show_category($counter) { global $tree, $categories_string, $cPath_array; $categories_string .= '<tr><td height="20" class="categor">'; $otstup = 0; for ($i=0; $i<$tree[$counter]['level']; $i++) { $categories_string .= tep_draw_separator('pixel_trans.gif', '10', '1'); $otstup = 1; } if ($otstup){ $categories_string .= tep_draw_separator('pixel_trans.gif', '10', '1') . '<a class="categor" href="'; } else { $categories_string .= tep_image(DIR_WS_IMAGES . 'marker100.jpg','','3','5','style="margin:0 8px 0 14px"') . '<a class="categor" 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 .= '</td></tr>'; $categories_string .= '<tr><td height="2" valign="top">' . tep_image(DIR_WS_IMAGES . 'LineCategot.jpg','','','','style="margin-left:10px"') . '</td></tr>'; if ($tree[$counter]['next_id'] != false) {tep_show_category($tree[$counter]['next_id']); } } ?> <!-- categories //--> <?php //$info_box_contents = array(); //$info_box_contents[] = array('text' => BOX_HEADING_CATEGORIES); //new infoBoxHeading($info_box_contents, true, false); $categories_string = ''; $tree = array(); $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '0' and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."' order by sort_order, cd.categories_name"); while ($categories = tep_db_fetch_array($categories_query)) { $tree[$categories['categories_id']] = array('name' => $categories['categories_name'], 'parent' => $categories['parent_id'], 'level' => 0, 'path' => $categories['categories_id'], 'next_id' => false); if (isset($parent_id)) { $tree[$parent_id]['next_id'] = $categories['categories_id']; } $parent_id = $categories['categories_id']; if (!isset($first_element)) { $first_element = $categories['categories_id']; } } //------------------------ if (tep_not_null($cPath)) { $new_path = ''; reset($cPath_array); while (list($key, $value) = each($cPath_array)) { unset($parent_id); unset($first_id); $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$value . "' and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."' order by sort_order, cd.categories_name"); if (tep_db_num_rows($categories_query)) { $new_path .= $value; while ($row = tep_db_fetch_array($categories_query)) { $tree[$row['categories_id']] = array('name' => $row['categories_name'], 'parent' => $row['parent_id'], 'level' => $key+1, 'path' => $new_path . '_' . $row['categories_id'], 'next_id' => false); if (isset($parent_id)) { $tree[$parent_id]['next_id'] = $row['categories_id']; } $parent_id = $row['categories_id']; if (!isset($first_id)) { $first_id = $row['categories_id']; } $last_id = $row['categories_id']; } $tree[$last_id]['next_id'] = $tree[$value]['next_id']; $tree[$value]['next_id'] = $first_id; $new_path .= '_'; } else { break; } } } tep_show_category($first_element); $info_box_contents = array(); $info_box_contents[] = array('text' => $categories_string); $info_box_contents[] = array('align' => 'right', 'text' => '<font size=-2><a class="categorTop2" href="' . tep_href_link(FILENAME_ALLPRODS, '', 'NONSSL') . '">' .tep_image(DIR_WS_IMAGES . 'pixel_trans.gif','','3','5','style="margin:10px 8px 0 14px"') . BOX_INFORMATION_ALLPRODS . '</a></font>'); new infoBox($info_box_contents); ?> <!-- categories_eof //-->
Guest Posted April 9, 2007 Posted April 9, 2007 I have not got time to count the number of lines, please post the code at the line number given. What were you installing? It looks like something has been declared twice. Sometimes you can google the error to get an answer.
LioMandi Posted April 9, 2007 Author Posted April 9, 2007 ive done a google search with no success at all to my problem... I dont know how to post with numbered code...so please look at the one provided above, thanks.
Bushmaster Posted April 9, 2007 Posted April 9, 2007 What was the last thing you installed it is try to do the same thing that is being done in catagories.php
Guest Posted April 9, 2007 Posted April 9, 2007 ive done a google search with no success at all to my problem... I dont know how to post with numbered code...so please look at the one provided above, thanks. You do not have to post with numbered code, just post the lines ***/includes/categories.php: 13) ***/includes/boxes/categories.php on LINE 64 and what were you installing?
LioMandi Posted April 9, 2007 Author Posted April 9, 2007 Ok, I was trying to install the Additional Images contrib...but in the end got everythign to work fine but got this error. Ok, here are the lines: Line 13: function tep_show_category($counter) { global $tree, $categories_string, $cPath_array; $categories_string .= '<tr><td height="20" class="categor">'; Line 64: if ($tree[$counter]['next_id'] != false) {tep_show_category($tree[$counter]['next_id']); } } ?> <!-- categories //--> <?php //$info_box_contents = array(); //$info_box_contents[] = array('text' => BOX_HEADING_CATEGORIES); //new infoBoxHeading($info_box_contents, true, false); $categories_string = ''; $tree = array();
Guest Posted April 9, 2007 Posted April 9, 2007 Ok, I was trying to install the Additional Images contrib...but in the end got everythign to work fine but got this error. Ok, here are the lines: Line 13: function tep_show_category($counter) { global $tree, $categories_string, $cPath_array; $categories_string .= '<tr><td height="20" class="categor">'; Line 64: if ($tree[$counter]['next_id'] != false) {tep_show_category($tree[$counter]['next_id']); } } ?> <!-- categories //--> <?php //$info_box_contents = array(); //$info_box_contents[] = array('text' => BOX_HEADING_CATEGORIES); //new infoBoxHeading($info_box_contents, true, false); $categories_string = ''; $tree = array(); Sorry, those lines mean nothing to me. Please recheck all of the edits for the Additional Images contrib and does that contrib have a support thread. Line 13: function tep_show_category($counter) { global $tree, $categories_string, $cPath_array; $categories_string .= '<tr><td height="20" class="categor">'; looks strange to me. What is categor?
LioMandi Posted April 9, 2007 Author Posted April 9, 2007 categor is a class defined in my stylesheet...
kirikintha Posted April 9, 2007 Posted April 9, 2007 if ($tree[$counter]['next_id'] != false) {tep_show_category($tree[$counter]['next_id']); = line 64 maybe it's a formatting error - try making it look like this: if ($tree[$counter]['next_id'] != false) { tep_show_category($tree[$counter]['next_id']); } I can't see anything else that looks wierd Nothing unreal exists
LioMandi Posted April 9, 2007 Author Posted April 9, 2007 Still has that error...but instead of 64 it says 67 now...theres a } } and that's it...
kirikintha Posted April 9, 2007 Posted April 9, 2007 OH - I don't think you are supposed to have a categories.php under the includes/ directory. I only have one under /includes boxes there is only two declarations for categories.php (in an unmodified install) include(DIR_WS_BOXES . 'categories.php'); that's in column_left.php and cache.php are you supposed to have another categories.php? Why is it under catalog/includes? That's what it looks like to me Nothing unreal exists
Guest Posted April 9, 2007 Posted April 9, 2007 if ($tree[$counter]['next_id'] != false) {tep_show_category($tree[$counter]['next_id']); = line 64 maybe it's a formatting error - try making it look like this: if ($tree[$counter]['next_id'] != false) { tep_show_category($tree[$counter]['next_id']); } I can't see anything else that looks wierd A formatting error in a css file not produce that error. You need to check your edits very carefully, and seek help in the support thread for your contrib. If there is no support thread, do not install it.
Guest Posted April 9, 2007 Posted April 9, 2007 Still has that error...but instead of 64 it says 67 now...theres a } } and that's it... What does that mean?
LioMandi Posted April 9, 2007 Author Posted April 9, 2007 Oh sorry, meant that categories.php is under includes/boxes/ just wanted to make it short..
LioMandi Posted April 9, 2007 Author Posted April 9, 2007 One more thing, I didnt specify a cache folder in Admin. You think this may be causing the problem?
Guest Posted April 9, 2007 Posted April 9, 2007 OH - I don't think you are supposed to have a categories.php under the includes/ directory. I only have one under /includes boxes there is only two declarations for categories.php (in an unmodified install) include(DIR_WS_BOXES . 'categories.php'); that's in column_left.php and cache.php are you supposed to have another categories.php? Why is it under catalog/includes? That's what it looks like to me Correct. If that is the case, be careful when ftping changes toe the web site (do not use IE).
kirikintha Posted April 9, 2007 Posted April 9, 2007 Hi Leslie - when I first got this post, I only saw the original post (did not get any subsequent posts which was wierd until I posted an answer) so I just went with the first thing I saw. I don't want to sound out of line but this is not a CSS error: Fatal error: Cannot redeclare tep_show_category () (previously declared in ***/includes/categories.php: 13) in ***/includes/boxes/categories.php on LINE 64 is a redeclare error this is the closest thing I could find to any easy explaination: http://www.faqts.com/knowledge_base/view.phtml/aid/3760 So, unless there is something I am missing, the CSS should be fine. Granted it is Monday and I am not on my A game today! Hopefully I am not adding to the confusion! Nothing unreal exists
dp1726 Posted April 9, 2007 Posted April 9, 2007 not sure if it will help but try to remove the extra space between function tep_show_category($counter) { global $tree, $categories_string, $cPath_array; $categories_string .= '<tr><td height="20" class="categor">'; $otstup = 0; to something like this function tep_show_category($counter) { global $tree, $categories_string, $cPath_array; $categories_string .= '<tr><td height="20" class="categor">'; $otstup = 0; also empty space at the end after ?> Or any empty space between any lines you added. Might help. I do not know why but it has helped me with the "headers already sent" errors. Dave
Bushmaster Posted April 9, 2007 Posted April 9, 2007 Did you edit catagories.php when you installed this contrib?
Guest Posted April 9, 2007 Posted April 9, 2007 Hi Leslie - when I first got this post, I only saw the original post (did not get any subsequent posts which was wierd until I posted an answer) so I just went with the first thing I saw. I don't want to sound out of line but this is not a CSS error: Fatal error: Cannot redeclare tep_show_category () (previously declared in ***/includes/categories.php: 13) in ***/includes/boxes/categories.php on LINE 64 is a redeclare error this is the closest thing I could find to any easy explaination: http://www.faqts.com/knowledge_base/view.phtml/aid/3760 So, unless there is something I am missing, the CSS should be fine. Granted it is Monday and I am not on my A game today! Hopefully I am not adding to the confusion! Yes, no of us aare at our peak. This is not my problem, just trying to help. I can not see that this is a css error, just trying to state the obvious.
LioMandi Posted April 9, 2007 Author Posted April 9, 2007 no didn't edit that file, it was the one in admin
Guest Posted April 9, 2007 Posted April 9, 2007 Yes, no of us aare at our peak. This is not my problem, just trying to help. I can not see that this is a css error, just trying to state the obvious. After that last post, it is evident that is is bedtime.
LioMandi Posted April 9, 2007 Author Posted April 9, 2007 Heres a snapshot of the error - Im using APACHE to modify my files so I couldnt provide a link:
Jack_mcs Posted April 9, 2007 Posted April 9, 2007 I get this error : Fatal error: Cannot redeclare tep_show_category () (previously declared in ***/includes/categories.php: 13) in ***/includes/boxes/categories.php on LINE 64 Can someone please help me? Ive search the boards for days but had no luck in resolving this issue. My shop cannot function without this correction. This is a common error with templates so that might be your problem. See this for the fix. Jack Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons
Bushmaster Posted April 9, 2007 Posted April 9, 2007 If you didn't edit that file then your problem is coming from another file. Its telling you it is declared already and where. If you didn't have the problem before installing this contribe then its in the added files or in the code they had you add to another file.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.