insaini

Canada Post Automated Labels 2.0 AND Canada Post Shipping Module 4.0

231 posts in this topic

Hello and thanks for this contrib. I only hope I manage to get it working, since I'm quite the noob.

Now I kindly ask you to excuse my ignorance and answer a few potentially stupid question that I have.

 

First, I don't exactly understand the cookie part:

define (COOKIE_FILE, '/home/user/cookies/cp_cookies');
define (USER_AGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6');

What is "/home/user"? Do I have to set any specific permission for the cp_cookies folder?

 

Also - is the Automated Labels part supposed the show up somewhere in the admin panel? I can't seem to find it.

Share this post


Link to post
Share on other sites
Byron.. that is very interesting.. today is sunday and i created two labels just today that went through just fine.. why you are getting that error doesnt make sense to me..

 

but to begin with I need to verify your curl build .. can you go to admin->tools->server info and look up the curl build .. and post how its been built..

 

as for the $response variable.. this is maintained in the session between requests.. you can see where this is happening near the top of the file..

 

J

Thanks for getting back to me Jesse.

 

When Hostgator originally compiled libcurl for me they retrograded our PHP version back to 4. Yesterday I requested them to reestablish PHP 5.2.6. So that happened and the following is our libcurl compilation:

 

libcurl/7.18.2 OpenSSL/0.9.7a zlib/1.2.3 libidn/0.5.6 libssh2/0.18

 

I tried another test and I am having less success now because the login within Step 2 is failing with:

 

https://sso-cal.canadapost-postescanada.ca/.../login/redirect

 

HTTP/1.1 500 Internal Server Error

Date: Wed, 25 Jun 2008 16:20:29 GMT

Content-Length: 82

Expires: Thu, 01 Jan 1970 00:00:00 GMT

Set-Cookie: JSESSIONID=84hjLvwNGPvGMmLygvpglwml1jrfn4ZJyWn2hBJTnykjKtqWsyzW!-1464866007; path=/

Cache-Control: no-cache, no-store

 

<html><body>

<form name=Login action="/sso/login.jsp?~language=EN" method=POST>

 

So I am checking through everything to see if I created my own problem. Do you have any ideas?

 

Regards,

Byron

Share this post


Link to post
Share on other sites
Hello and thanks for this contrib. I only hope I manage to get it working, since I'm quite the noob.

Now I kindly ask you to excuse my ignorance and answer a few potentially stupid question that I have.

 

First, I don't exactly understand the cookie part:

define (COOKIE_FILE, '/home/user/cookies/cp_cookies');
define (USER_AGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6');

What is "/home/user"? Do I have to set any specific permission for the cp_cookies folder?

 

Also - is the Automated Labels part supposed the show up somewhere in the admin panel? I can't seem to find it.

 

Yes.. I think I do mention that the cookie file has to be set correctly in the instructions.. if I dont then I do apologize .. you must create a directory just outside of your public www root folder called cp_cookies or whaever you like.. and place the correct path at this config setting.. its needed to store the cookie file between requests

 

THe automated labels is loaded via a link on your order page.. so pull up the details of an order.. and the button should be at the bottom of the page SHIP

 

For configuration of Automated Labels.. thats done via the shipping module

Edited by insaini

Share this post


Link to post
Share on other sites
Thanks for getting back to me Jesse.

 

When Hostgator originally compiled libcurl for me they retrograded our PHP version back to 4. Yesterday I requested them to reestablish PHP 5.2.6. So that happened and the following is our libcurl compilation:

 

libcurl/7.18.2 OpenSSL/0.9.7a zlib/1.2.3 libidn/0.5.6 libssh2/0.18

 

I tried another test and I am having less success now because the login within Step 2 is failing with:

 

https://sso-cal.canadapost-postescanada.ca/.../login/redirect

 

HTTP/1.1 500 Internal Server Error

Date: Wed, 25 Jun 2008 16:20:29 GMT

Content-Length: 82

Expires: Thu, 01 Jan 1970 00:00:00 GMT

Set-Cookie: JSESSIONID=84hjLvwNGPvGMmLygvpglwml1jrfn4ZJyWn2hBJTnykjKtqWsyzW!-1464866007; path=/

Cache-Control: no-cache, no-store

 

<html><body>

<form name=Login action="/sso/login.jsp?~language=EN" method=POST>

 

So I am checking through everything to see if I created my own problem. Do you have any ideas?

 

Regards,

Byron

 

Hmm.. i have to make a couple shipments today.. i havent since last week.. they may have changed something so ill check and see my side..

Share this post


Link to post
Share on other sites

Thanks again for the module.

 

The Sellonline part works like a charm.

 

I'm however stuck at step 2 in the Automated Labels, with the

Step 2. Error: Failed check in /var/www/virtual/luello.com/htdocs/shop/admin/includes/languages/english/ship_canadapost.php at line 9. This most likely means that Canada Post has changed their user interface. You need to update your Canada Post Automatic Shipping Labels module.

Now, my cURL is libcurl/7.15.5 OpenSSL/0.9.8c zlib/1.2.3 libidn/0.6.5 which I guess means I'm out of luck...

 

So, is there a reliable workaround or do I really need to switch hosting?

Share this post


Link to post
Share on other sites

One more thing I'm not in the clear about. Is VentureOne necessary for the Labels module to function? I'm not sure if I understand correctly, but the guys I'm doing the cart for (while they do have Canada Post OBC account) say they are "LEVEL 2" or something and that VentureOne would be a downgrade for them. <_<

 

Also, here's part 2 of my stupid question from before: what would the "correct path" for the cookies look like? "/var/www/virtual/mysite.com/cp_cookies"? And the folder needs to be 777, right?

Share this post


Link to post
Share on other sites
One more thing I'm not in the clear about. Is VentureOne necessary for the Labels module to function? I'm not sure if I understand correctly, but the guys I'm doing the cart for (while they do have Canada Post OBC account) say they are "LEVEL 2" or something and that VentureOne would be a downgrade for them. <_<

Sure, that's also OK. VentureOne is just the minimum that you should have. Also, I am not sure whether insani has added it, but it's also possible to pay via account (instead of credit card) if you have that set up with Canada Post.

Share this post


Link to post
Share on other sites
Sure, that's also OK. VentureOne is just the minimum that you should have. Also, I am not sure whether insani has added it, but it's also possible to pay via account (instead of credit card) if you have that set up with Canada Post.

 

Yes, that would be greatly preferable. I don't think I've seen it as a toggle in the admin panel - where/how can I switch it to do that?

Share this post


Link to post
Share on other sites
Yes, that would be greatly preferable. I don't think I've seen it as a toggle in the admin panel - where/how can I switch it to do that?

As far as I can see, insani hasn't added shipping with Canada Post contracts yet. But it requires very minor modifications, just check the ship_canadapost.php file of the original contribution and look for all blocks of code containing "$cp_contract".

Share this post


Link to post
Share on other sites
As far as I can see, insani hasn't added shipping with Canada Post contracts yet. But it requires very minor modifications, just check the ship_canadapost.php file of the original contribution and look for all blocks of code containing "$cp_contract".

 

I believe natriums original release had code for contracts.. I removed this actually I didnt expect anyone to need it.. clearly im mistaken ;) .. however I dont really have time to go in to look.. but the code is fairly easy to modify.. take a look at ship_canadapost_ajax.php (in my release) look for where payment processing is done.. you can add in the necessary contracts code stuff there..

 

you do not need to enter your credit card alias in the shipping module if you will use contract setup.. the contract code should also probably be added to the shipping module configuration so it can be retrieved from there.... ive basically tightly integrated the shipping module and shipping labels packages.. although the shipping module can function without the labels package.. it doesnt work the other way around.. for the labels package to work you need this specific shipping module..

 

J

Share this post


Link to post
Share on other sites
One more thing I'm not in the clear about. Is VentureOne necessary for the Labels module to function? I'm not sure if I understand correctly, but the guys I'm doing the cart for (while they do have Canada Post OBC account) say they are "LEVEL 2" or something and that VentureOne would be a downgrade for them. <_<

 

Also, here's part 2 of my stupid question from before: what would the "correct path" for the cookies look like? "/var/www/virtual/mysite.com/cp_cookies"? And the folder needs to be 777, right?

 

if /mysite.com is your root path.. (where say your index.php file is) then no..

 

the setup would be

 

/virtual/mysite.com

/virtual/cp_cookies

 

you can store the cp_cookies file anywhere.. as long as its a 777 access file.. you could also store it in your temp directory.. im not sure if it contains secure information.. it may .. but hopefully canadapost only keeps track of a session and doesnt store user credentials or anything else.. i cant say for sure..

 

 

and for cURL.. you 7.15 may work.. im using 7.18 and I know it doesnt work on 7.12 so not sure what version is required.. but i can tell you that OpenSSL and libSSH2 are mandatory libraries.. i see you have OpenSSL.. but you dont have libssh2 .. that is definitely required and you will have to install libssh2 and then rebuild php with libssh2

 

J

Share this post


Link to post
Share on other sites

I have installed the CP and Label Printing scripts. We are in Test mode with Canada Post. The problem I am having is that I can only get a Quote from CP with 1 or 2 items. It will not accept a third item or even 3 of the same item. I have the box sizes entered and the dimensions for each item. It does not appear to be a weight issue... I have made the item 1 KG and 30KG and it will accept 2 and no more.

 

 

 

Is there an item limit in the CP test system? If not...can you suggest a solution?

 

D Clark

Share this post


Link to post
Share on other sites
Hmm.. i have to make a couple shipments today.. i havent since last week.. they may have changed something so ill check and see my side..

Hi Jesse,

 

I have been working on other priorities and finally got back to testing your contribution. I found an error in the way cookies were configured in my test site, it is fixed now and your contribution works great. Thanks for your support during my fumbling.

 

I found a couple of small items missing in the INSTALL.htm as follows:

 

Open admin/includes/classes/order.php +++++++++++++++++++++++++++++++++++++++++++++++++++

Comment: 'shipping_method' is missing in INSTALL.htm

Find:

'orders_status' => $order['orders_status'],

Add AFTER:

'cp_tracking' => $order['cp_tracking'],
'shipping_method' => $shipping_method, // missing in INSTALL.htm

 

Open /admin/includes/languages/english.php +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Comment: missing in INSTALL.htm

Find:

the last  define('IMAGE_XXXXXXXXXX', 'YYYYYYY');

Add AFTER:

define('IMAGE_ORDERS_SHIP', 'Create Canada Post Shipping Label');

 

I have made changes to admin/orders.php by moving the shipping_label button on the Edit page next to the tracking_number input box. I also added tracking and label buttons. The 3 buttons will only display if the required information is in the order. I did this so that my wife wouldn't be confused when or when not to create a shipping label for her orders. If you are interested in the code please let me know and I will email it to you.

 

Thanks again for the wonderful contribution and support.

 

Regards,

Byron

Share this post


Link to post
Share on other sites

will this mod calculate and add up all shipping charges onto the invoice if we decide not to use the label print option?

 

Thank you,

Tooth

Share this post


Link to post
Share on other sites

I get the following error in the Process Indicator while trying to use the Canada Post Automated Labels.

 

Step 7. Error: Failed check in /home/paulworks/public_html/catalog/admin/includes/languages/english/ship_canadapost.php at line 9. This most likely means that Canada Post has changed their user interface. You need to update your Canada Post Automatic Shipping Labels module.

 

This is the latest version of the shipping labels module and it doesn't give any additional information. What is Step 7 supposed to be doing and how do I fix it?

 

Any help would be greatly appreciated.

 

Also, Is the Total Items Weight supposed to be automatically calculated? I have 0.000 entered in this field by default and "Change this to the Total Package Weight" beside it.

Share this post


Link to post
Share on other sites
I get the following error in the Process Indicator while trying to use the Canada Post Automated Labels.

 

Step 7. Error: Failed check in /home/paulworks/public_html/catalog/admin/includes/languages/english/ship_canadapost.php at line 9. This most likely means that Canada Post has changed their user interface. You need to update your Canada Post Automatic Shipping Labels module.

 

This is the latest version of the shipping labels module and it doesn't give any additional information. What is Step 7 supposed to be doing and how do I fix it?

 

Any help would be greatly appreciated.

 

Also, Is the Total Items Weight supposed to be automatically calculated? I have 0.000 entered in this field by default and "Change this to the Total Package Weight" beside it.

 

I was able to fix the problem with Step 7. Now I have a new question.

 

During the checkout process, I am getting an error (XML parsing error) under Canada Post shipping. Prior to fixing the above problem the Canada Post shipping showed properly during checkout. I haven't been able to figure out why its not working now.

Edited by huntman

Share this post


Link to post
Share on other sites
I was able to fix the problem with Step 7. Now I have a new question.

 

During the checkout process, I am getting an error (XML parsing error) under Canada Post shipping. Prior to fixing the above problem the Canada Post shipping showed properly during checkout. I haven't been able to figure out why its not working now.

 

 

Hmm.. step 7 i believe is payment issue..

 

did you add a credit card to your canadapost sellOnline account? you have to store the alias to that card which is usually the first 4 digits followed by 8 asterisks and then the final 4 digits.. and of course the cvv from the back must also be stored in your shipping module configuration.. im assuming you did this and the payment proceeded..

 

but why you are getting an xml error.. that im not sure of.. do you know which line its happening on? sorry I dont check this that offen.. if you have a problem you can email directly at webmaster AT insaini DOT com.

 

The total weight of the package is supposed to be retrieved from the stored shipping method chosen by the customer.. the value of the weight is stored and then parsed back by the shipping labels software when its time to print a label.. if it doesnt ship up thats because it wasnt stored correctly.. and if you are using my shipping module then it should be .. there might be another problem.. just have to debug it through..

 

J

Share this post


Link to post
Share on other sites
will this mod calculate and add up all shipping charges onto the invoice if we decide not to use the label print option?

 

Thank you,

Tooth

 

yes the module will function without the shipping labels software.. it will store the package size, shipping method chosen, weight, and then ofcourse the cost of shipment..

 

J

Share this post


Link to post
Share on other sites
Hi Jesse,

 

I have been working on other priorities and finally got back to testing your contribution. I found an error in the way cookies were configured in my test site, it is fixed now and your contribution works great. Thanks for your support during my fumbling.

 

I found a couple of small items missing in the INSTALL.htm as follows:

 

Open admin/includes/classes/order.php +++++++++++++++++++++++++++++++++++++++++++++++++++

Comment: 'shipping_method' is missing in INSTALL.htm

Find:

'orders_status' => $order['orders_status'],

Add AFTER:

'cp_tracking' => $order['cp_tracking'],
'shipping_method' => $shipping_method, // missing in INSTALL.htm

 

Open /admin/includes/languages/english.php +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Comment: missing in INSTALL.htm

Find:

the last  define('IMAGE_XXXXXXXXXX', 'YYYYYYY');

Add AFTER:

define('IMAGE_ORDERS_SHIP', 'Create Canada Post Shipping Label');

 

I have made changes to admin/orders.php by moving the shipping_label button on the Edit page next to the tracking_number input box. I also added tracking and label buttons. The 3 buttons will only display if the required information is in the order. I did this so that my wife wouldn't be confused when or when not to create a shipping label for her orders. If you are interested in the code please let me know and I will email it to you.

 

Thanks again for the wonderful contribution and support.

 

Regards,

Byron

 

Im happy it worked out for you.. you can if you like (as i dont have much time anymore) .. make the changes repackage and upload the changes.. or you can email me the changes and I can do it when I have some time..

 

J

Share this post


Link to post
Share on other sites

Sorry for asking something that's not exactly related to the module, but could you share your experience/recommendations on good hosting services with which the Automated Labels actually work? Maybe I'm just really bad at searching for something like that, but I can't seem to find anyone offering a libssh2 cURL. I'd prefer a host in Canada, if possible.

Thanks in advance.

Share this post


Link to post
Share on other sites

I realize this issue has been answered to some degree, but I want to be sure on how to proceed. I get the error: "Cannot reach Canada Post Server. You may refresh this page (Press F5 on your keyboard) to try again." I tried executing the test.php file from the Canada-Post Redirect contribution, but got no reply in my browser. My OSCommerce site is at IXWebhosting, but I also have an account at Hostgator, and when I execute the same file I get "]> -4004 Item is too large to be packed. 2256081", which seems to suggest I can contact CanadaPost from Hostgator.

 

Is my only option to use a redirect through my Hostgator account? Can I use another port besides 30000?

Share this post


Link to post
Share on other sites
Sorry for asking something that's not exactly related to the module, but could you share your experience/recommendations on good hosting services with which the Automated Labels actually work? Maybe I'm just really bad at searching for something like that, but I can't seem to find anyone offering a libssh2 cURL. I'd prefer a host in Canada, if possible.

Thanks in advance.

If you use dedicated hosting, you can install it yourself. As for shared, I only tested it with HostMonster (USA).

Share this post


Link to post
Share on other sites

Hi everybody and thank you very much for the great work.

 

I have a small problem with the automated labels.

When I click on the button SHIP I get a blank empty page.

No errors, nothing at all.

Do you have any idea why for?? could be because of libcURL problem....

My host is IXWEBHOSTING.com

 

I'm affraid to ask them anything about the libcurl because last time I asked them to enable the port 30000, all the site was down for 2 days.

 

Thanks in advance

Christian

Share this post


Link to post
Share on other sites
I have a small problem with the automated labels.

When I click on the button SHIP I get a blank empty page.

No errors, nothing at all.

Do you have any idea why for?? could be because of libcURL problem....

My host is IXWEBHOSTING.com

Sorry, it's hard to help you since you don't provide any information. Does phpinfo() show that cURL is enabled? What's the source of the blank page?

Share this post


Link to post
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