undahtran Posted September 25, 2009 Posted September 25, 2009 Hello, Using latest version of Oscommerce. Familiar with Zencart, but Newbie to OScommerce. Im trying to help out a friend that's been dealing with a developer in Pakistan and is having trouble getting the changes that he wants made by his developer. The Problem. Most shopping carts have the categories on the left column. My friend wants his Categories to be in the left column and not the right. So when I manipulated the left and right column, the index page got distorted and I get an error. Fatal error: Cannot redeclare tep_show_category() (previously declared in /home3/mangost7/public_html/includes/boxes/categories.php:13) in /home3/mangost7/public_html/includes/boxes/categories.php on line 60 Please look at http://www.mangosteendirect.com Once you navigate to any of the pages, it's fine, the layout no longer is distorted. Please click on any other links for example. I think it's somewhere in the categories.php or index.php, but I can't figure it out since my php is pretty weak. Here's the index.php <?php /* $Id: index.php 1739 2007-12-20 00:52:16Z hpdl $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Released under the GNU General Public License */ require('includes/application_top.php'); // the following cPath references come from application_top.php $main_array = "select * from define_mainpage where main_id='1'"; $res = mysql_query($main_array) or die(mysql_error()); $result = mysql_fetch_array($res); // require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_HOME); ?> <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> <html <?php echo HTML_PARAMS; ?>> <head> <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>"> <title><?php echo TITLE; ?></title> <base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>"> <link rel="stylesheet" type="text/css" href="stylesheet.css"> <style type="text/css"> <!-- #Layer1 { position:absolute; width:97px; height:42px; z-index:1; left: 818px; top: 49px; } --> </style> </head> <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0"> <!-- header //--> <?php require(DIR_WS_INCLUDES . 'header.php'); ?> <!-- header_eof //--> <!-- body //--> <table cellpadding="15" cellspacing="0" align="center" width="912" bgcolor="#FFFFFF"> <tr> <td valign="top"><table cellpadding="0" cellspacing="0" width="228"> <?php require(DIR_WS_INCLUDES . 'column_left_index.php'); ?> </table> </td> <td width="100%" valign="top"> <table width="100%" cellpadding="0" cellspacing="0" align="center"> <tr> <td class="BG_main_banner" valign="top"><div align="right" style="padding:20px 10px 0px 0px;"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT, 'cPath=22') . '">' . tep_image_button('button_buy_now.png', 'Buy Now') . '</a>'; ?></div> <div align="right" style="padding:20px 10px 0px 0px;"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT, 'cPath=21') . '">' . tep_image_button('button_special_offer.png', 'Buy Now') . '</a>'; ?></div> </td> </tr> <tr> <td> </td> </tr> <tr> <td> <table width="100%" cellpadding="0" cellspacing="0" align="center"> <tr> <td colspan="2" height="30"><img src="images/text_xangopresents.jpg"></td> <td rowspan="3" width="209"><img src="images/7430654.jpg" width="250" height="207"></td> </tr> <tr> <td colspan="2" class="smallText" style="font-size:12px;"><?php echo $result['field1'];?> </td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_silver.gif', '100%', '3'); ?></td> <td width="100"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT, 'cPath=22_31') . '">' . tep_image_button('button_buy_now.png', 'Buy Now') . '</a>'; ?></td> </tr> </table> </td> </tr> <tr> <td> </td> </tr> <tr> <td> <table width="100%" cellpadding="0" cellspacing="0" align="center"> <tr> <td valign="top"> <table width="100%" cellpadding="0" cellspacing="0" align="center"> <tr> <td height="30"><img src="images/eleviv_customercomments.jpg"></td> </tr> <tr> <td class="smallText"><?php echo $result['field2'];?></td> </tr> <tr> <td class="" height="10"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '40'); ?></td> </tr> <tr> <td><img src="images/leaf.jpg"></td> </tr> </table> </td> <td valign="top"> <table width="100%" cellpadding="0" cellspacing="0" align="center"> <?php require(DIR_WS_BOXES . 'categories.php'); ?> <?php require(DIR_WS_BOXES . 'media.php'); ?> </table> </td> </tr> </table> </td> </tr> </table> </td> </tr> </table> <!-- body_eof //--> <!-- footer //--> <?php require(DIR_WS_INCLUDES . 'footer.php'); ?> <!-- footer_eof //--> <br> </body> </html> <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?> Here's the Categories.php code <?php /* $Id: categories.php 1739 2007-12-20 00:52:16Z hpdl $ 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; for ($i=0; $i<$tree[$counter]['level']; $i++) { $categories_string .= ''; $tr = '<tr><td class="bottom_border">'; } $categories_string .= '<tr><td class="bottom_border"><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 style=" color:#000;">'; } // 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></td></tr>'; /*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 //--> <tr><td valign="top"> <table cellpadding="0" cellspacing="2" width="200" align="center" class="border"> <tr> <td class="BG_category_header"><span><?php echo BOX_HEADING_CATEGORIES;?></span></td> </tr> <tr> <td> <?php $info_box_contents = array(); $info_box_contents[] = array('text' => BOX_HEADING_CATEGORIES); //new infoBoxHeading($info_box_contents, true, false); $categories_string = ''; $categories_string .= '<table width="196" cellpadding="0" cellspacing="0" align="center">'; $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); $categories_string .= '</table>'; $info_box_contents = array(); $info_box_contents[] = array('text' => $categories_string); new infoBox1($info_box_contents); ?> </td> </tr> <?php require(DIR_WS_BOXES . 'my_account.php'); ?> </table> </td> </tr> <!-- categories_eof //--> Can anyone please point me the way. Kind Regards, Undah
♥ecartz Posted September 30, 2009 Posted September 30, 2009 Fatal error: Cannot redeclare tep_show_category() (previously declared in /home3/mangost7/public_html/includes/boxes/categories.php:13) in /home3/mangost7/public_html/includes/boxes/categories.php on line 60The error is saying that you are including includes/boxes/categories.php twice. It's a fatal error, so once it occurs, nothing else renders on the page. This keeps the layout from completing (and various other issues as well). To fix it, first comment out the existing include and then add in your new include, rather than the other way around. If you really wanted to show the categories box twice, there are other options, including moving tep_show_category() out of that file and into includes/functions/general.php or gating the function declaration with function_exists. However, that shouldn't be necessary to just move the box. Always back up before making changes.
theleash Posted January 11, 2010 Posted January 11, 2010 The error is saying that you are including includes/boxes/categories.php twice. It's a fatal error, so once it occurs, nothing else renders on the page. This keeps the layout from completing (and various other issues as well). To fix it, first comment out the existing include and then add in your new include, rather than the other way around. If you really wanted to show the categories box twice, there are other options, including moving tep_show_category() out of that file and into includes/functions/general.php or gating the function declaration with function_exists. However, that shouldn't be necessary to just move the box. HI, Im new and not to bright with php. I have this error and am unsure exactly how or where to comment out the include. My issue is similar (see www.mapg.com.au/catalog/index.php) Could you assist me please? Thanks
germ Posted January 12, 2010 Posted January 12, 2010 HI, Im new and not to bright with php. I have this error and am unsure exactly how or where to comment out the include. My issue is similar (see www.mapg.com.au/catalog/index.php) Could you assist me please? Thanks Your error: Parse error: syntax error, unexpected $end in E:\inetpub\esvc000825\catalog\includes\boxes\categories.php on line 159 Usually means unbalanced curly braces. They must appear in equal number in the active code. You'll need to post the code from the file if you want anyone to try to show you where the malfunction is. If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there >
Recommended Posts
Archived
This topic is now archived and is closed to further replies.