I cannot get the USPS shipping choice to appear.
I have applied Qphoric's patch which solved the same error that jerad had in his initial post, but after applying the patch I now have the same error that jerad had in his second post. My error is:
2010-01-07 12:33:58 - PHP Notice: Undefined index: value in /PATH_TO_STORE/catalog/model/shipping/usps.php(348) : eval()'d code on line 1
(I've shortened the actual store path here in this forum post to 'PATH_TO_STORE')
If I enable USPS and Qphoric's FedEx XML extensions, no shipping options appear and I get the error above. If I disable USPS and enable Qphoric's FedEx XML extension, the FedEx choice appears and works great. If I enable USPS and disable Qphoric's FedEx, once again no shipping options appear.
This is on a server I manage myself and I will be surprised if it's a server configuration issue, as it's well maintained, up-to-date and I've got about 100 domains on it. Any ideas?
I have applied Qphoric's patch which solved the same error that jerad had in his initial post, but after applying the patch I now have the same error that jerad had in his second post. My error is:
2010-01-07 12:33:58 - PHP Notice: Undefined index: value in /PATH_TO_STORE/catalog/model/shipping/usps.php(348) : eval()'d code on line 1
(I've shortened the actual store path here in this forum post to 'PATH_TO_STORE')
If I enable USPS and Qphoric's FedEx XML extensions, no shipping options appear and I get the error above. If I disable USPS and enable Qphoric's FedEx XML extension, the FedEx choice appears and works great. If I enable USPS and disable Qphoric's FedEx, once again no shipping options appear.
This is on a server I manage myself and I will be surprised if it's a server configuration issue, as it's well maintained, up-to-date and I've got about 100 domains on it. Any ideas?
Follow up to my last post:
I added the @ sign before this line in Qphoric's patched code on line 346:
so it now looks like this:
Still getting that error I was having showing in the error logs of course, but now the USPS shipping option appears as expected and seems to be working correctly at first glance.
I'm not exactly handy with PHP, so don't know if this is a bad fix. Any thoughts?
I added the @ sign before this line in Qphoric's patched code on line 346:
Code: Select all
$php_stmt .= '[$xml_elem[\'tag\']] = $xml_elem[\'value\'];';
Code: Select all
@$php_stmt .= '[$xml_elem[\'tag\']] = $xml_elem[\'value\'];';
I'm not exactly handy with PHP, so don't know if this is a bad fix. Any thoughts?
This error occurs for me in 1.4.0 as well. Adding the @ symbol before
does not suppress the error. Also, I can get rates when using Guest Checkout, but not when checking out with a customer account. Anyone know of a fix?
Edit: After further testing, the error occurs when the total weight limit is over 4 pounds. I assume this is because of a 4 pound weight limit on something (e.g. international priority flat-rate envelopes). This occurs even when no international methods of shipping are checked.
Code: Select all
$php_stmt .= '[$xml_elem[\'tag\']] = $xml_elem[\'value\'];';
Edit: After further testing, the error occurs when the total weight limit is over 4 pounds. I assume this is because of a 4 pound weight limit on something (e.g. international priority flat-rate envelopes). This occurs even when no international methods of shipping are checked.
I think I figured out why this error is occurring. It's related to the issue described here:
http://forum.opencart.com/viewtopic.php?f=31&t=8427
Since the USPS module was interpreting ounces as pounds, anything over "4 pounds" was actually being interpreted as 16 times its value. So "5 pounds" was 5*16 = 80 pounds, which is over the 70 pound weight limit for USPS.
The change suggested by Qphoria in that thread has fixed the problem for me.
http://forum.opencart.com/viewtopic.php?f=31&t=8427
Since the USPS module was interpreting ounces as pounds, anything over "4 pounds" was actually being interpreted as 16 times its value. So "5 pounds" was 5*16 = 80 pounds, which is over the 70 pound weight limit for USPS.
The change suggested by Qphoria in that thread has fixed the problem for me.
Hiya - I see the [RESOLVED] tag in the subject head, but I still have issues with USPS. Working with 1.4.0, I worked through each of these issues and edits in this thread until I found Qphoria's edited v1.3.4 file. That got me most of the way...
With Geo Zone set to the default 'All Zones' in the USPS admin, the checkout now shows International USPS shipping rates. It does not show domestic rates. Instead, I receive these errors:
Warning: Missing argument 2 for ModelShippingUsps::getQuote(), called in /.../guest_step_2.php on line 42 and defined in /.../usps.php on line 3
Notice: Undefined variable: zone_id in /.../usps.php on line 7
I tried creating a 'United States' zone and selecting that in the USPS admin, but that results in no shipping options at all in the checkout.
Is this a bug, or have I failed in some way to set my Zones or Geo Zones correctly? The documentation is not entirely clear about the dependencies of zones and shipping.
If it's a bug, is it expected to be fixed in 1.4.1? Or should I invest in Qphoria's USPS mod?
Ivan
(New guy evaluating OpenCart)
With Geo Zone set to the default 'All Zones' in the USPS admin, the checkout now shows International USPS shipping rates. It does not show domestic rates. Instead, I receive these errors:
Warning: Missing argument 2 for ModelShippingUsps::getQuote(), called in /.../guest_step_2.php on line 42 and defined in /.../usps.php on line 3
Notice: Undefined variable: zone_id in /.../usps.php on line 7
I tried creating a 'United States' zone and selecting that in the USPS admin, but that results in no shipping options at all in the checkout.
Is this a bug, or have I failed in some way to set my Zones or Geo Zones correctly? The documentation is not entirely clear about the dependencies of zones and shipping.
If it's a bug, is it expected to be fixed in 1.4.1? Or should I invest in Qphoria's USPS mod?
Ivan
(New guy evaluating OpenCart)
Thank you! I figured that there might be some risk of incompatibility with 1.4.0, but frankly, I got further with the 1.3.4 patch than without.
For the most part, I am very much impressed with OpenCart and its community, and would like to install it for a client, but without USPS support I got nuthin'.
Ivan
(New guy evaluating OpenCart)
For the most part, I am very much impressed with OpenCart and its community, and would like to install it for a client, but without USPS support I got nuthin'.
Ivan
(New guy evaluating OpenCart)
That's fine, and I'm not opposed to paying you for the added functionality if it comes to that. I do think that the basic feature set should at least be made functional as advertised, so it can be evaluated on its own merits before adopting add-ons. I am eager to see what the 1.4.1 update brings.
Ivan
Ivan
Thank you for jumping on that so quickly.
Unfortunately, I'm still getting this error:
Notice: Undefined index: value in /.../usps.php(386) : eval()'d code on line 1
I see this error in both Daniel's version and your edit. I take the error to mean that the problem lies in this subroutine:
As near as I can tell from reading about the 'Undefined index' notice, there's an undeclared variable being called from the evaluated statement, so I guess the problem lies somewhere in the concatenation of php_stmt.
Anyhow, I appreciate the time you've taken to help me, esp. since you're basically competing with your own commercial offering. I'll probably keep tinkering a bit, but I guess at some point I'll either wait and see what 1.4.1 offers or buy your plug-in.
Ivan
Unfortunately, I'm still getting this error:
Notice: Undefined index: value in /.../usps.php(386) : eval()'d code on line 1
I see this error in both Daniel's version and your edit. I take the error to mean that the problem lies in this subroutine:
Code: Select all
$data = array();
$level = array();
foreach ($value as $xml_elem) {
if ($xml_elem['type'] == 'open') {
if (array_key_exists('attributes', $xml_elem)) {
foreach (array_values($xml_elem['attributes']) as $attribute) {
$level[$xml_elem['level']] = $attribute;
}
} else {
$level[$xml_elem['level']] = $xml_elem['tag'];
}
}
if ($xml_elem['type'] == 'complete') {
$start_level = 1;
$php_stmt = '$data';
while ($start_level < $xml_elem['level']) {
$php_stmt .= '[$level[' . $start_level . ']]';
$start_level++;
}
$php_stmt .= '[$xml_elem[\'tag\']] = $xml_elem[\'value\'];';
eval($php_stmt);
}
}
Anyhow, I appreciate the time you've taken to help me, esp. since you're basically competing with your own commercial offering. I'll probably keep tinkering a bit, but I guess at some point I'll either wait and see what 1.4.1 offers or buy your plug-in.
Ivan
I saw the earlier post about adding the @ symbol. I read up on that, and it seems that all it does is suppress PHP Notices? Just a symptomatic fix, no?
I finally sussed this out, though it took a bunch of hacking. The 'Undefined index' Notice stemmed from the routine I posted above, so I echo'd all that routine's variables until I found something that made sense (I've never used PHP, so I haven't got a proper debugger yet). The routine parses a series of delimited strings that are provided by USPS. It turned out that USPS was returning an error notification half way through the series, which actually broke the routine, because it has no error checking. The USPS error had to do with incorrect dimensions (but I forgot to document the exact message, grrr).
It appeared that the error was due to my settings in Extensions->Shipping->USPS. I had set Size: Large, Machinable: No, and entered values for Dimensions and Girth (I assumed that those fields provided default values). I reset Size:Normal and Machinable:Yes, cleared out my Dimensions and Girth.
And that fixed my problem. I can now see my USPS shipping options.
Unfortunately, now I can't duplicate the problem. After I got it working, I set USPS back to the 'bad' values, and it still works. All I can guess now is that maybe I entered an illegal character in one of the fields?
Ivan
I finally sussed this out, though it took a bunch of hacking. The 'Undefined index' Notice stemmed from the routine I posted above, so I echo'd all that routine's variables until I found something that made sense (I've never used PHP, so I haven't got a proper debugger yet). The routine parses a series of delimited strings that are provided by USPS. It turned out that USPS was returning an error notification half way through the series, which actually broke the routine, because it has no error checking. The USPS error had to do with incorrect dimensions (but I forgot to document the exact message, grrr).
It appeared that the error was due to my settings in Extensions->Shipping->USPS. I had set Size: Large, Machinable: No, and entered values for Dimensions and Girth (I assumed that those fields provided default values). I reset Size:Normal and Machinable:Yes, cleared out my Dimensions and Girth.
And that fixed my problem. I can now see my USPS shipping options.
Unfortunately, now I can't duplicate the problem. After I got it working, I set USPS back to the 'bad' values, and it still works. All I can guess now is that maybe I entered an illegal character in one of the fields?
Ivan
Attachments
Picture 4.png (17.39 KiB) Viewed 9111 times
Hello,
I have applied the USPS patch from Qphoria (thx!) and have called in to move the USPS acct to the production server.
Before I did this, I would get Shipping info required (?) and authorization failure. Now, I am getting encoding errors in Firefox. Chrome says "Webpage not available" gives this error:
Setting>local and tried both pounds and ounces
extensions >module >usps> dimensions/Machinable and even set my own geo zone (none work)
placing @ in front of $php_stmt in module/shipping/usps.php
When I uninstalled usps and enabled free shipping it went along nicely. Please help me with setting up USPS on my site. Is there anything I'm missing? I can provide more info if needed.
I have applied the USPS patch from Qphoria (thx!) and have called in to move the USPS acct to the production server.
Before I did this, I would get Shipping info required (?) and authorization failure. Now, I am getting encoding errors in Firefox. Chrome says "Webpage not available" gives this error:
I checked the error log and am getting this:Error 330 (net::ERR_CONTENT_DECODING_FAILED): Unknown error.
I tried:- PHP Notice: Undefined index: value in /........./public_html/shop/catalog/model/shipping/usps.php(386) : eval()'d code on line 1
Setting>local and tried both pounds and ounces
extensions >module >usps> dimensions/Machinable and even set my own geo zone (none work)
placing @ in front of $php_stmt in module/shipping/usps.php
When I uninstalled usps and enabled free shipping it went along nicely. Please help me with setting up USPS on my site. Is there anything I'm missing? I can provide more info if needed.
The first error is due to an issue with some pages showing php errors while compression is enabled. This seems to be an OpenCart issue starting with 1.3.4. To get around it, edit your settings area and under the "Server" tab set the compression to 0
That will then show you the second error, which is something with the xml parsing. The patch I made doesn't touch that code and you would likely get that error without the patch. I'm not the strongest xml guy so I'm not fully sure where the problem is with that.
I will see if I can look into it.
Q
That will then show you the second error, which is something with the xml parsing. The patch I made doesn't touch that code and you would likely get that error without the patch. I'm not the strongest xml guy so I'm not fully sure where the problem is with that.
I will see if I can look into it.
Q
Hi Nocko,
I had the same two errors with USPS.
Error 1: Qphoria knows his stuff, and his instruction to disable PHP compression worked for me.
Error 2: I found that the 'Undefined index' error occurs when USPS returns an error message in the XML stream. OpenCart's USPS module hasn't yet got any error checking in its xml handling, so it has no way to display the real USPS error message. If you feel like poking around the code, you can at least find out what that is.
In file:
catalog/model/shipping/usps.php
Find line:
$php_stmt .= '[$xml_elem[\'tag\']] = $xml_elem[\'value\'];';
After it, add this line:
echo('<br />$xml_elem[\'value\'] = ' . $xml_elem['value'] . '<br />');
That will print all the data from the USPS xml stream straight to the screen when you go to checkout, one var per line. When I tried this, the USPS error was the last line printed. (Sorry, I know that's an inelegant debug method, but I just started out with this stuff.) This won't solve your problem, but it should provide you enough information to figure out why USPS is choking.
Ivan
I had the same two errors with USPS.
Error 1: Qphoria knows his stuff, and his instruction to disable PHP compression worked for me.
Error 2: I found that the 'Undefined index' error occurs when USPS returns an error message in the XML stream. OpenCart's USPS module hasn't yet got any error checking in its xml handling, so it has no way to display the real USPS error message. If you feel like poking around the code, you can at least find out what that is.
In file:
catalog/model/shipping/usps.php
Find line:
$php_stmt .= '[$xml_elem[\'tag\']] = $xml_elem[\'value\'];';
After it, add this line:
echo('<br />$xml_elem[\'value\'] = ' . $xml_elem['value'] . '<br />');
That will print all the data from the USPS xml stream straight to the screen when you go to checkout, one var per line. When I tried this, the USPS error was the last line printed. (Sorry, I know that's an inelegant debug method, but I just started out with this stuff.) This won't solve your problem, but it should provide you enough information to figure out why USPS is choking.
Ivan
The error I found actually lies in the loop that converts the delimited USPS data into an array. I'm still not entirely clear on this, but here's how I see it...
- The routine is looking for tag/value pairs.
- In the case of an error message from USPS, there's only a single value.
- There's no pair, so one variable goes undefined.
- The routine tries to use the undefined value, resulting in the 'Undefined index' notice.
I figure it needs a line that checks for non-standard data, and, if found, logs and/or displays it.
Ivan
- The routine is looking for tag/value pairs.
- In the case of an error message from USPS, there's only a single value.
- There's no pair, so one variable goes undefined.
- The routine tries to use the undefined value, resulting in the 'Undefined index' notice.
I figure it needs a line that checks for non-standard data, and, if found, logs and/or displays it.
Ivan
Qphoria, that worked great! After setting compression to 0, the page loaded and showed that the error was a missing zip code field I will have to make this field required.
icockrum, Thanks for the debug line! Turned out that I didn't need it.
You guys rock! Thanks!!!
icockrum, Thanks for the debug line! Turned out that I didn't need it.
You guys rock! Thanks!!!
Hi...
I'm trying to use the fix for the USPS module given in this thread, named: v134+v140_USPS_Fix.zip
I've downloaded this file several times, but when I try to uncompress it, I am getting "file corrupt" errors, and it will not unzip. I've tried several different downloads, and a couple of different unzip programs.
We are using OpenCart v1.3.4.
I'm seeing several posts on the subject of the USPS module, and perhaps I'm missing something. But it appears this is the file I need, if I can get it to work.
Your help is appreciated! Thanks.
Hartford
I'm trying to use the fix for the USPS module given in this thread, named: v134+v140_USPS_Fix.zip
I've downloaded this file several times, but when I try to uncompress it, I am getting "file corrupt" errors, and it will not unzip. I've tried several different downloads, and a couple of different unzip programs.
We are using OpenCart v1.3.4.
I'm seeing several posts on the subject of the USPS module, and perhaps I'm missing something. But it appears this is the file I need, if I can get it to work.
Your help is appreciated! Thanks.
Hartford
Who is online
Users browsing this forum: No registered users and 86 guests