Jump to content

Canada Post Shipping Module - 5 seconds delay


Recommended Posts

When customer logged in and one of the Canada Post's methods of shipping is default or was selected earlier, he/she experiences minimum 5 second delay to receive calculated shipping cost every time when he/she adds a new item into the shipping cart or updates the quantity of items on a cart.

 

It is frustrating.

 

Can anyone suggest me how to speed up the Canada Post module or implement Update Totals button to execute the Shipping Module code only after the pressing this button?

 

Thanks

Link to comment
Share on other sites

sorry, but I forgot to say that it was delay even if customer is not logged in, but the Canada post Shipping method is default one. I have modified the Canada Post source code and blocked unnecessary shipping cost calculation if the customer is not logged in.

 

If anyone needs the updated code I can share it.

 

Also I played with the "Shipping Estimation" module, but once the Customer estimated the shipping code and selected the canada post method , the next time when customer adds new items or update quantity totals on a cart the Canada Post Shipping Module tries to estimate the shipping cost and Customer hast to wait at least 5seconds.

 

It will be extremely grate to use the "Shipping Estimation" module together with the Canada Post module, but BLOCK all auto estimates. I would suggest to implement the "turn off auto estimates" parameter on "Shipping Estimation" module BO.

 

If anyone knows how to block auto shipping estimates when user adds a new item or updates the item quantity, but allow customer to press the Update button to estimate the shipping cost any time he/she needs ?

(other e-commerce solutions implemented this algorithm: magento, oscommerce, zend, opencart,...)

 

 

Thanks

Link to comment
Share on other sites

Hi Fabien,

 

Could you very kind to share your knowledge how to improve the calculation delay?

I would like to temporary change the code until the Canada Shipping module Or Estimation Module developers produce the new versions of their modules.

 

Thank You

Link to comment
Share on other sites

I am the developer of the Canada Post module, I will update it as soon as possible.

Currently, for each delivery service a request is made that return all delivery service. The key is to make only one webservice call and dispatch the result to each service. I'll do it as soon as I can.

Link to comment
Share on other sites

one more report :)

 

When the customer is not logged in, it means for me that the system does not know the shipping address and there is no necessity to estimate the shipping cost. But every time when the customer adds any item into the cart or update the quantity the system tries to calculate the shipping cost and as a result the default Canada Post Shipping method returns $0 in 5 second and the "Total products:" value stays the same without any change (attached file: report_cart.jpg).

The attached report_cart.jpg shows example when the user is not logged in and he/she tried to increase the Quantity by pressing "+" button. After the 5 second delay the Total was recalculated == 3, but the "Total products:" was not and stayed == 1, but should be == 3.

 

The shipping estimation should not be executed without the destination address.

 

I have commented 3 parts of the code inside of the Cart.php (function getOrderShippingCost) to block the shipping estimation in case if the destination address is unknown, but I am not sure that my changes are safe, because they affected the "Shipping Estimation" module by showing "Free" price all the time. I hope the Cart.php class will be fixed very soon.

 

Could you pass this report to the Cart.php developer ?

the modified Cart.php is attached to this post.

I have put the comment before each change:

// !!SB change!!

 

Regards

Sergei

version 1.4.6.2

Cart.php

post-296974-0-78675400-1323227703_thumb.jpg

Link to comment
Share on other sites

I am the developer of the Canada Post module, I will update it as soon as possible.

Currently, for each delivery service a request is made that return all delivery service. The key is to make only one webservice call and dispatch the result to each service. I'll do it as soon as I can.

 

According the Canada Post request schema, you can not select the method of shipping:

http://sellonline.canadapost.ca/DevelopersResources/protocolV3/eParcel.dtd

http://sellonline.canadapost.ca/DevelopersResources/protocolV3/HTTPInterface.html

 

The only one way to preselect the method of shipping is manually configure the account on the Canada Post website.

The Canada Post online returns only one method of payment (I preselected on CanadaPost website) and it takes 5second. - Too LONG.

 

Did you talk to "Shipping Estimation" module developer? Is it possible to implement the parameter (checkbox) "Turn Off auto shipping cost calculation" ? Did he agree to implement this possibility?

 

