Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Cannot redeclare class order_total


tentler

Recommended Posts

I am so close to having my cart working and the final step in check out I receive this error:

Fatal error: Cannot redeclare class order_total in /home/bowserw1/public_html/oscomm/includes/classes/order_total.php on line 13

 

I looked at line 13 in order_total.php but it jsut points to var( Modules) so I do not know where to go to coorect the issue. Has anyone seen this?

Terri

Link to comment
Share on other sites

Can you paste the first twenty or so lines of order_total.php here? Then we can take a look.

Here you go.

 

 

class order_total {

var $modules;

 

// class constructor

function order_total() {

global $language;

 

if (defined('MODULE_ORDER_TOTAL_INSTALLED') && tep_not_null(MODULE_ORDER_TOTAL_INSTALLED)) {

$this->modules = explode(';', MODULE_ORDER_TOTAL_INSTALLED);

 

reset($this->modules);

while (list(, $value) = each($this->modules)) {

include(DIR_WS_LANGUAGES . $language . '/modules/order_total/' . $value);

include(DIR_WS_MODULES . 'order_total/' . $value);

 

$class = substr($value, 0, strrpos($value, '.'));

$GLOBALS[$class] = new $class;

}

}

}

 

function process() {

$order_total_array = array();

if (is_array($this->modules)) {

reset($this->modules);

while (list(, $value) = each($this->modules)) {

$class = substr($value, 0, strrpos($value, '.'));

if ($GLOBALS[$class]->enabled) {

$GLOBALS[$class]->output = array();

$GLOBALS[$class]->process();

 

for ($i=0, $n=sizeof($GLOBALS[$class]->output); $i<$n; $i++) {

if (tep_not_null($GLOBALS[$class]->output[$i]['title']) && tep_not_null($GLOBALS[$class]->output[$i]['text'])) {

$order_total_array[] = array('code' => $GLOBALS[$class]->code,

'title' => $GLOBALS[$class]->output[$i]['title'],

'text' => $GLOBALS[$class]->output[$i]['text'],

'value' => $GLOBALS[$class]->output[$i]['value'],

'sort_order' => $GLOBALS[$class]->sort_order);

}

}

}

}

}

 

return $order_total_array;

}

 

function output() {

$output_string = '';

if (is_array($this->modules)) {

reset($this->modules);

while (list(, $value) = each($this->modules)) {

$class = substr($value, 0, strrpos($value, '.'));

if ($GLOBALS[$class]->enabled) {

$size = sizeof($GLOBALS[$class]->output);

for ($i=0; $i<$size; $i++) {

$output_string .= ' <tr>' . "\n" .

' <td align="right" class="main">' . $GLOBALS[$class]->output[$i]['title'] . '</td>' . "\n" .

' <td align="right" class="main">' . $GLOBALS[$class]->output[$i]['text'] . '</td>' . "\n" .

' </tr>';

}

}

}

}

 

return $output_string;

}

}

?>

Link to comment
Share on other sites

Nothing wrong there

On checkout_confirmation.php do you have this line twice

 

require(DIR_WS_CLASSES . 'order_total.php');

 

It should only be once. Delete the one that should not be there.

Link to comment
Share on other sites

checkout_confirmation.php should be in your root folder

 

If you have set up your store in a directory like catalog, then it will be directly in the catalog folder, otherwise it will be in the top level folder.

Link to comment
Share on other sites

These are all the files that have checkout_confirmation in them. Which one do I look for a duplication. I checked the one under OSCOMM and English but no duplication.

 

 

public_html/oscomm/checkout_confirmation.php

/public_html/oscomm/_vti_cnf/checkout_confirmation.php

/public_html/oscomm/includes/languages/english/checkout_confirmation.php

/public_html/oscomm/includes/languages/english/_vti_cnf/checkout_confirmation.php

/public_html/oscomm/includes/languages/german/checkout_confirmation.php

