Hello,
I was hoping to get some help on this. I'm trying to install Wordpress on our server, but in order to do that I have to upgrade my current PHP version (5.024 or 5.1.6, I think) to at least 5.3. I upgraded our PHP and I am now finding that neither our Purolator shipping module or the checkout is no longer working. When I go to the shipping estimate page I get an error when I hit Get Rates, and when I try to hit the checkout link, I just end up in a white screen. According to our host support the “purolator.php” file is missing data that the new version of PHP requires. Apparently, a “Action class not being declared”. Unfortunately, I can't revert our PHP version back and our programmer is away. As for the checkout page, I'm hoping this is linked to that.
I was able to get this error from our host support team:
tail /var/www/vhosts/phantomcables.com/statistics/logs/error_log -f
[Thu Jul 19 08:34:28 2012] [error] [client 70.51.168.201] PHP Fatal
error: Class 'SoapClient' not found in
/var/www/vhosts/phantomcables.com/httpdocs/shippings/purolator.php on line
49, referer: https://phantomcables.com/index.php?dispatch=checkout.cart
This is the code from our purolator.php file
```php
/***************************************************************************
-
*
- Copyright (c) 2004 Simbirsk Technologies Ltd. All rights reserved. *
-
*
- This is commercial software, only users who have purchased a valid *
- license and accept to the terms of the License Agreement can install *
- and use this program. *
-
*
****************************************************************************
- PLEASE READ THE FULL TEXT OF THE SOFTWARE LICENSE AGREEMENT IN THE *
- “copyright.txt” FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE.
/
//
// $Id: ups.php 11777 2011-02-07 09:18:43Z 2tl $
//
if ( !defined('AREA') ) { die('Access denied'); }
define(“PRODUCTION_KEY”, "");
define(“PRODUCTION_PASS”, "");
//Define the Billing account and the account that is registered with PWS
define(“BILLING_ACCOUNT”, "");
define(“REGISTERED_ACCOUNT”, "");
//define(“PRODUCTION_KEY”, "");
//define(“PRODUCTION_PASS”, "");
//
////Define the Billing account and the account that is registered with PWS
//
//define(“BILLING_ACCOUNT”, "");
//define(“REGISTERED_ACCOUNT”, "***");
function createPWSSOAPClient()
{
/ Purpose : Creates a SOAP Client in Non-WSDL mode with the appropriate authentication and
-
header information
//Set the parameters for the Non-WSDL mode SOAP communication with your Development/Production credentials
//echo DIR_SHIPPING_FILES.“estimatingservice.wsdl”;
$url = “https://webservices.purolator.com/PWS/V1/Estimating/EstimatingService.asmx”;
$client = new SoapClient( DIR_SHIPPING_FILES.“estimatingservice.wsdl”,
array (
'trace' => true,
'location' => $url,
'uri' => “http://purolator.com/pws/datatypes/v1”,
'login' => PRODUCTION_KEY,
'password' => PRODUCTION_PASS
)
);
//Define the SOAP Envelope Headers
$headers[] = new SoapHeader ( 'http://purolator.com/pws/datatypes/v1', 'RequestContext',
array (
'Version' => '1.0',
'Language' => 'en',
'GroupID' => 'xxx',
'RequestReference' => 'Rating Example'
)
);
//Apply the SOAP Header to your client
$client->__setSoapHeaders($headers);
return $client;
}
function fn_get_purolator_rates($code, $weight_data, $location, &$auth, $shipping_settings, $package_info, $origination, $service_id, $allow_multithreading = false)
{
static $cached_rates = array();
if ($shipping_settings['purolator_enabled'] != 'Y') {
return false;
}
$cached_rate_id = fn_generate_cached_rate_id($package_info, $shipping_settings);
if (!empty($cached_rates[$cached_rate_id]))
{
if (!empty($cached_rates[$cached_rate_id][$code]))
{
return array('cost' => $cached_rates[$cached_rate_id][$code]);
}
else
{
return false;
}
}
if (!empty($shipping_settings['purolator']['test_mode']) && $shipping_settings['purolator']['test_mode'] == 'Y')
{
$url = “https://devwebservices.purolator.com/PWS/V1/Estimating/EstimatingService.asmx”;
}
else
{
$url = “https://webservices.purolator.com/PWS/V1/Estimating/EstimatingService.asmx”;
}
// Prepare data for Purolator request
/$username = !empty($shipping_settings['purolator']['username']) ? $shipping_settings['purolator']['username'] : '';
$password = !empty($shipping_settings['purolator']['password']) ? $shipping_settings['purolator']['password'] : '';
$access_key = !empty($shipping_settings['purolator']['access_key']) ? $shipping_settings['purolator']['access_key'] : '';
/
//Create a SOAP Client
$client = createPWSSOAPClient();
$package_type = !empty($shipping_settings['purolator']['package_type']) ? $shipping_settings['purolator']['package_type'] : 'CustomerPackaging';
//Populate the Origin Information
$request->BillingAccountNumber = "**************“;
$request->SenderPostalCode = $origination['zipcode'];
//Populate the Desination Information
//$request->ReceiverAddress->City = $basket['delInf']['town'];
$request->ReceiverAddress->Province = $location['state'];
$request->ReceiverAddress->PostalCode = $location['zipcode'];
$request->ReceiverAddress->Country = $location['country'];
//Populate the Package Information
$request->PackageType = $package_type;
$weight = $weight_data['full_pounds'];
if(round($weight)!= 0)
{
$weight = round($weight);
}
else
{
$weight = 1.00;
}
$weight_unit = 'lb';
//Populate the Shipment Weight
$request->TotalWeight->Value = $weight;
$request->TotalWeight->WeightUnit = $weight_unit;
//echo '';
';
// print_r($request);
// echo '
//Execute the request and capture the response
$result = $client->GetQuickEstimate($request);
return fn_purolator_process_result($header, $shipping_settings, $result, $code, $cached_rates, $cached_rate_id);
}
function fn_purolator_process_result($header, $shipping_settings, $result, $code, &$cached_rates = null, $cached_rate_id = null)
{
$rates = fn_purolator_get_rates($result, $shipping_settings);
if ($cached_rates !== null && empty($cached_rates[$cached_rate_id]) && !empty($rates)) {
$cached_rates[$cached_rate_id] = $rates;
}
if (!empty($rates[$code]))
{
return array('cost' => $rates[$code]);
}
else
{
if (defined('SHIPPING_DEBUG'))
{
return array('error' => fn_purolator_get_error($result));
}
}
return false;
}
function fn_purolator_get_error($result)
{
// Parse XML message returned by the UPS post server.
$return = '';
$status_code = (string) $response->ResponseInformation->Errors->Error;
if ($status_code) {
$return = (string) $response->ResponseInformation->Errors->AdditionalInformation;
return $return;
}
return false;
}
function fn_purolator_get_rates($result, $shipping_settings)
{
$return = array();
if(!empty($result->ShipmentEstimates))
{
if(is_array($result->ShipmentEstimates->ShipmentEstimate))
{
foreach($result->ShipmentEstimates->ShipmentEstimate as $shipment)
{
$total_charge = 0;
$service_code = (string) $shipment->ServiceID;
$total_charge = (string) $shipment->TotalPrice;
if(is_numeric($shipping_settings['purolator']['purolator_additional_charge']))
{
$total_charge = $total_charge + ($total_charge * $shipping_settings['purolator']['purolator_additional_charge'])/100;
}
if (!($service_code && $total_charge))
{
continue;
}
//$rated_packages = $shipment[$i]->getElementsByName(“RatedPackage”);
//$days_to_delivery = $shipment[$i]->getValueByPath(”/GuaranteedDaysToDelivery");
//$delivery_time = $shipment[$i]->getValueByPath(“/ScheduledDeliveryTime”);
if (!empty($total_charge)) {
$return[$service_code] = $total_charge;
}
}
}
else
{
$service_code = (string) $result->ShipmentEstimates->ShipmentEstimate->ServiceID;
$total_charge = (string) $result->ShipmentEstimates->ShipmentEstimate->TotalPrice;
if (!($service_code && $total_charge))
{
continue;
}
if (!empty($total_charge))
{
$return[$service_code] = $total_charge;
}
}
}
//echo '';
';
// print_r($return);
// echo '
return $return;
}
/*if($response && $response->ShipmentEstimates->ShipmentEstimate)
{
//Loop through each Service returned and display the ID and TotalPrice
foreach($response->ShipmentEstimates->ShipmentEstimate as $estimate)
{
echo " $estimate->ServiceID is available for $ $estimate->TotalPrice \n
";
$key = $estimate->ServiceID;
$sum = $estimate->TotalPrice;
$module['handling_fee']=100;
if (is_numeric($module['handling_fee'])) {
$sum = $sum + $module['handling_fee'];
}
if ($sum>0) {
if ($taxVal>0) {
$shippingTax = ($taxVal / 100) * $sum;
}
$module['tax']='default';
$out[] = array(
'value' => $sum,
'desc' => $sum .' ('.$key.')',
'method' => $key,
'taxId' => $module['tax'],
'taxAmount' => $shippingTax,
);
}
}
}
*/
?> ```
Any help would be greatly appreciated. -