Regards,

Sergei

Link to comment
Share on other sites

For your first post, the problem is not coming from Cart.php, once Canada Post will be updated, you will not experience this issue again.

 

For the second post, yes I know. That's why I have to make only one request for all shipping method and then dispatch the result between the different delivery service. When the module will be updated, I think all your issue will be fix.

Link to comment
Share on other sites

Hi,

 

Here the last version (Canada Post 0.8) which I commited today on the SVN.

- I fixed the issue with fsockopen reported by sbordun

- I improved the loading time (I think it will take less than a second now, I'm working on how I can improve it).

- The module is compliant with multistore (in PS 1.5)

I still have to fix some cases of price calculation, I'll do it soon.

 

Could anyone test it and tell if it's working better ?

 

Best regards,

canadapost.zip

Link to comment
Share on other sites

I tried to test it on production, but the test was failed because the module refused to work properly on back-end.

 

Steps to reproduce the problem:

1) backed up the current code and database

2) uninstalled and deleted the v.0.5

3) installed the CanadaPOst v0.8

4) received exception during the module initialization: "Prestashop could not connect to Canada Post webservices", see the file attached:post-296974-0-29577500-1325127679_thumb.jpg

 

After this error I rolled back the version 0.5 and received the same error message for the v0.5. -> the CanadaPost module stopped working at all.

 

To fix my shop I was forced to rolled back my previous code and database to eliminate this error message.

 

It was the first and last time when I test something on production :)

Link to comment
Share on other sites

I installed it on top of the Canada post module v0.5 and it worked great.

Faster than before, there is still a bug.

 

If you put a package size (

Height

width and

Depth), then the Canada Post module doesn't work. If all the sizes are set to zero, then it works fine.

 

Great works guys and big thanks for thinking about us Canadian sellers.

Link to comment
Share on other sites

Hi sbordun,

 

I think your credentials are incorrect because, it works for me and for others merchants, could you send me the exact configuration you entered in the module by private messate to test it ?

 

Hi dragon123,

 

It's very weird I test it by setting empty height, width and depth on a product and I did'nt have this issue. I'll re test it again and keep you inform.

Link to comment
Share on other sites

Hi sbordun,

 

Could you send me your credentials to run some tests in local or could you try again by double checking your credentials ?

 

Hi dragon123,

 

I was just wondering, how do you manage to have these fields empty ? I tried to do it by the back office but it always set to 0. How did you do it ?

Link to comment
Share on other sites

I tried again and all works now... Don't know why it didn't work the 1st time.

All is good and very fast, along with the updated Shipping estimate module, now all is great and fast.

 

Great job and big thanks... now I need to fix my Taxes not showing in my AJAX cart...

Link to comment
Share on other sites

Quick question on this module.

 

The "Your Canada Post Account" is a "sell online" account with them right ?

 

I've tried everything else and that's my last option ! e-mail, username, customer number (all from the canadapost website), but I don't have a sell online account yet... arghh !

 

Thanks

Link to comment
Share on other sites

Does is support calculation for light packages of 500g or less ? These are very cheap and I use them alot on ebay to sell around the world, they are "light packet" and "small packet" (2kg or less worldwide or 1kg or less USA)

 

I run with fixed shipping rates in Canada or USA for now, but I would like to sell certain items oversea, not all, but light packets/small packet gives me that opportunity. Is there any way the shop can choose the cheapest shipping method automaticly in the estimation module ?

 

This module should work the exact same way it works on eBay to facilitate integration of the futur eBay Canada module.

 

You can choose different calculated shipping service for each items individualy for Canada, USA and worlwide OR put a fixed amount.

 

Ex : I sell blades, 100g package

- 1.81$ fixed for Canda (stamp)

- Calculated light package in US

- Calculated light package in Worldwide

 

Wish I could do the same for my shop

Link to comment
Share on other sites

  • 2 weeks later...

Hi,

 

Here the last version (Canada Post 0.8) which I commited today on the SVN.

- I fixed the issue with fsockopen reported by sbordun

