Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Fatal error: Cannot redeclare tep_show_category() (previously declared on checkout_shipping.php


ygor1980

Recommended Posts

Hi guys,

 

I have installed CCGV5.15a2 then i got that messages when i try to purchase :

 

CCGV works great. But that fatal error mess up osc template. how can i fix that problem. Site works well but this mess up very bad. Someone please helpme?

 

Error Messages :

 

Fatal error: Cannot redeclare tep_show_category() (previously declared in /home/orga/public_html/store/includes/boxes/categories.php:13) in /home/orga/public_html/store/includes/footer.php on line 33

 

 

code on categories.php

 

13 function tep_show_category($counter) {

14 global $tree, $categories_string, $cPath_array;

 

code on footer.php.php

 

33 function tep_show_category($counter) {

34 global $tree, $categories_string, $cPath_array;

 

 

 

Please help me.thanks.

Link to comment
Share on other sites

  • 4 months later...
Hi guys,

 

I have installed CCGV5.15a2 then i got that messages when i try to purchase :

 

CCGV works great. But that fatal error mess up osc template. how can i fix that problem. Site works well but this mess up very bad. Someone please helpme?

 

Error Messages :

 

Fatal error: Cannot redeclare tep_show_category() (previously declared in /home/orga/public_html/store/includes/boxes/categories.php:13) in /home/orga/public_html/store/includes/footer.php on line 33

code on categories.php

 

13 function tep_show_category($counter) {

14 global $tree, $categories_string, $cPath_array;

 

code on footer.php.php

 

33 function tep_show_category($counter) {

34 global $tree, $categories_string, $cPath_array;

Please help me.thanks.

hi, how have you solved the problem? i'm getting also this message

Link to comment
Share on other sites

  • 1 month later...
hi, how have you solved the problem? i'm getting also this message

I ran into this problem too. "Fatal error: Cannot redeclare tep_show_category() (previously declared in" Problem solved.

Change all lines with "tep_show_category" to "tep_show_categories"

Link to comment
Share on other sites

  • 1 year later...
  • 1 month later...

What worked for me was commenting out the function to show the category under the categories.php file. Try the following:

 

1.) Starting at your catalog folder navigate to your includes\boxes\categories.php file

 

2.) Open the file with a text editor and comment out the function by enclosing the function with /* */

 

Example:

 

/*

function tep_show_category($counter) {
   global $tree, $categories_string, $cPath_array;

...OMMITED FUNCTION CODE...

   if ($tree[$counter]['next_id'] != false) {
     tep_show_category($tree[$counter]['next_id']);
   }
 }

 */

I don't recommend excluding the function from the header .php file since it appears many pages call this function from the header.php file rather than the categories.php file.

 

Oscar V.

Link to comment
Share on other sites

thanks for the reply.... i gave up on the gift voucher/coupon side of my store but it will be helpful to others, still muchly appreciate the reply! :)

Link to comment
Share on other sites

  • 1 month later...
  • 6 months later...

After I solved this problem puting in "/* */" tep_show_category() from categories.php than I get another error:

 

Warning: mysql_numrows(): supplied argument is not a valid MySQL result resource in /home/content/p/h/o/phonebay/html/includes/classes/shopping_cart.php on line 345

 

Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 67 in /home/content/p/h/o/phonebay/html/includes/classes/shopping_cart.php on line 352

 

Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 67 in /home/content/p/h/o/phonebay/html/includes/classes/shopping_cart.php on line 353

 

Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 67 in /home/content/p/h/o/phonebay/html/includes/classes/shopping_cart.php on line 354

 

Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 70 in /home/content/p/h/o/phonebay/html/shopping_cart.php on line 195

 

Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 70 in /home/content/p/h/o/phonebay/html/shopping_cart.php on line 196

 

Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 70 in /home/content/p/h/o/phonebay/html/shopping_cart.php on line 197

Any advice please?

I atachet shopping_cart.php here: http://rapidshare.com/files/172698608/shopping_cart.php.html

Link to comment
Share on other sites

Ok.. I get this.. it's declared somewhere else... but how about this?????

 

 

 

 

Fatal error: Cannot redeclare tep_show_category() (previously declared in /homepages/25/xxx/htdocs/site.de/includes/boxes/categories.php:13) in /homepages/25/xxx/htdocs/site.de/includes/boxes/categories.php on line 13

 

 

Anyone any Ideas?

Edited by Amadeuss
Link to comment
Share on other sites

I used a file string searcher and searched my whole website for a duplicate. the only place where this damn thing show up in is in categories.php. This error shows up whenever a user wants to change his/her password.

Any answer is greatly appreciated.

Link to comment
Share on other sites

I used a file string searcher and searched my whole website for a duplicate. the only place where this damn thing show up in is in categories.php. This error shows up whenever a user wants to change his/her password.

Any answer is greatly appreciated.

do you have any filenames that are not standard eg filename.old.php or something?

Link to comment
Share on other sites

do you have any filenames that are not standard eg filename.old.php or something?

 

 

Nope not that I know of. The only thing I suspect is an extra InfoBox I added . taken from contributions and posted below.

<?php
/*
Payment Logo Box v1.0

 osCommerce
 http://www.oscommerce.com/

 Copyright (c) 2000,2001 osCommerce

 Released under the GNU General Public License
*/
?>
<!-- Extra Links Box //-->
<tr>
<td>
	<?php
		  $info_box_contents2 = array();
		  $info_box_contents2[] = array('align' => 'left', 'text'  => BOX_HEADING_LINKSBOX );
		  new infoBoxHeading($info_box_contents2, false, false);

		  $info_box_contents2 = array();
		  $info_box_contents2[] = array('align' => 'center', 'text'  => '<img src="images/banners/banner_01.jpg"/>' . '<p> Telefonische Bestell- u.Servicehotline:' . '<p>+49(0)7271-xxxxxx');
		  new infoBox($info_box_contents2);
	?>
</td></tr>
<!-- Text links Box v1.0_eof //-->

 

 

but i commented this out and it still gives me the error.Thanks for your quick reply.

Edited by Amadeuss
Link to comment
Share on other sites

  • 9 months later...

Hello all,

I have recently installed Link Manager II on a website for a friend of mine. After following the installation instructions I am encountering the following error

 

Fatal error: Cannot redeclare tep_show_category() (previously declared in /home/www.pets/public_html/includes/boxes/categories.php:13) in /home/www.pets/public_html/includes/boxes/categories.php on line 59

 

Do anyone know the root of this error and how to eliminate it? this error can be found @ http://petsmagic.com/links.php

 

usually, I am pretty good at following instructions, but now that I have ran into this problem, I am lost for words.

 

Thank You

 

P.S. this is a wonderful addon.

Link to comment
Share on other sites

  • 10 months later...

I am getting the say error, can anyone help me on this one?

 

THanks

 

Hello all,

I have recently installed Link Manager II on a website for a friend of mine. After following the installation instructions I am encountering the following error

 

Fatal error: Cannot redeclare tep_show_category() (previously declared in /home/www.pets/public_html/includes/boxes/categories.php:13) in /home/www.pets/public_html/includes/boxes/categories.php on line 59

 

Do anyone know the root of this error and how to eliminate it? this error can be found @ http://petsmagic.com/links.php

 

usually, I am pretty good at following instructions, but now that I have ran into this problem, I am lost for words.

 

Thank You

 

P.S. this is a wonderful addon.

Link to comment
Share on other sites

I have a similar error (at least it appears similar!)

I am attempting to install the NAB transact gateway and receive the following when I try to access the module in my admin panel

 

Fatal error: Cannot redeclare class nab_transact_hpp in /home/lsdauto1/public_html/shop/includes/modules/payment/nab_transact_hpp.php on line 36

 

the nab_transact file reads as follows (if it helps? This isnt all of the document but should exceed line 36)...I hope I copied enough of the code, it goes on for years...

I am not great with code, please feel free to use lames terms to explain! I havent made any ammendments to this contribution, have deleted and re-uploaded and not been successful. I also disabled the default credit card payment option incase it was conflicting...no clue, but havent had any success as yet!

Help would be AWESOME!

 

<?php

/*

Payment module for National Australia Bank's NAB Transact Payment Gateway (Hosted Payment Page)

 

Copyright © 2008 I2 Technology Solutions

www.i2ts.com.au

[email protected]

 

Released under the GNU General Public License

 

Version 1.4

*/

//Define internal constants

//These constants are defined here (instead of /includes/languages/english/modules/payment/)

//The lanuage file will not be available for install() function. Hence the

//constants can not be used in install()

define('MODULE_PAYMENT_NAB_TRANSACT_CONST_YES', 'Yes');

define('MODULE_PAYMENT_NAB_TRANSACT_CONST_NO', 'No');

define('MODULE_PAYMENT_NAB_TRANSACT_CONST_TEST', 'Test');

define('MODULE_PAYMENT_NAB_TRANSACT_CONST_LIVE', 'Live');

 

define('MODULE_PAYMENT_NAB_TRANSACT_HPP_CONST_LIVE_URL', 'https://transact.nab.com.au/live/hpp/payment');

define('MODULE_PAYMENT_NAB_TRANSACT_HPP_CONST_TEST_URL', 'https://transact.nab.com.au/test/hpp/payment');

 

define('MODULE_PAYMENT_NAB_TRANSACT_QS_PARAM_NAME_BANK_REF', 'bank_reference');

define('MODULE_PAYMENT_NAB_TRANSACT_QS_PARAM_NAME_CARD_TYPE', 'card_type');

define('MODULE_PAYMENT_NAB_TRANSACT_QS_PARAM_NAME_AMNT_PAID', 'payment_amount');

define('MODULE_PAYMENT_NAB_TRANSACT_QS_PARAM_NAME_REF_NUM', 'payment_number');

define('MODULE_PAYMENT_NAB_TRANSACT_QS_PARAM_NAME_CUST_IP', 'remote_ip');

 

define('MODULE_PAYMENT_NAB_TRANSACT_CLIENT_ID_LENGTH', 7);

 

define('MODULE_PAYMENT_NAB_TRANSACT_ERR_UNAUTH_CHECKOUT_CALL', '01');

define('MODULE_PAYMENT_NAB_TRANSACT_ERR_INVALID_MERCH_ID', '02');

 

class nab_transact_hpp {

var $code, $title, $public_title, $description, $enabled;

//var $payment_class->email_footer //Interesting reference to var found in checkout_process.php (sending email) Testmore

 

// constructor

function nab_transact_hpp() {

global $order, $messageStack;

 

$this->code = 'nab_transact_hpp';

$this->enabled = (MODULE_PAYMENT_NAB_TRANSACT_HPP_ENABLED == MODULE_PAYMENT_NAB_TRANSACT_CONST_YES);

$this->form_action_url = ($this->in_test_mode() ? MODULE_PAYMENT_NAB_TRANSACT_HPP_CONST_TEST_URL : MODULE_PAYMENT_NAB_TRANSACT_HPP_CONST_LIVE_URL);

$this->sort_order = MODULE_PAYMENT_NAB_TRANSACT_HPP_SORT_ORDER;

$this->title = MODULE_PAYMENT_NAB_TRANSACT_HPP_TEXT_ADMIN_TITLE;

//Add warning/error msg in Admin

//IS_ADMIN_FLAG is defined in language file

//this flag is used in language file as as well. As the language file is loaded before the module

//this flag is defined in language filr rather than here

if (IS_ADMIN_FLAG === true) {

if ($this->enabled) {

if ($errors = $this->config_errors()) {

$this->title .= ' <span class="errorText">'.MODULE_PAYMENT_NAB_TRANSACT_HPP_ERROR_CONFIG_SHORT.'</span>';

$this->description .= '<span class="errorText">'.MODULE_PAYMENT_NAB_TRANSACT_HPP_ERROR_CONFIG.'<br/><br/>';

foreach($errors as $err_code)

{

$error_array = $this->get_error($err_code, 'short');

$this->description .= '* '.$error_array['error'].'<br/>';

}

$this->description .= '</span><br/>'.tep_draw_separator();

} elseif ($warnings = $this->warnings()) {

$this->title .= ' <span class="messageStackWarning">'.MODULE_PAYMENT_NAB_TRANSACT_HPP_WARN_SHORT.'</span>';

$this->description .= '<span class="messageStackWarning">'.MODULE_PAYMENT_NAB_TRANSACT_HPP_WARN.'<br/><br/>';

foreach($warnings as $warning) {

$this->description .= '* '.$warning.'<br/>';

}

$this->description .= '</span><br/>'.tep_draw_separator();

Link to comment
Share on other sites

Hi Chris

 

Thanks for the reply but no, I am not using any template. I Used STS before but messed up a big time therefore I deleted everything on my server and database to start fresh. The new site has no 3rd party template but what is already in official osCommerce package - the light blue grey ish boring boxes and frame.

 

Please see the pic i attached. This is the problem to make me to check my error log file. Yes, my shop front page is not displaying properly. Most time if i open my site, I get below thingy but error log file doesnt have any new line, and if i refresh the page I can access my site properly but my error log file has new added line. please see below:

 

error.jpg

 

Error log file:

[Mon Aug 30 23:27:41 2010] [error] [client 90.194.179.68] FastCGI: server "/var/www/fcgi/php-cgi" stderr: PHP Fatal error: Cannot redeclare tep_show_category() (previously declared in /home/linweb03/s/shootingduck.com/user/htdocs/catalog/includes/boxes/categories.php:14) in /home/linweb03/s/shootingduck.com/user/htdocs/catalog/includes/boxes/categories.php on line 60

 

 

Below is my categories.php file:

<?php

/*

$Id: categories.php 1739 2007-12-20 00:52:16Z hpdl $

 

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 //-->

<tr>

<td>

 

<?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);

 

new infoBox($info_box_contents);

?>

</td>

</tr>

<!-- categories_eof //-->

 

 

Kai,

 

If you are using a template, refer to post#2 of this thread:

 

http://www.oscommerce.com/forums/index.php?showtopic=226887&st=0&gopid=931596entry931596

 

 

 

Chris

Edited by dontlike2pay
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...