/public_html/oscomm/includes/languages/german/_vti_cnf/checkout_confirmation.php

/public_html/oscomm/includes/languages/espanol/checkout_confirmation.php

/public_html/oscomm/includes/languages/espanol/_vti_cnf/checkout_confirmation.php

/public_html/catalog/checkout_confirmation.php

/public_html/catalog/_vti_cnf/checkout_confirmation.php

/public_html/catalog/includes/languages/english/checkout_confirmation.php

/public_html/catalog/includes/languages/english/_vti_cnf/checkout_confirmation.php

/public_html/catalog/includes/languages/german/checkout_confirmation.php

/public_html/catalog/includes/languages/german/_vti_cnf/checkout_confirmation.php

/public_html/catalog/includes/languages/espanol/checkout_confirmation.php

/public_html/catalog/includes/languages/espanol/_vti_cnf/checkout_confirmation.php

Link to comment
Share on other sites

catalog/checkout_confirmation.php

 

I do not know why you have oscomm/checkout_confirmation.php or oscomm/_vti_cnf/checkout_confirmation.php.

 

The ones in the language folders are just the language defines and not relevant here.

 

It does seem odd that you have three checkout_confirmation files though. It is hard to tell without seeing your diectory structure but you seem to have more than one version of the store running on your host.

Link to comment
Share on other sites

In the file under catalog I only see one instance.

on line 67

require(DIR_WS_CLASSES . 'order_total.php');

$order_total_modules = new order_total;

$order_total_modules->process();

 

 

 

but then the code call out on line 249

 

<?php

if (MODULE_ORDER_TOTAL_INSTALLED) {

echo $order_total_modules->output();

}

?>

</table></td>

 

 

Would this cause this error?

Link to comment
Share on other sites

catalog/checkout_confirmation.php

 

I do not know why you have oscomm/checkout_confirmation.php or oscomm/_vti_cnf/checkout_confirmation.php.

 

The ones in the language folders are just the language defines and not relevant here.

 

It does seem odd that you have three checkout_confirmation files though. It is hard to tell without seeing your diectory structure but you seem to have more than one version of the store running on your host.

Link to comment
Share on other sites

Sorry I was replyiny at the same time. I will check with my host and see why to instances are running. I think you are right about the duplicate files. thanks so much for your help.

Link to comment
Share on other sites

I deleted the extra copy of my shopping cart that was under catalog but still get this error. I am running the website software under the /oscomm folder. I am still stumpped why I can not get rid of this error. Any other files I should try?

Link to comment
Share on other sites

  • 2 years later...

i used oscommerce 2.3.1.

i face same this error.

/includes/classes/order_total.php on line 13

but after some changes my error are resolved. i share you please changed like this than enjoy it.

 

Open checkout_confirmation.php

 

find

 

 

/* CCGV - BEGIN */

if ($credit_covers) $payment='credit_covers';

require(DIR_WS_CLASSES . 'order_total.php');

/* CCGV - END */

 

replace

 

 

/* CCGV - BEGIN */

if ($credit_covers) $payment='credit_covers';

require_once(DIR_WS_CLASSES . 'order_total.php');

/* CCGV - END */

 

 

again find again this file

 

find

 

 

require(DIR_WS_CLASSES . 'order_total.php');

$order_total_modules = new order_total;

 

 

replace

 

 

require_once(DIR_WS_CLASSES . 'order_total.php');

$order_total_modules = new order_total;

 

 

now open includes/classes/order_total.php

 

find

 

 

include(DIR_WS_LANGUAGES . $language . '/modules/order_total/' . $value);

include(DIR_WS_MODULES . 'order_total/' . $value);

 

 

replace

 

 

include_once(DIR_WS_LANGUAGES . $language . '/modules/order_total/' . $value);

include_once(DIR_WS_MODULES . 'order_total/' . $value);

 

 

thank you.

fanna

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...