- I improved the loading time (I think it will take less than a second now, I'm working on how I can improve it).

- The module is compliant with multistore (in PS 1.5)

I still have to fix some cases of price calculation, I'll do it soon.

 

Could anyone test it and tell if it's working better ?

 

Best regards,

Hi Fabien,

 

The fix seems to be working fine, no delay on my site.

 

There is Letter-Post for USA and International but not for Canada, will this be added.

 

Thanks,

 

 

Russ

Link to comment
Share on other sites

  • 2 weeks later...

We have V0.8 Canada post installed.

 

I get a very long delay when a Canada post Carrier is loaded as default. forget 5 seconds! More like 30 seconds or more. If I have the standard prestashop default "My Carrier" added, the cart and site is super fast. At first, i had no idea why the site was crawling. After a second fresh prestashop install during troubleshooting, found out it was only when Canada Post Module is active and one of canada post carriers being used as default.

 

Also, the Add to cart button freezes and doesn't do the animation when a Canada post carrier is default. I think this is because it should be not even be trying to calculate shipping at all for non-logged in users. When I click on the Cart button to go to the cart page, I can see the product was added, but it crawls through each page, authentication takes forever.

 

Another issue I am seeing is in the back end. Once you do the first install and configuration with my Sell online API Account etc, it goes to the module section full green checkmark saying "module uninstalled successfully". Now when I go to configure link in the admin area for the module, it just loads forever, never enters back into the module configuration screen but goes back to the module list page and says either "module uninstalled succesffully" or "module installed successfully" still with the green checkmark. Not sure what is going on there.

 

Can someone help with this? :-)

 

Thanks!

Link to comment
Share on other sites

Actually Solved my own problem. This was all resolved when I found out from Canada Post sell online support that the API uses port 30000. Found out that my host service was blocking that port. They enabled it for me... book... now its fast and I can configure canadapost module in the admin panel.

 

There is now another problem with shipping. No carriers show up on the shipping on the 5 page checkout, even though my default carrier is calculating a shipping amount on the shopping cart...

 

It says "there are no carriers available that deliver to this address". I have done all the zone checking and ensuring all my carriers are set to the right zones etc.... can anyone help with this?

Link to comment
Share on other sites

  • 1 month later...

I am trying to do away with choose shipping method all together. I finally have Canada Post listed as default, but I do not want to open a Canada Post account. When customer gets to the page to choose shipping method, Canada Post is only option, on next nothing happens I am stuck there. Any thoughts on disabling shipping?

Link to comment
Share on other sites

  • 10 months later...

Hi,

 

I'm using PrestaShop 1.5.3 and Canada Post Rates Calculator module 1.1, and am having the same 5+ second lag when trying to get rates (anyone know of a fix that might work for these versions?). I also have another problem, somewhat related:

 

I can't get Priority Courier rates to show up for Canadian addresses. The carrier is enabled in the module and on the carriers page, zones are checked, and there are no special weight or price restrictions applied - everything seems to be as it should be. Expedited and XpressPost both show up fine in the cart, and I set Priority Courier up exactly the same way that those two carriers are, yet it doesn't appear.

 

I have only one suspicion, and I have no idea how to check it. In my former osCommerce shop the service names had to be listed in the actual module code exactly as they appeared at CP Sell Online in order for Canada Post to recognize the call for that service (e.g.: "XPressPost International" instead of "xpresspost intl" or "Xpresspost"). Unfortunately I am a PrestaShop newb and have no idea if it's the same deal for PrestaShop. If it is, then I'm pretty sure the module code would have to use "Priority" instead of "Priority Courier" or whatever else it's currently using to connect to Canada Post. However I have no idea how or where to change the code to test the theory.

 

Incidentally I had a test address I used in my osCommerce shop for which Priority Courier always came up as a shipping option, yet with PrestaShop it doesn't (which was my first clue something might be wrong). I've tried other Canadian addresses just in case, and it's the same. The cart doesn't seem to realize the Priority Courier exists. Can anyone help with this? Found the source and fixed it myself: sure enough, it was set wrong in modules/canadapost/sql-install.php - changed "Priority Courier" to just "Priority".

Edited by artofadornment (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...