Post by franktroy » Sat Aug 24, 2019 8:47 am

Folks,

I can't seem to get shipping working using either UPS or USPS. Right now I have USPS enabled but I get the following error: Warning: No Shipping options are available. Please contact us for assistance!

When I check the log it appears its trying to communicate and gets an answer from USPS (below). I've been browsing all the boards and believe all my settings are correct.

This is a new installation of version 3.0.3.2 on a hosted server.

Any assistance is appreciated.

2019-08-24 0:36:06 - USPS DATA SENT: API=RateV4&XML=<RateV4Request USERID="880TROYN4341"> <Package ID="1"> <Service>ALL</Service> <ZipOrigination>20180</ZipOrigination> <ZipDestination>20180</ZipDestination> <Pounds>10</Pounds> <Ounces>0</Ounces> <Container>VARIABLE</Container> <Size>REGULAR</Size> <Width>10</Width> <Length>10</Length> <Height>10</Height> <Girth>50</Girth> <Machinable>false</Machinable> </Package></RateV4Request>
2019-08-24 0:36:06 - USPS DATA RECV: <?xml version="1.0" encoding="UTF-8"?>
<RateV4Response><Package ID="1"><ZipOrigination>20180</ZipOrigination><ZipDestination>20180</ZipDestination><Pounds>10</Pounds><Ounces>0</Ounces><Machinable>FALSE</Machinable><Zone>1</Zone><Postage CLASSID="3"><MailService>Priority Mail Express 2-Day</MailService><Rate>40.75</Rate></Postage><Postage CLASSID="2"><MailService>Priority Mail Express 2-Day Hold For Pickup</MailService><Rate>40.75</Rate></Postage><Postage CLASSID="23"><MailService>Priority Mail Express 2-Day Sunday/Holiday Delivery</MailService><Rate>53.25</Rate></Postage><Postage CLASSID="1"><MailService>Priority Mail 1-Day</MailService><Rate>13.10</Rate></Postage><Postage CLASSID="6"><MailService>Media Mail Parcel</MailService><Rate>7.43</Rate></Postage><Postage CLASSID="7"><MailService>Library Mail Parcel</MailService><Rate>7.02</Rate></Postage></Package></RateV4Response>

Newbie

Posts

Joined
Sun Aug 18, 2019 5:32 pm

Post by letxobnav » Sat Aug 24, 2019 2:52 pm

well, from the debug messages it seems it sends ok and receives ok so it looks like your USPS settings prohibit it from accepting the quotes.

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


Active Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by franktroy » Sun Aug 25, 2019 6:33 am

The problem is no matter what shipping method I use (except for COD) I get the same message. UPS and USPS don't seem to work.

Newbie

Posts

Joined
Sun Aug 18, 2019 5:32 pm

Post by letxobnav » Sun Aug 25, 2019 10:02 am

well, this is the quote xml returned.

Code: Select all

 <?xml version="1.0" encoding="UTF-8"?>
<RateV4Response>
	<Package ID="1">
		<ZipOrigination>20180</ZipOrigination>
		<ZipDestination>20180</ZipDestination>
		<Pounds>10</Pounds>
		<Ounces>0</Ounces>
		<Machinable>FALSE</Machinable>
		<Zone>1</Zone>
		<Postage CLASSID="3">
			<MailService>Priority Mail Express 2-Day</MailService>
			<Rate>40.75</Rate>
		</Postage>
		<Postage CLASSID="2">
			<MailService>Priority Mail Express 2-Day Hold For Pickup</MailService>
			<Rate>40.75</Rate>
		</Postage>
		<Postage CLASSID="23">
			<MailService>Priority Mail Express 2-Day Sunday/Holiday Delivery</MailService>
			<Rate>53.25</Rate>
		</Postage>
		<Postage CLASSID="1">
			<MailService>Priority Mail 1-Day</MailService>
			<Rate>13.10</Rate>
		</Postage>
		<Postage CLASSID="6">
			<MailService>Media Mail Parcel</MailService>
			<Rate>7.43</Rate>
		</Postage>
		<Postage CLASSID="7">
			<MailService>Library Mail Parcel</MailService>
			<Rate>7.02</Rate>
		</Postage>
	</Package>
</RateV4Response>
that is parsed.

you could add:

Code: Select all

			error_log(print_r($quote_data,true));
just before:

