You are viewing this forum as a guest. Login to an existing account, or create a new account, to reply to topics and to create new topics.
This is returning no rate for USPS.
For some reason, in USPS.php,
while (!empty($result['RateV4Response.0']['Package.0']['Postage.' . $count])) {
is returning false for that statement.
Here is the $result array. Any ideas would be appreciated.
$result = Array
(
[RateV4Response.0] => Array
(
[Package.0] => Array
(
[ZipOrigination.0] => 38401
[ZipDestination.0] => 99005
[Pounds.0] => 0
[Ounces.0] => 5
[Size.0] => REGULAR
[Machinable.0] => TRUE
[Zone.0] => 7
[Postage.0] => Array
(
[MailService.0] => Priority Mail Express 2-Day<sup>™</sup>
[Rate.0] => 29.25
)
[Postage.0.att] => Array
(
[CLASSID.0] => 3
)
[Postage.1] => Array
(
[MailService.0] => Priority Mail Express 2-Day<sup>™</sup> Hold For Pickup
[Rate.0] => 29.25
)
[Postage.1.att] => Array
(
[CLASSID.0] => 2
)
[Postage.2] => Array
(
[MailService.0] => Priority Mail Express 2-Day<sup>™</sup> Flat Rate Boxes
[Rate.0] => 44.95
)
[Postage.2.att] => Array
(
[CLASSID.0] => 55
)
[Postage.3] => Array
(
[MailService.0] => Priority Mail Express 2-Day<sup>™</sup> Flat Rate Boxes Hold For Pickup
[Rate.0] => 44.95
)
[Postage.3.att] => Array
(
[CLASSID.0] => 56
)
[Postage.4] => Array
(
[MailService.0] => Priority Mail Express 2-Day<sup>™</sup> Flat Rate Envelope
[Rate.0] => 19.99
)
[Postage.4.att] => Array
(
[CLASSID.0] => 13
)
[Postage.5] => Array
(
[MailService.0] => Priority Mail Express 2-Day<sup>™</sup> Flat Rate Envelope Hold For Pickup
[Rate.0] => 19.99
)
[Postage.5.att] => Array
(
[CLASSID.0] => 27
)
[Postage.6] => Array
(
[MailService.0] => Priority Mail Express 2-Day<sup>™</sup> Legal Flat Rate Envelope
[Rate.0] => 19.99
)
[Postage.6.att] => Array
(
[CLASSID.0] => 30
)
[Postage.7] => Array
(
[MailService.0] => Priority Mail Express 2-Day<sup>™</sup> Legal Flat Rate Envelope Hold For Pickup
[Rate.0] => 19.99
)
[Postage.7.att] => Array
(
[CLASSID.0] => 31
)
[Postage.8] => Array
(
[MailService.0] => Priority Mail Express 2-Day<sup>™</sup> Padded Flat Rate Envelope
[Rate.0] => 19.99
)
[Postage.8.att] => Array
(
[CLASSID.0] => 62
)
[Postage.9] => Array
(
[MailService.0] => Priority Mail Express 2-Day<sup>™</sup> Padded Flat Rate Envelope Hold For Pickup
[Rate.0] => 19.99
)
[Postage.9.att] => Array
(
[CLASSID.0] => 63
)
[Postage.10] => Array
(
[MailService.0] => Priority Mail 2-Day<sup>™</sup>
[Rate.0] => 6.65
)
[Postage.10.att] => Array
(
[CLASSID.0] => 1
)
[Postage.11] => Array
(
[MailService.0] => Priority Mail 2-Day<sup>™</sup> Large Flat Rate Box
[Rate.0] => 17.90
)
[Postage.11.att] => Array
(
[CLASSID.0] => 22
)
[Postage.12] => Array
(
[MailService.0] => Priority Mail 2-Day<sup>™</sup> Medium Flat Rate Box
[Rate.0] => 12.65
)
[Postage.12.att] => Array
(
[CLASSID.0] => 17
)
[Postage.13] => Array
(
[MailService.0] => Priority Mail 2-Day<sup>™</sup> Small Flat Rate Box
[Rate.0] => 5.95
)
[Postage.13.att] => Array
(
[CLASSID.0] => 28
)
[Postage.14] => Array
(
[MailService.0] => Priority Mail 2-Day<sup>™</sup> Flat Rate Envelope
[Rate.0] => 5.75
)
[Postage.14.att] => Array
(
[CLASSID.0] => 16
)
[Postage.15] => Array
(
[MailService.0] => Priority Mail 2-Day<sup>™</sup> Legal Flat Rate Envelope
[Rate.0] => 5.90
)
[Postage.15.att] => Array
(
[CLASSID.0] => 44
)
[Postage.16] => Array
(
[MailService.0] => Priority Mail 2-Day<sup>™</sup> Padded Flat Rate Envelope
[Rate.0] => 6.10
)
[Postage.16.att] => Array
(
[CLASSID.0] => 29
)
[Postage.17] => Array
(
[MailService.0] => Priority Mail 2-Day<sup>™</sup> Gift Card Flat Rate Envelope
[Rate.0] => 5.75
)
[Postage.17.att] => Array
(
[CLASSID.0] => 38
)
[Postage.18] => Array
(
[MailService.0] => Priority Mail 2-Day<sup>™</sup> Small Flat Rate Envelope
[Rate.0] => 5.75
)
[Postage.18.att] => Array
(
[CLASSID.0] => 42
)
[Postage.19] => Array
(
[MailService.0] => Priority Mail 2-Day<sup>™</sup> Window Flat Rate Envelope
[Rate.0] => 5.75
)
[Postage.19.att] => Array
(
[CLASSID.0] => 40
)
[Postage.20] => Array
(
[MailService.0] => First-Class Mail<sup>®</sup> Parcel
[Rate.0] => 2.68
)
[Postage.20.att] => Array
(
[CLASSID.0] => 0
)
[Postage.21] => Array
(
[MailService.0] => First-Class Mail<sup>®</sup> Large Envelope
[Rate.0] => 1.82
)
[Postage.21.att] => Array
(
[CLASSID.0] => 0
)
[Postage.22] => Array
(
[MailService.0] => Standard Post<sup>®</sup>
[Rate.0] => 6.45
)
[Postage.22.att] => Array
(
[CLASSID.0] => 4
)
[Postage.23] => Array
(
[MailService.0] => Media Mail Parcel
[Rate.0] => 2.69
)
[Postage.23.att] => Array
(
[CLASSID.0] => 6
)
[Postage.24] => Array
(
[MailService.0] => Library Mail Parcel
[Rate.0] => 2.56
)
[Postage.24.att] => Array
(
[CLASSID.0] => 7
)
)
[Package.0.att] => Array
(
[ID.0] => 0
)
)
)
Offline
Yes, $count starts with zero and increments.
This is your untouched program around line 252 USPS.php.
It works for other orders but we have some where this doesn't work.
USPS does send back okay data.
The "while" statement is "false", thus does not run.
// +-- // | Loop through the result and build out our return array. // +-- $return = array(); $count = 0; // This is where I captured the $return array for you. while (!(empty($result['RateV3Response.0']['Package.0']['Postage.' . $count]))) { $service_code = $result['RateV3Response.0']['Package.0']['Postage.' . $count]['MailService.0']; $service_rate = $result['RateV3Response.0']['Package.0']['Postage.' . $count]['Rate.0']; if (!(empty($result['RateV3Response.0']['Package.0']['Postage.' . $count]['CommercialRate.0']))) { $service_rate = $result['RateV3Response.0']['Package.0']['Postage.' . $count]['CommercialRate.0']; } // End of if statement. // +-- // | Adjust the rate. We need the rate in our component base currency but // | it's always returned by USPS in a default currency (specified in settings). // +-- $service_rate = $this->returnprice(array('amount' => $service_rate, 'entrycurr' => $this->globals('core_settings.ecom.uspsretcurr'), 'returncurr' => $this->globals('core_settings.core.basecurrency'), 'formatwsym' => 0, 'formatweutax' => 0)); // +-- // | Only return services that we recognize. // +-- $service_code = preg_replace('/' . preg_quote('<sup>&','/') . '.*?' . preg_quote('</sup>','/') . '/','',$service_code); $service_code = preg_replace('/ \(.*?\)/','',$service_code); $service_code = preg_replace('/\*\*/','',$service_code); foreach ($shipinfo['USPS']['shipper_prods'] as $prod => $info) { if ((!(empty($info['active']))) && ($info['id'] == 'USPS-US-' . $service_code)) { $return['CODED:USPS-US-' . $service_code] = $service_rate; } // End of if statement. } // End of foreach statement. $count++; } // End of while statment.
Last edited by Blitzen (12-31-2014 11:23:38)
Offline
Earlier you posted a 'Ratev4Response' array. The coding you just submitted is a 'RateV3Response' array. Which version are you using? V3 was just retired by USPS. Our software versions 8.0.8 and higher use V4.
Offline
Ah ha - copied wrong code. Here is what is in the live site.
The !empty while loop does not run for this item.
I'm waiting for client to confirm if perhaps USPS returns only rates that he has disabled.
while (!empty($result['RateV4Response.0']['Package.0']['Postage.' . $count])) { $service_code = $result['RateV4Response.0']['Package.0']['Postage.' . $count]['MailService.0']; $service_rate = $result['RateV4Response.0']['Package.0']['Postage.' . $count]['Rate.0']; ...
Last edited by Blitzen (01-03-2015 11:52:51)
Offline