Page 8 of 15

Re: [VQMod] USPS API Update (Latest API Update)

Posted: Tue Apr 07, 2015 1:15 am
by CharmersVine99
That is correct. When I go to admin interface > extensions > shipping > United postal service shipping (the one pre-installed w/ OC2) > edit
My options for domestic services listed are:
First-Class Mail Parcel
First-Class Mail Large Envelope
First-Class Mail Letter
First-Class Mail Postcards
Priority Mail
Express Mail Hold for Pickup
Express Mail
Parcel Post
Bound Printed Matter
Media Mail
Library
First-Class Postcard Stamped
Express Mail Flat-Rate Envelope
Priority Mail Flat-Rate Envelope
Priority Mail Regular Flat-Rate Box
Priority Mail Keys and IDs
First-Class Keys and IDs
Priority Mail Flat-Rate Large Box
Express Mail Sunday/Holiday
Express Mail Flat-Rate Envelope Sunday/Holiday
Express Mail Flat-Rate Envelope Hold For Pickup
Priority Mail Small Flat-Rate Box
The Regional boxes that I see it pulling in the log file is not listed. Are there any other settings I may be missing?
Thank you.

Re: [VQMod] USPS API Update (Latest API Update)

Posted: Tue Apr 07, 2015 2:57 am
by CharmersVine99
Issue Fixed! :)

I didn't realize that admin/...... was hard coded into the vqmod xml file.
I changed my admin folder name for security. So I just did a find all "admin/" and replace with "[myadminfoldername]/"
And now it works like a charm.
Thanks!

Re: [VQMod] USPS API Update (Latest API Update)

Posted: Tue Apr 07, 2015 4:12 am
by JeffroDH
Thanks for getting back with me! I'll see about updating the files so that it uses a dynamic reference to the administration section, and at least include that information in a README file.

You had me scratching my head.

Re: [VQMod] USPS API Update (Latest API Update)

Posted: Tue Apr 07, 2015 8:57 am
by CharmersVine99
Thanks for the extension.

You know what would be great though is a way to just push a button to generate a shipping label :)

Re: [VQMod] USPS API Update (Latest API Update)

Posted: Tue Apr 07, 2015 11:07 am
by JeffroDH
That would be awesome. Last I checked USPS had licensed that out to some fairly big companies. If have to incorporate Pitney Bowes or stamps.com or something.

Re: [VQMod] USPS API Update (Latest API Update)

Posted: Wed Apr 22, 2015 5:29 am
by pixelmaker
Hello,
I just bought this extension and it installed just fine but displays all of the options instead of just the correct options. It also is sorting by the highest price on top to lowest price on the bottom instead of the other way around.

It's basically not picking the correct shipping option.. just displaying all the options that I've made active.

Please let me know how I can fix this ASAP!

My site: hoolono.com

My Opencart: 1.5.5.1

Thank you!! - Ken Elkins

Re: [VQMod] USPS API Update (Latest API Update)

Posted: Tue Apr 28, 2015 11:53 pm
by JeffroDH
Ken, I sent you a PM in response to your PM.

You're not getting a response from USPS because your username is incorrect. Double check your info from usps and correct it in the admin panel.

Also, there is an issue with your version of /catalog/model/shipping/USPS.php that is causing the mod to abort. Again, refer to the instructions I sent in the PM.

Re: [VQMod] USPS API Update (Latest API Update)

Posted: Wed May 13, 2015 4:47 am
by ddcarobs
Hi Jeff,
I installed this with no problem. It added all the new rates. My issues is with international shipping. When I put in a Canada zip to estimate shipping it says "No shipping options are available" I will attach the error logs from Opencart below, but where do i get the error logs from the xml?

Re: [VQMod] USPS API Update (Latest API Update)

Posted: Thu May 14, 2015 6:16 am
by JeffroDH
You may not have any shipping options selected that are international, but I'll need the logs to be sure. The VQMod logs are in /vqmod/logs, and are organized by date. If there is a problem, the same block of code will be repeated with different timestamps. I'll only need to see one.

Also, with the OC error logs, I need the full text rather than a screenshot. The view you captured only shows about %30 of the log. You can copy the text directly from the window.

Re: [VQMod] USPS API Update (Latest API Update)

Posted: Mon May 25, 2015 6:53 am
by shamanicconnection
JeffroDH,

Will we have a new update ready for the postage changes that take effect next Sunday, 5/31? I can't find any reference on the board.

Thanks
Debbie

Re: [VQMod] USPS API Update (Latest API Update)

Posted: Mon May 25, 2015 10:54 am
by JeffroDH
Thanks for your inquiry. I've gone over the changes, and as far as I can tell, no update will be necessary.

I'll be running tests on their test server this week, and if something comes up, an update will be published. (And I'll make sure that OC sends an email notification to those with a license.)

