Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Recommended Posts

Posted

I pray that someone can assist or email me files.

 

I have a fresh install of v2.2 rc2a and have carefully added mvs 1.1 mod. I have everything working Except checkout confirmation. I have search through all the forums and tried many different approaches. My understanding is that this is duplicated somewhere and yes in vendor_shipping php file. Any reference regarding includes or require shipping.php have an }else{ in front of it as per the MVS instructions. I see that others have installed this mod with this version of osc, my question is how did you do it?

 

register_globals on , safe mode off. PHP is 5.2.6

 

 

Any help with my problem is so greatly appreciated.

 

When entering an order:

Delivery Info - works

Payment information - works

Confirmation - works

Finished = problem

 

Fatal error: Cannot redeclare class shipping in /data/mystore/catalog/includes/classes/shipping.php on line 13

 

here is my php file includes/classes/shipping

<?php

/*

$Id: shipping.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

*/

 

class shipping {

var $modules;

 

// class constructor

function shipping($module = '') {

global $language, $PHP_SELF;

 

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

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

 

$include_modules = array();

 

if ( (tep_not_null($module)) && (in_array(substr($module['id'], 0, strpos($module['id'], '_')) . '.' . substr($PHP_SELF, (strrpos($PHP_SELF, '.')+1)), $this->modules)) ) {

$include_modules[] = array('class' => substr($module['id'], 0, strpos($module['id'], '_')), 'file' => substr($module['id'], 0, strpos($module['id'], '_')) . '.' . substr($PHP_SELF, (strrpos($PHP_SELF, '.')+1)));

} else {

reset($this->modules);

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

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

$include_modules[] = array('class' => $class, 'file' => $value);

}

}

 

for ($i=0, $n=sizeof($include_modules); $i<$n; $i++) {

include(DIR_WS_LANGUAGES . $language . '/modules/shipping/' . $include_modules[$i]['file']);

include(DIR_WS_MODULES . 'shipping/' . $include_modules[$i]['file']);

 

$GLOBALS[$include_modules[$i]['class']] = new $include_modules[$i]['class'];

}

}

}

 

function quote($method = '', $module = '') {

global $total_weight, $shipping_weight, $shipping_quoted, $shipping_num_boxes;

 

$quotes_array = array();

 

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

$shipping_quoted = '';

$shipping_num_boxes = 1;

$shipping_weight = $total_weight;

 

if (SHIPPING_BOX_WEIGHT >= $shipping_weight*SHIPPING_BOX_PADDING/100) {

$shipping_weight = $shipping_weight+SHIPPING_BOX_WEIGHT;

} else {

$shipping_weight = $shipping_weight + ($shipping_weight*SHIPPING_BOX_PADDING/100);

}

 

if ($shipping_weight > SHIPPING_MAX_WEIGHT) { // Split into many boxes

$shipping_num_boxes = ceil($shipping_weight/SHIPPING_MAX_WEIGHT);

$shipping_weight = $shipping_weight/$shipping_num_boxes;

}

 

$include_quotes = array();

 

reset($this->modules);

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

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

if (tep_not_null($module)) {

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

$include_quotes[] = $class;

}

} elseif ($GLOBALS[$class]->enabled) {

$include_quotes[] = $class;

}

}

 

$size = sizeof($include_quotes);

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

$quotes = $GLOBALS[$include_quotes[$i]]->quote($method);

if (is_array($quotes)) $quotes_array[] = $quotes;

}

}

 

return $quotes_array;

}

 

function cheapest() {

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

$rates = array();

 

reset($this->modules);

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

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

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

$quotes = $GLOBALS[$class]->quotes;

for ($i=0, $n=sizeof($quotes['methods']); $i<$n; $i++) {

if (isset($quotes['methods'][$i]['cost']) && tep_not_null($quotes['methods'][$i]['cost'])) {

$rates[] = array('id' => $quotes['id'] . '_' . $quotes['methods'][$i]['id'],

'title' => $quotes['module'] . ' (' . $quotes['methods'][$i]['title'] . ')',

'cost' => $quotes['methods'][$i]['cost']);

}

}

}

}

 

$cheapest = false;

for ($i=0, $n=sizeof($rates); $i<$n; $i++) {

if (is_array($cheapest)) {

if ($rates[$i]['cost'] < $cheapest['cost']) {

$cheapest = $rates[$i];

}

} else {

$cheapest = $rates[$i];

}

}

 

return $cheapest;

}

}

}

?>

Posted

you're attempting to define a class thats already been defined, find the first instance, or remove this one.

Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Posted
you're attempting to define a class thats already been defined, find the first instance, or remove this one.

 

 

I hate to ask this, but can you direct me where I can find out how to do that? I have trying to work this out and figure out how to fix it, but my brain is fried and I am begging please for instruction. Thank you kindly :)

Posted
I hate to ask this, but can you direct me where I can find out how to do that? I have trying to work this out and figure out how to fix it, but my brain is fried and I am begging please for instruction. Thank you kindly :)

 

ALL HAIL JIM!!!!

Thank you for the below detailed information. I would suggest for anyone doing a fresh install of 2.2 rc2a to use merge for all files you are uploading that are also in the oscommerce package EXCEPT the catalog/checkout_process, catalog/checkout_payment, catalog/checkout_confirmation and catalog/checkout_shipping. You will upload these exactly how they are unchanged in the MVS 1.1 mod. Yes, the MVS 1.1 files are older than the new 2.2 rc2a oscommerce but by installing it this way you will avoid any pain caused by all class shipping "redeclares" on line 13 of every shipping method. I did NOT have to rename any of the include(s) as directed below. Everything is working great. Jim - I LOVE YOU AND ALL YOU GENIUSNESS!

 

 

 

Details on how to fix from Jim- and it will work if you follow his directions.

 

This happens when the shipping class is declared more than once in the code. The most common cause is loading a code file to catalog/includes/languages/english/ instead of catalog/. Check all of your language files, or just reload all of them.

 

The other possibility is an editing error in one of the include()s. Look for the following lines:

 

CODE

include(DIR_WS_CLASSES . 'shipping.php');

include(DIR_WS_CLASSES . 'vendor_shipping.php');

in the checkout files: checkout_shipping.php, checkout_process.php, and checkout_confirmation.php. If either of those lines is in a single file twice, remove the duplicate. You could also just replace include() with include_once() and require() with require_once() everywhere in the code. It's not the optimal solution, but it will remove most of these problems.

 

 

Regards

Jim

Posted

one of the files in the classes is renamed to say shipping_abc.php.

So this class also has

class shipping {

var $modules;

 

so either You need to rename the file chaging the extension or delete that file.

 

Satish

Ask/Skype for Free osCommerce value addon/SEO suggestion tips for your site.

 

Check My About US For who am I and what My company does.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

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