Jump to content

Minor bug in new UPS calc.php file


Guest

Recommended Posts

A customer of mine just reported getting an error when checking out. After looking over the file indicated, I found a small bug. Around line 30 is the following code:

		 if(!isset($module['rescom']))

			{

				$rate->rescom("RES");   // See the rescom() function for codes

			}

			else

				$rate->rescom(strtoupper($module['rescom']));   // See the rescom() function for codes

		}




There is a missing '{' after the else clause, so the correct code should look like:




			if(!isset($module['rescom']))

			{

				$rate->rescom("RES");   // See the rescom() function for codes

			}

			else

			{

				$rate->rescom(strtoupper($module['rescom']));   // See the rescom() function for codes

			}

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...
Guest jammansf

Hi,

Read your post, but when looking at my calc.php file I don't see the segment of the code: this is what I have:

<?php

$module = fetchDbConfig("UPS");

if($module['status']==1){

require("ups.php");

foreach($module as $key => $value){

if(ereg("product_",$key) && $value==1){

$productCode = substr($key,8,3);

$rate = new Ups;

$rate->upsProduct($productCode); // See upsProduct() function for codes

$rate->origin($module['postcode'], countryIso($config['siteCountry'])); // Use ISO country codes!

$rate->dest($basket['delInf']['postcode'], countryIso($basket['delInf']['country'])); // Use ISO country codes!

$rate->rate("RDP"); // See the rate() function for codes

$rate->container($module['container']); // See the container() function for codes

$rate->weight($totalWeight);

$rate->rescom("RES"); // See the rescom() function for codes

switch ($productCode) {

case "GND":

$desc = $lang['misc']['ground'];

break;

case "3DS":

$desc = $lang['misc']['3daySelect'];

break;

case "2DA":

$desc = $lang['misc']['2ndDayAir'];

break;

case "1DA":

$desc = $lang['misc']['nextDayAir'];

break;

}

$quote = $rate->getQuote();

if($quote>0){

$sum = $quote;

$shippingPrice .= $rate->getOpt($sum,$productCode,$desc);

$shippingAvailable = TRUE;

}

}

}

}

unset($module);

?>

Link to comment
Share on other sites

  • 2 weeks later...

Join the conversation

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

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