Re: USPS Shipping (RESTful) (USPSr)
Quote:
Originally Posted by
carlwhat
never modify core code when you do not have to.
try and play along.
create an
auto-loading observer. also
this post.
that you want to observer
this notifier.
if you have successfully gotten that far, you can then add your code as follows:
PHP Code:
public function updateNotifyShippingUspsUpdateStatus(&$class)
{
$chk_cart = 0;
$chk_cart += $_SESSION['cart']->in_cart_check('master_categories_id', '4854');
$chk_cart += $_SESSION['cart']->in_cart_check('products_id', '4');
if ($chk_cart > 0) {
$class->enabled = false;
}
}
best.
^^ Effectively this. Because by modifying my core code, you'll just have the work erased when a new version comes out (right now working on getting First Class Mail Letter to work).
You can do this by targeting the NOTIFY_SHIPPING_USPS_CHECK_CART notifier on line 352 and having the $contents_ok variable return (boolean) false. This will in effect disable the module if triggered. I can probably write up an observer class sometime later after some testing.
Re: USPS Shipping (RESTful) (USPSr)
Thanks, I am not a programmer so I will have to dig into this. I understand the basics but not sure how to implement it yet.
If you can provide an observer class file that I can use then that would be great.
Thank you
Re: USPS Shipping (RESTful) (USPSr)
I managed to get this working. Thank you for the tips. It is a much better solution.
Re: USPS Shipping (RESTful) (USPSr)
Quote:
Originally Posted by
n8pbm
I managed to get this working. Thank you for the tips. It is a much better solution.
Congrats. There is like a 5% chance somewhere down the line I might add this as an option like I did with the original Media Mail disabler. I just fear that I'm making the options screen a bit too long. At this rate, I might have to consider a different layout. Additionally, I'll add in a sample observer class next run through
Re: USPS Shipping (RESTful) (USPSr)
International shipping oddity: when I'm shipping a 4 pound package to Canada, I get both Priority Mail International and Priority Mail Express International as options, but if I ship an 8 pound package, my only option is Priority Mail Express International.
I notice flat rate options stop at 4 pounds for International, but ship by weight goes to 70. Is there an API setting that needs adjusting?
Re: USPS Shipping (RESTful) (USPSr)
Quote:
Originally Posted by
swguy
International shipping oddity: when I'm shipping a 4 pound package to Canada, I get both Priority Mail International and Priority Mail Express International as options, but if I ship an 8 pound package, my only option is Priority Mail Express International.
I notice flat rate options stop at 4 pounds for International, but ship by weight goes to 70. Is there an API setting that needs adjusting?
That is odd. I can see the API return "Priority Mail International Machinable ISC Single-piece" in both of those but not sure why the script isn't pulling both. Can you generate a log?
Re: USPS Shipping (RESTful) (USPSr)
I have both logs that I will email you.
One possible clue: if you turn off insurance, you get regular Priority Mail International.
Re: USPS Shipping (RESTful) (USPSr)
Quote:
Originally Posted by
swguy
I have both logs that I will email you.
One possible clue: if you turn off insurance, you get regular Priority Mail International.
Yup that is a limitation of the USPS API. It will not return services if it doesn't receive a valid config. In this case, setting the value of the order at (I think) $675 for Canada bound shipments will cause it to not return certain shipping methods.
Re: USPS Shipping (RESTful) (USPSr)
zc 210, php 8.2
Anyone feels that this plug-in is very slow? Under the OPC guest checkout page, after I enabled this USPSr plug-in, every time when I change the shipping method OR payment method, it will cycle/load for about 4s. If I disable this USPSr plug-in, it will be reduced to about 0.5s (normal). I tried both encapsulated and non-encapsulated USPSr, no difference.
My testing site enabled OPC 2.5.4, UPSrest 1.3.7, FedExrest 1.3.4 and localsalestax 3.0.1. I disabled the plug-in one by one and I narrowed the issue down to the USPSr.
Re: USPS Shipping (RESTful) (USPSr)
Quote:
Originally Posted by
njcyx
zc 210, php 8.2
Anyone feels that this plug-in is very slow? Under the OPC guest checkout page, after I enabled this USPSr plug-in, every time when I change the shipping method OR payment method, it will cycle/load for about 4s. If I disable this USPSr plug-in, it will be reduced to about 0.5s (normal). I tried both encapsulated and non-encapsulated USPSr, no difference.
My testing site enabled OPC 2.5.4, UPSrest 1.3.7, FedExrest 1.3.4 and localsalestax 3.0.1. I disabled the plug-in one by one and I narrowed the issue down to the USPSr.
Possibly because it's doing a full pull of the rates on each step. If you head back to shipping confirm and change the method, it does a full processing and pull of the rates. If you go back to change your payment method, it still does another full pull or all the rates with another call to the USPS server.
I suppose I can try to make a cache of sorts but right now it can't be helped.
I have also found a similar slow down.
Re: USPS Shipping (RESTful) (USPSr)
Quote:
Originally Posted by
retched
Possibly because it's doing a full pull of the rates on each step. If you head back to shipping confirm and change the method, it does a full processing and pull of the rates. If you go back to change your payment method, it still does another full pull or all the rates with another call to the USPS server.
I suppose I can try to make a cache of sorts but right now it can't be helped.
I have also found a similar slow down.
Thanks for your reply. If I'm right, the early version of OPC also has this type of issue. So every time when I changed the selection, it will get a new quote, which will slow down the page. However, the newer/current OPC has solved this issue, at least there is almost no delay for UPS and fedex now.
Hopefully it will give you some ideas. Anyway, the old USPS plug-in still works for now.
Re: USPS Shipping (RESTful) (USPSr)
I have to figure out what the module is doing between the new USPS and the OPC friendly one in that case. I'm willing to bet it's something small that I overlooked between the two.
1 Attachment(s)
Re: USPS Shipping (RESTful) (USPSr)
For anyone needing USPSRestful 1.2.0 on PHP 5.6, I converted it for an older Zen Cart site I'm upgrading to 2.1.0. This ensures it works before the USPS cutoff if the upgrade isn't complete. Attachment 20983