Re: [VQMod] USPS API Update (Latest API Update)

Posted: Thu May 28, 2015 12:39 pm
by shamanicconnection
Thanks.

Re: [VQMod] USPS API Update (Latest API Update)

Posted: Thu Jun 04, 2015 1:25 pm
by datasupply
It appears that the mod is having an issue with International Shipping to Canada (Canada is the only country I've tested as it's the only country the client ships to). Domestics seems to be fine, but international breaks. I'm fairly sure it's due to the changes USPS made on May 31, 2015.

Can you test this in your mod and let me know what info you need to help troubleshoot it.

Thanks

Re: [VQMod] USPS API Update (Latest API Update)

Posted: Fri Jun 05, 2015 5:48 am
by sistawig
Hello,

I bought your extension but whenever i try to access canada's address to get rates it is giving. This error started from may 31,2015 that is the reason why i thought it was api issue so bought your extension.

United Parcel Service
UPS Standard - $25.06

United States Postal Service
(Estimated Time: ) - $0.00


Opencart Error Logs(Repeated multiple times):

2015-06-04 16:26:24 - PHP Notice: Trying to get property of non-object in /home/sistawig/public_html/catalog/model/shipping/usps.php on line 428 url: /index.php?route=checkout/shipping/quote referal: http://www.sistawigs.com/index.php?route=checkout/cart Array
(
[country_id] => 38
[zone_id] => 610
[postcode] => N0M0C2
)



The USPS extension was already installed so i just dropped your xml file in vqmod/xml folder. I see nothing changed or no place to install your extension.

please help with this installation.

Re: [VQMod] USPS API Update (Latest API Update)

Posted: Fri Jun 05, 2015 6:17 am
by JeffroDH
I need to know which version of OC you're using, as well as a copy of the VQMod error logs.

Also, it would be helpful to know if the php error began on May 31 as well, or if it began after you installed my VQmod.

Re: [VQMod] USPS API Update (Latest API Update)

Posted: Fri Jun 05, 2015 7:32 am
by henkster
I have the same issue. Started on May 31st.

USPS Priority Mail to Canada now requires the origin zip and this isn't being passed in the USPS shipping extension. I've two site running v1.5.1.3 and v2.0.2.0, both are affected in the same way.

There are no errors in the vqmod error logs but the main error log has 2 errors in it:
2015-06-04 19:33:02 - PHP Notice: Trying to get property of non-object in /home/xxxxx/public_html/system/modification/catalog/model/shipping/usps.php on line 441
2015-06-04 19:33:02 - PHP Notice: Trying to get property of non-object in /home/xxxxx/public_html/system/modification/catalog/model/shipping/usps.php on line 444

Re: [VQMod] USPS API Update (Latest API Update)

Posted: Fri Jun 05, 2015 1:06 pm
by henkster
Right, I've got a fix. In catalog/model/shipping/usps.php two additional fields are needed in the API request

After (line 282):