Code: Select all

			if ($quote_data) {


in catalog/model/extension/shipping/usps.php

that should print out the quotes it parsed from the above xml, if any, in your php error log.
that should tell you if the problem is in the parsing or somewhere else.

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


Active Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by franktroy » Tue Aug 27, 2019 12:43 am

Thank you for the help letxobnav. But I am sorry to say the code you provided did not help. No output was captured. The hunt goes on, I probably have something in a configuration somewhere the system does not like.

Newbie

Posts

Joined
Sun Aug 18, 2019 5:32 pm

Post by letxobnav » Tue Aug 27, 2019 8:17 am

if there is no output it means that parsing gives no result, check your class id's.
you could extend the debug info like below:

Code: Select all

					if ($rate_response || $intl_rate_response) {
						if ($this->config->get('shipping_usps_debug')) $this->log->write("USPS DATA 1: RATE RESPONSE");
						if ($address['iso_code_2'] == 'US') {
							if ($this->config->get('shipping_usps_debug')) $this->log->write("USPS DATA: US ISO");
							$allowed = array(0, 1, 2, 3, 4, 5, 6, 7, 12, 13, 16, 17, 18, 19, 22, 23, 25, 27, 28);

							$package = $rate_response->getElementsByTagName('Package')->item(0);

							$postages = $package->getElementsByTagName('Postage');

							if ($postages->length) {
								if ($this->config->get('shipping_usps_debug')) $this->log->write("USPS DATA 2: POSTAGES");
								foreach ($postages as $postage) {
									$classid = $postage->getAttribute('CLASSID');
									if ($this->config->get('shipping_usps_debug')) $this->log->write("USPS DATA 3: CLASSID: ".$classid);
									if (in_array($classid, $allowed)) {
										if ($this->config->get('shipping_usps_debug')) $this->log->write("USPS DATA 4: CLASSID: ".$classid." ALLOWED");
										if ($classid == '0') {
											if ($this->config->get('shipping_usps_debug')) $this->log->write("USPS DATA 5: CLASSID: 0");
											$mailservice = $postage->getElementsByTagName('MailService')->item(0)->nodeValue;

											foreach ($firstclasses as $k => $firstclass)  {
												if ($firstclass == $mailservice) {
													$classid = $classid . $k;
													break;
												}
											}
											if ($this->config->get('shipping_usps_debug')) $this->log->write("USPS DATA 6: FIRST CLASS: ".$classid);
											if (($this->config->get('shipping_usps_domestic_' . $classid))) {
												$cost = $postage->getElementsByTagName('Rate')->item(0)->nodeValue;
												if ($this->config->get('shipping_usps_debug')) $this->log->write("USPS DATA 7: DOMESTIC CLASSID: ".$classid." SET, QUOTE");
												$quote_data[$classid] = array(
													'code'         => 'usps.' . $classid,
													'title'        => $postage->getElementsByTagName('MailService')->item(0)->nodeValue,
													'cost'         => $this->currency->convert($cost, 'USD', $this->config->get('config_currency')),
													'tax_class_id' => $this->config->get('shipping_usps_tax_class_id'),
													'text'         => $this->currency->format($this->tax->calculate($this->currency->convert($cost, 'USD', $this->session->data['currency']), $this->config->get('shipping_usps_tax_class_id'), $this->config->get('config_tax')), $this->session->data['currency'], 1.0000000)
												);
											}

										} elseif ($this->config->get('shipping_usps_domestic_' . $classid)) {
											if ($this->config->get('shipping_usps_debug')) $this->log->write("USPS DATA 8: DOMESTIC CLASSID: ".$classid." SET QUOTE");
											$cost = $postage->getElementsByTagName('Rate')->item(0)->nodeValue;

											$quote_data[$classid] = array(
												'code'         => 'usps.' . $classid,
												'title'        => $postage->getElementsByTagName('MailService')->item(0)->nodeValue,
												'cost'         => $this->currency->convert($cost, 'USD', $this->config->get('config_currency')),
												'tax_class_id' => $this->config->get('shipping_usps_tax_class_id'),
												'text'         => $this->currency->format($this->tax->calculate($this->currency->convert($cost, 'USD', $this->session->data['currency']), $this->config->get('shipping_usps_tax_class_id'), $this->config->get('config_tax')), $this->session->data['currency'], 1.0000000)
											);
										}
									}
								}
							} else {
extra debug entries are added with:

Code: Select all

if ($this->config->get('shipping_usps_debug')) $this->log->write("USPS DATA 1: RATE RESPONSE");

Code: Select all

if ($this->config->get('shipping_usps_debug')) $this->log->write("USPS DATA 2: POSTAGES");
etc.

so you can see why the module does not accept the received quotes from usps.
These will go into your OC error log if debug is enabled.

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


Active Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by franktroy » Sun Sep 01, 2019 6:59 pm

Opencart support provided a resolution to this problem, maybe it will help others.

Seems, to be Opencart UPS shipping problem... I hope it would be fixed in next Opencart version.
To fix it, please, follow next steps:
1. Enter your website file directory through FTP or CPanel
2. Find the file catalog/model/extension/shipping/ups.php
3. In this file you should find this line: if ($this->config->get('ups_' . strtolower($this->config->get('shipping_ups_origin')) . '_' . $code)) {
4. Replace it with this one: if ($this->config->get('shipping_ups_' . strtolower($this->config->get('shipping_ups_origin')) . '_' . $code)) {

Newbie

Posts

Joined
Sun Aug 18, 2019 5:32 pm

Post by letxobnav » Mon Sep 02, 2019 9:41 am

thought we were discussing usps.

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


Active Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by franktroy » Mon Sep 09, 2019 11:11 pm

Yes that was the fix for UPS. I still have the issue with USPS showing ( Warning: No Shipping options are available. Please contact us for assistance!) when the UPS Module is turned off.

Newbie

Posts

Joined
Sun Aug 18, 2019 5:32 pm
Who is online

Users browsing this forum: No registered users and 12 guests