Jump to content
Sign in to follow this  
techs21

help with fedex web services

Recommended Posts

I am having a problem with this add-on when a customer tries to pay for an order via paypal they get this error

Fatal error: Cannot redeclare cmp() (previously declared in /home2/techsonh/public_html/includes/modules/shipping/fedexwebservices.php:225) in /home2/techsonh/public_html/includes/modules/shipping/fedexwebservices.php on line 225

 

paypal and fedex said its not them so I need to see if I can get this fixed

 

any help appreciated thanks

Share this post


Link to post
Share on other sites

post the code of fedexwebservices.php on line 225, please?


Please read this line: Do you want to find all the answers to your questions? click here. As for contribution database it's located here!

8 people out of 10 don't bother to read installation manuals. I can recommend: if you can't read the installation manual, don't bother to install any contribution yourself.

Before installing contribution or editing/updating/deleting any files, do the full backup, it will save to you & everyone here on the forum time to fix your issues.

Any issues with oscommerce, I am here to help you.

Share this post


Link to post
Share on other sites

Line 225 starts here:

 

function cmp($a, $B) {
  if ($a['cost'] == $b['cost']) {
 return 0;
  }
  return ($a['cost'] < $b['cost']) ? -1 : 1;
 }  

 usort($methods, 'cmp');

 

I tested and turns out that this error only occurs when using Paypal Express payment module with it. After the users selects shipping, they are sent to paypal to log in. This error shows up when paypal sends them back to checkout.

Share this post


Link to post
Share on other sites

why:

function cmp($a, $B ) {

 

as it should be:

function cmp($a, $b ) {

 

you have the issue that the cmp() function is declared twice, as for the rest of code is fine, looking on example from the php.net and comparing to the following code:

<?php
function cmp($a, $b )
{
if ($a == $b {
	return 0;
}
return ($a < $b ? -1 : 1;
}
$a = array(3, 2, 5, 6, 1);
usort($a, "cmp");
foreach ($a as $key => $value) {
echo "$key: $value\n";
}
?>

http://php.net/manua...ction.usort.php


Please read this line: Do you want to find all the answers to your questions? click here. As for contribution database it's located here!

8 people out of 10 don't bother to read installation manuals. I can recommend: if you can't read the installation manual, don't bother to install any contribution yourself.

Before installing contribution or editing/updating/deleting any files, do the full backup, it will save to you & everyone here on the forum time to fix your issues.

Any issues with oscommerce, I am here to help you.

Share this post


Link to post
Share on other sites

Still have not fixed the issue. But I did see that the cmp function was wrapped inside a foreach method. Tried moving it outside of that foreach and I got the same error on a different line. So no real progress here.

Share this post


Link to post
Share on other sites

This can be fixed like so:

 

 

 

if (!function_exists('cmp')) {
function cmp($a, $B) {
	if ($a['cost'] == $b['cost']) {
		return 0;
	}
	return ($a['cost'] < $b['cost']) ? -1 : 1;
}
}

Edited by jerrygarciuh

Share this post


Link to post
Share on other sites

how can i determine the line numbers?

 

 

Fatal error: Cannot redeclare class fedexwebservices in /hermes/waloraweb072/b1566/as.amchisal/public_html/djcdist.com/includes/modules/shipping/fedexwebservices.php on line 9

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×