Code: Select all

				if (isset($country[$address['iso_code_2']])) {
					$xml  = '<IntlRateV2Request USERID="' . $this->config->get('usps_priority_user_id') . '">';
insert

Code: Select all

					$xml .=	' <Revision>2</Revision>';
and after (line 305ish):

Code: Select all

$xml .= '		<Girth>' . $this->config->get('usps_girth') . '</Girth>';
insert

Code: Select all

$xml .=	'		<OriginZip>' . substr($this->config->get('usps_postcode'), 0, 5) . '</OriginZip>';
Works a treat for me.

Re: [VQMod] USPS API Update (Latest API Update)

Posted: Fri Jun 05, 2015 1:31 pm
by hcamelion
We came across an issue with the zip not being passed. I did not have time to read recent posts in this thread but it seems some people (henkster) are already responding to this issue. We fixed it this way with a new vqmod as follows but we also added a fix to check for a service error which I think should be added because it was causing an empty shipping method for $0.

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<modification>
    <id>USPS International Rates Shipping Price Calculation fix</id>
    <version>1.0.0</version>
    <vqmver>1.0.0</vqmver>
    <author>Weismann Web</author>
    <info>Fixes to USPS International Rates Calculation as per Revision 2</info>
    <file name="catalog/model/shipping/usps.php" error="log">
    	<operation>
    		<search position="after"><![CDATA[$xml  = '<IntlRateV2Request USERID="' . $this->config->get('usps_user_id') . '">';]]></search>
    		<add><![CDATA[$xml .=	'	<Revision>2</Revision>';]]></add>
    	</operation>
    	<operation>
    		<search position="replace"><![CDATA[$xml .=	'		  <POBoxFlag>N</POBoxFlag>';]]></search>
    		<add><![CDATA[$xml .=	'		  <POBoxFlag>Y</POBoxFlag>';]]></add>
    	</operation>
    	<operation>
    		<search position="before"><![CDATA[$xml .= '		<CommercialFlag>N</CommercialFlag>';]]></search>
    		<add><![CDATA[$xml .=	'		<OriginZip>' . substr($this->config->get('usps_postcode'), 0, 5) . '</OriginZip>';]]></add>
    	</operation>
    	<operation>
    		<search position="after"><![CDATA[$xml .= '		<CommercialFlag>N</CommercialFlag>';]]></search>
    		<add><![CDATA[$xml .= '		<AcceptanceDateTime>'.date('c').'</AcceptanceDateTime>';
                    $xml .=	'		<DestinationPostalCode>' . $postcode . '</DestinationPostalCode>';]]></add>
    	</operation>
    	<operation>
    		<search position="after"><![CDATA[foreach ($services as $service) {]]></search>
    		<add><![CDATA[$error = $service->getElementsByTagName('ServiceError')->item(0);
                if ($error) {
                	$method_data = array(
                		'code'       => 'usps',
                		'title'      => $this->language->get('text_title'),
                		'quote'      => $quote_data,
                		'sort_order' => $this->config->get('usps_sort_order'),
                		'error'      => $error->getElementsByTagName('Description')->item(0)->nodeValue
                	);
                    break;
                }]]></add>
    	</operation>
    </file>
</modification>

Re: [VQMod] USPS API Update (Latest API Update)

Posted: Fri Jun 05, 2015 2:05 pm
by JeffroDH
hcamelion wrote:We came across an issue with the zip not being passed. I did not have time to read recent posts in this thread but it seems some people (henkster) are already responding to this issue. We fixed it this way with a new vqmod as follows but we also added a fix to check for a service error which I think should be added because it was causing an empty shipping method for $0.

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<modification>
    <id>USPS International Rates Shipping Price Calculation fix</id>
    <version>1.0.0</version>
    <vqmver>1.0.0</vqmver>
    <author>Weismann Web</author>
    <info>Fixes to USPS International Rates Calculation as per Revision 2</info>
    <file name="catalog/model/shipping/usps.php" error="log">
    	<operation>
    		<search position="after"><![CDATA[$xml  = '<IntlRateV2Request USERID="' . $this->config->get('usps_user_id') . '">';]]></search>
    		<add><![CDATA[$xml .=	'	<Revision>2</Revision>';]]></add>
    	</operation>
    	<operation>
    		<search position="replace"><![CDATA[$xml .=	'		  <POBoxFlag>N</POBoxFlag>';]]></search>
    		<add><![CDATA[$xml .=	'		  <POBoxFlag>Y</POBoxFlag>';]]></add>
    	</operation>
    	<operation>
    		<search position="before"><![CDATA[$xml .= '		<CommercialFlag>N</CommercialFlag>';]]></search>
    		<add><![CDATA[$xml .=	'		<OriginZip>' . substr($this->config->get('usps_postcode'), 0, 5) . '</OriginZip>';]]></add>
    	</operation>
    	<operation>
    		<search position="after"><![CDATA[$xml .= '		<CommercialFlag>N</CommercialFlag>';]]></search>
    		<add><![CDATA[$xml .= '		<AcceptanceDateTime>'.date('c').'</AcceptanceDateTime>';
                    $xml .=	'		<DestinationPostalCode>' . $postcode . '</DestinationPostalCode>';]]></add>
    	</operation>
    	<operation>
    		<search position="after"><![CDATA[foreach ($services as $service) {]]></search>
    		<add><![CDATA[$error = $service->getElementsByTagName('ServiceError')->item(0);
                if ($error) {
                	$method_data = array(
                		'code'       => 'usps',
                		'title'      => $this->language->get('text_title'),
                		'quote'      => $quote_data,
                		'sort_order' => $this->config->get('usps_sort_order'),
                		'error'      => $error->getElementsByTagName('Description')->item(0)->nodeValue
                	);
                    break;
                }]]></add>
    	</operation>
    </file>
</modification>
Well, it's rather embarrassing, as the developer to miss something like that in the release notes. I've got the ZIP code issue sorted, and will be pushing a new release as soon as it's tested on 1.5.x and 2.0. I'll have a look at the code you posted and see about adding an implementation of it into the mod for error checking.

EDIT: After looking at this a bit, I don't think the error checking code is necessary... If the request is made properly, then there will be no service error, and no 0.00 postage element. Filing this away for further thought when it's not 1AM.

Re: [VQMod] USPS API Update (Latest API Update)

Posted: Fri Jun 05, 2015 2:30 pm
by hcamelion
RE: Also, is anyone else running into an error involving the <CommercialFlag> or <CommercialPlusFlag> tag? It's popping as an invalid tag on my installation. Odd, since it's in the documentation.

Maybe you are not setting the right revision/api version? That is just off the cuff.