Jump to content



Latest News: (loading..)

- - - - -

Canada Post Automatic Labels


  • Please log in to reply
68 replies to this topic

#41   natrium42

natrium42
  • Members
  • 142 posts
  • Real Name:Alexei Karpenko

Posted 01 July 2009 - 04:44 PM

Looks like Canada Post changed the names of the login fields slightly, here are the fixed lines:
  ////
  // 2. LOG IN
  
  $response = cp_get_page($ch, 'https://sso-cal.canadapost-postescanada.ca/cpid/apps/signIn?LOCALE=en&~language=EN&APP_ID=B2B&SSO_REFERRER_URL=https://obc.canadapost.ca/zcpb2b/b2b/init.do?language=EN&shop=CPENCOMM');
  
  $query_string = 'cpidSignIn:signIn.x=46&cpidSignIn:signIn.y=11&cpidSignIn_SUBMIT=1'
				. '&cpidSignIn:j_username=' . urlencode($cp_user)
				. '&cpidSignIn:j_password=' . urlencode($cp_password);
Also make sure to go to the EST site manually and update the account when requested.

#42   mr.mister

mr.mister
  • Members
  • 2 posts
  • Real Name:Alex

Posted 14 July 2009 - 01:19 PM

View Postnatrium42, on Jun 18 2009, 12:05 AM, said:

What kind of shipping option does this happen with? Is this with domestic shipping? I usually use eShipper to ship domestically, so might have missed a cropped up problem.

Sorry about the delay in my response. The shipping addresses that I've tried are to the USA. I've tried every shipping method available and it still fails at Step 5.

Thanks,

Alex

#43   natrium42

natrium42
  • Members
  • 142 posts
  • Real Name:Alexei Karpenko

Posted 14 August 2009 - 01:59 AM

I released PayPal Automated Labels mod to supplement this one. It allows to ship via Canada Post Light Packets Air among others, which is very cheap if your package is 2cm or thinner and 0.1kg or lower. Usually you can only ship via this method if you go to a postal office in person, but apparently Canada Post gave PayPal the ability to do it online.

#44   natrium42

natrium42
  • Members
  • 142 posts
  • Real Name:Alexei Karpenko

Posted 17 November 2009 - 06:06 AM

Canada Post Automatic Labels 1.2.2
==================================

Version 1.2.2 (2009-11-17)
- Fix changed login process
- Remove Purolator and add the new FedEx shipping methods

Please see http://addons.oscommerce.com/info/5445 to download

#45   pcguy11

pcguy11
  • Members
  • 1 posts
  • Real Name:John

Posted 18 November 2009 - 07:41 PM

View Postnatrium42, on 17 November 2009 - 06:06 AM, said:

Canada Post Automatic Labels 1.2.2
==================================

Version 1.2.2 (2009-11-17)
- Fix changed login process
- Remove Purolator and add the new FedEx shipping methods

Please see http://addons.oscommerce.com/info/5445 to download

Doesn't seem to work!  All I am getting now is

Fatal error: Call to undefined function cp_post_var() in ship_canadapost.php on line 273

#46   natrium42

natrium42
  • Members
  • 142 posts
  • Real Name:Alexei Karpenko

Posted 18 November 2009 - 11:21 PM

Whoops, looks like I missed to include the changes to admin/includes/functions/ship_canadapost.php
You need to add this function at the end of that file:
function cp_post_var($var) {
  if(get_magic_quotes_gpc()) {
	return stripslashes($_POST[$var]);
  } else {
	return $HTTP_POST_VARS[$var];
  }
}
I fixed this in the package with version 1.2.3.

Edited by natrium42, 18 November 2009 - 11:30 PM.


#47   oyb

oyb
  • Members
  • 27 posts
  • Real Name:Dan

Posted 02 March 2010 - 12:42 AM

I'm getting error at Step 7; it seems like the credit card is being charged but then it crashes somewhere...

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

Any idea what's going on? I just reinstalled this contrib to see if it would fix it but no.

#48   Pinball

Pinball
  • Members
  • 43 posts
  • Real Name:John
  • Gender:Male
  • Location:Canada

Posted 18 March 2010 - 06:06 PM

View Postnatrium42, on 06 February 2008 - 06:40 PM, said:

The new invoice.php has things for customs (like Harmonization code and short description). Use at your own discretion.

You can run the SQL statements through a screen in myPhpAdmin by copying and pasting the code out of the new_install.sql. Of course, backup your database or better yet use a test server.

Thanks,

Now one more problem - in the Manufacturers section of Admin, if I try to change the country code it is not successful UNLESS I also define a Manufacturer's Image at the same time! I tried just doing the Manufacturer's URL instead of Image but while it did record the URL that did not change the countries_id from '0', only if I added an image or changed the image would it update the manufacturer's country of origin...

Is this a bug or did I miss a step during install?

John :-#)#

#49   Pinball

Pinball
  • Members
  • 43 posts
  • Real Name:John
  • Gender:Male
  • Location:Canada

Posted 21 March 2010 - 02:33 AM

OK, reinstalled the 1.2.3 label program, but getting stuck at step 5 - I'm testing a US customer address and looking over the code sent back by CP I see this in the middle of Step 3:

<form name="theForm" action="../ShippingServlet" method="post">
<input type="Hidden" name="translatorName" value="cpc.ui.online.shipping.ShippingInfoTranslator">
<input type="Hidden" name="pageName" value="shipping/estShipping.jsp?locale=en_CA&formId=130">
<input type="Hidden" name="errorMessage" value="">
<input type="Hidden" name="errorField" value="">
<input type="Hidden" name="nextPageFormId" value="121">
<input type="hidden" name="clientId" value=""> <!--this field is used in retrieving an address from address book-->
<input type="hidden" name="formId" value="130">
<input type="hidden" name="maxAddrBookEntry" value="250">
<input type="hidden" name="numAddrBookEntry" value="0">
<input type="hidden" name="irsNo" value="">


Note that "formId" value (130 - International) appears to be set by these lines:

<tr><td class="nav" height="25" width="200"><a href="javascript: submitNavigationForm('shipping/estShipping.jsp?locale=en_CA&formId=110')" class="nav" target="_top" >Ship Canada</a></td></tr>
<tr><td class="nav" height="25" width="200"><a href="javascript: submitNavigationForm('ShippingEOE?useraction=start&locale=en_CA')" class="nav" target="_top" >Ship Canada - Express Order Entry</a></td></tr>
<tr><td class="nav" height="25" width="200"><a href="javascript: submitNavigationForm('shipping/estShipping.jsp?locale=en_CA&formId=120')" class="nav" target="_top">Ship USA</a></td></tr>
<tr><td class="nav" height="25" width="200"><a href="javascript: submitNavigationForm('shipping/estShipping.jsp?locale=en_CA&formId=130')" class="nav" target="_top">Ship International</a></td></tr>


so somewhere the "US" destination (formId=120) is not getting passed through - leading to the program defaulting to International (formId=130). This explains why it fails in Step five with the error message:

Step 5. Error: Failed check in /xxx/.../catalog/admin/ship_canadapost.php at line 545

with line 545 showing the result of the country code (if wrong) I assume.

Trying to figure out where the "US" destination is passed through to CP so I can fix the problem, however my PHP error log only shows when I send the label request to CP (press "Submit" button http://www....com/catalog/admin/ship_canadapost.php?oID=4&action=new&status=3:)

[20-Mar-2010 21:57:15] PHP Notice:  Constant AFFILIATE_NOTIFY_AFTER_BILLING already defined in /usr/..../catalog/admin/includes/application_top.php on line 69
[20-Mar-2010 21:57:16] PHP Notice:  Undefined index:  cID in /usr/..../catalog/admin/ship_canadapost.php on line 261
[20-Mar-2010 21:57:34] PHP Notice:  Constant AFFILIATE_NOTIFY_AFTER_BILLING already defined in /usr/.../catalog/admin/includes/application_top.php on line 69
[20-Mar-2010 21:57:34] PHP Notice:  Undefined variable: HTTP_POST_VARS in /usr/..../catalog/admin/includes/functions/ship_canadapost.php on line 123
[20-Mar-2010 21:57:34] PHP Notice:  Undefined variable: HTTP_POST_VARS in /usr/..../catalog/admin/includes/functions/ship_canadapost.php on line 123

(repeats same error another 15 times then ends with)
[20-Mar-2010 21:57:39] PHP Notice:  Undefined offset:  1 in /usr/..../catalog/admin/includes/functions/ship_canadapost.php on line 108

Ideas?

John :-#)#

#50   Pinball

Pinball
  • Members
  • 43 posts
  • Real Name:John
  • Gender:Male
  • Location:Canada

Posted 23 March 2010 - 06:22 AM

View PostPinball, on 21 March 2010 - 02:33 AM, said:

OK, reinstalled the 1.2.3 label program, but getting stuck at step 5 - I'm testing a US customer address and looking over the code sent back by CP I see this in the middle of Step 3:

<form name="theForm" action="../ShippingServlet" method="post">
<input type="Hidden" name="translatorName" value="cpc.ui.online.shipping.ShippingInfoTranslator">
<input type="Hidden" name="pageName" value="shipping/estShipping.jsp?locale=en_CA&formId=130">
<input type="Hidden" name="errorMessage" value="">
<input type="Hidden" name="errorField" value="">
<input type="Hidden" name="nextPageFormId" value="121">
<input type="hidden" name="clientId" value=""> <!--this field is used in retrieving an address from address book-->
<input type="hidden" name="formId" value="130">
<input type="hidden" name="maxAddrBookEntry" value="250">
<input type="hidden" name="numAddrBookEntry" value="0">
<input type="hidden" name="irsNo" value="">


Note that "formId" value (130 - International) appears to be set by these lines:

<tr><td class="nav" height="25" width="200"><a href="javascript: submitNavigationForm('shipping/estShipping.jsp?locale=en_CA&formId=110')" class="nav" target="_top" >Ship Canada</a></td></tr>
<tr><td class="nav" height="25" width="200"><a href="javascript: submitNavigationForm('ShippingEOE?useraction=start&locale=en_CA')" class="nav" target="_top" >Ship Canada - Express Order Entry</a></td></tr>
<tr><td class="nav" height="25" width="200"><a href="javascript: submitNavigationForm('shipping/estShipping.jsp?locale=en_CA&formId=120')" class="nav" target="_top">Ship USA</a></td></tr>
<tr><td class="nav" height="25" width="200"><a href="javascript: submitNavigationForm('shipping/estShipping.jsp?locale=en_CA&formId=130')" class="nav" target="_top">Ship International</a></td></tr>


so somewhere the "US" destination (formId=120) is not getting passed through - leading to the program defaulting to International (formId=130). This explains why it fails in Step five with the error message:

Step 5. Error: Failed check in /xxx/.../catalog/admin/ship_canadapost.php at line 545

with line 545 showing the result of the country code (if wrong) I assume.

Trying to figure out where the "US" destination is passed through to CP so I can fix the problem, however my PHP error log only shows when I send the label request to CP (press "Submit" button http://www....com/catalog/admin/ship_canadapost.php?oID=4&action=new&status=3:)

[20-Mar-2010 21:57:15] PHP Notice:  Constant AFFILIATE_NOTIFY_AFTER_BILLING already defined in /usr/..../catalog/admin/includes/application_top.php on line 69
[20-Mar-2010 21:57:16] PHP Notice:  Undefined index:  cID in /usr/..../catalog/admin/ship_canadapost.php on line 261
[20-Mar-2010 21:57:34] PHP Notice:  Constant AFFILIATE_NOTIFY_AFTER_BILLING already defined in /usr/.../catalog/admin/includes/application_top.php on line 69
[20-Mar-2010 21:57:34] PHP Notice:  Undefined variable: HTTP_POST_VARS in /usr/..../catalog/admin/includes/functions/ship_canadapost.php on line 123
[20-Mar-2010 21:57:34] PHP Notice:  Undefined variable: HTTP_POST_VARS in /usr/..../catalog/admin/includes/functions/ship_canadapost.php on line 123

(repeats same error another 15 times then ends with)
[20-Mar-2010 21:57:39] PHP Notice:  Undefined offset:  1 in /usr/..../catalog/admin/includes/functions/ship_canadapost.php on line 108

Ideas?

John :-#)#

OK, chatting with Alexei it turns out that OSCommerce/OSCMax are using something called long arrays, which are being phased out of php - they are not going to be available once php 6.0 is released (this needs to be addressed!).

So the cure for the undefined variable HTTP_POST_VARS (and HTP_GET_VARS) is to simply replace $HTTP_POST_VARS with $_POST and to replace $HTTP_GET_VARS with $_GET in his contribution which is Canada Post Automatic Labels 1.2.3.

BUT NOT for the rest of your OSCMax/Commerce site...for now...

I used a good text editor (TextWrangler - MAC) to do the required search & replace and now I get past this problem as shown above, and down to the Payment section, where I have inserted the php code "die();" which terminates the PHP code before making a payment to Canada Post (section 6 as I recall).

I'll try to write this up a bit clearer once I have verified that this works for me, and have checked with Alexei - he is very busy right now with exams I believe.

John :-#)#

#51   Pinball

Pinball
  • Members
  • 43 posts
  • Real Name:John
  • Gender:Male
  • Location:Canada

Posted 29 March 2010 - 06:45 AM

View PostPinball, on 23 March 2010 - 06:22 AM, said:

OK, chatting with Alexei it turns out that OSCommerce/OSCMax are using something called long arrays, which are being phased out of php - they are not going to be available once php 6.0 is released (this needs to be addressed!).

So the cure for the undefined variable HTTP_POST_VARS (and HTP_GET_VARS) is to simply replace $HTTP_POST_VARS with $_POST and to replace $HTTP_GET_VARS with $_GET in his contribution which is Canada Post Automatic Labels 1.2.3.

BUT NOT for the rest of your OSCMax/Commerce site...for now...

I used a good text editor (TextWrangler - MAC) to do the required search & replace and now I get past this problem as shown above, and down to the Payment section, where I have inserted the php code "die();" which terminates the PHP code before making a payment to Canada Post (section 6 as I recall).

I'll try to write this up a bit clearer once I have verified that this works for me, and have checked with Alexei - he is very busy right now with exams I believe.

John :-#)#

Further to this program (1.2.3 version) I have found there is one obsolete section in admin/catagories.php which is this line of code - the link to launch a search page for Harmonized Shipping Codes/Tariffs in catalog/admin/categories.php while in the Add/Edit :

-----------------------
***REPLACE this added (1.2.3) code:

<td class="main"><a href="http://www.cbsa-asfc.gc.ca/trade-commerce/tariff-tarif/tariff2007/01-99/table-e.html" target="_blank">HS Tariff</a>:</td>
            
******With this code:

<td class="main"><a href="http://www.statcan.gc.ca/trade-commerce/cec/trade-commerce-eng.htm" target="_blank">HS Tariff</a>:</td>

-----------------------

This (when you click on HS Tariffs:) opens a new tab/window for Statistics Canada search "Canadian Export Classification" and you can search for your code using key words (start with a single word) or part of a tariff code - say the first 4 numbers, no "." in the search window.

John :-#)#

#52   Pinball

Pinball
  • Members
  • 43 posts
  • Real Name:John
  • Gender:Male
  • Location:Canada

Posted 26 May 2010 - 04:46 AM

Canada Post will take multiple items and fit them into one of the boxes you have provided a name and dimensions for. However when the module has successfully finished it does not provide you with the box name that Canada Post used to determine the shipping price!

Is there an easy modification to the code so that is one of the returned parameters?

Thanks!

John :-#)#

#53   natrium42

natrium42
  • Members
  • 142 posts
  • Real Name:Alexei Karpenko

Posted 29 May 2010 - 01:55 AM

Is this returned when you ship through the Canada Post website? If yes, then it could certainly be parsed out.

#54 ONLINE   greasemonkey

greasemonkey
  • Members
  • 106 posts
  • Real Name:Scott
  • Gender:Male

Posted 06 August 2010 - 10:08 PM

Hi All, I'm really new... so please excuse my newbe questions (I've been lurking here for months... and been able to answer all my question with the search funtion up until now).

I've installed this mod on my test site and cannot get past Step 2.

Step 1. Initialized.
Step 2. Error: Failed check in /mnt/w0113/d12/s07/b02a2859/www/osc_admin_dev/ship_canadapost.php at line 346. This most likely means that Canada Post has changed their user interface. You need to update your Canada Post Automatic Shipping Labels module.

I've tried multiple versions of admin/ship_canadapost.php // 2. LOG IN code... below is what I currently have

////
  // 2. LOG IN

  $response = cp_get_page($ch, 'https://sso-cal.canadapost-postescanada.ca/cpid/apps/signIn?LOCALE=en&~language=EN&APP_ID=B2B&SSO_REFERRER_URL=https://obc.canadapost.ca/zcpb2b/b2b/init.do?language=EN&shop=CPENCOMM');

  $query_string = 'cpidSignIn:signIn.x=46&cpidSignIn:signIn.y=11&cpidSignIn_SUBMIT=1'
								. '&cpidSignIn:j_username=' . urlencode($cp_user)
								. '&cpidSignIn:j_password=' . urlencode($cp_password);

  $response = cp_post_page($ch, 'https://sso-cal.canadapost-postescanada.ca/cpid/apps/signIn?execution=e1s1', $query_string);

  $query_string = 'SHOP=CPFRCOMM&SSO_ITS_URL=%2Fcpid%2Flogin.jsp&SSO_ACTION=0&P_SHOP=CPFRCOMM'
								. '&login_type=2&password_length=0&%7Elanguage=EN&APP_ID=B2B'
								. '&SSO_USERID=' . urlencode($cp_user)
								. '&SSO_PASSWORD=' . urlencode($cp_password);

  $response = cp_post_page($ch, 'https://sso-cal.canadapost-postescanada.ca/cpid/login/redirect', $query_string);

  // get Canada Post customer number
  $regexp = "SSO_CUSTOMER_NUMBER\" value=\"([0123456789]*)(,|\")";
  $matches = '';
  preg_match("/$regexp/siU", $response, $matches);
  $cp_customer = $matches[1];

  $response = cp_submit_page($ch, $response, 'https://sso-cal.canadapost-postescanada.ca');

  // Sanity Check and Progress Report
  if (strstr($response, '<input type=hidden name="SSO_VERSION_MAJOR" value="3">') === FALSE) {
		cp_error(2, 'Failed check in ' . __FILE__ . ' at line ' . __LINE__  . '. This most likely means that Canada Post has changed their user interface. You need to update your Canada Post Automatic Shipping Labels module.');
		curl_close($ch); die(); /////////////////////
  } else {
		cp_progress(2, 'Logged in.');
  }

Any help would be appreciated....

#55 ONLINE   greasemonkey

greasemonkey
  • Members
  • 106 posts
  • Real Name:Scott
  • Gender:Male

Posted 07 August 2010 - 12:30 AM

I've tried the original code from the install... still the same problem... I now have the below installed...

  ////
  // 2. LOG IN

  $response = cp_get_page($ch, 'https://www.canadapost.ca/cpid/login.jsp?SSO_REFERRER_URL=https://www.canadapost.ca');
  
  $response = cp_get_page($ch, 'https://www.canadapost.ca/cpid/apps/signIn?LOCALE=en');
  
  $query_string = 'cpidSignIn:signIn.x=46&cpidSignIn:signIn.y=11&cpidSignIn_SUBMIT=1'
				. '&cpidSignIn:j_username=' . urlencode($cp_user)
				. '&cpidSignIn:j_password=' . urlencode($cp_password)
				. '&cpidSignIn:rememberUserName=true'
				. '&destination=https://obc.canadapost.ca/zcpb2b/b2b/init.do';
					 
  $response = cp_post_page($ch, 'https://www.canadapost.ca/cpid/apps/signIn?execution=e1s1', $query_string);
  
  $query_string = 'SHOP=CPFRCOMM&SSO_ITS_URL=%2Fcpid%2Flogin.jsp&SSO_ACTION=0&P_SHOP=CPFRCOMM'
				. '&login_type=2&password_length=0&%7Elanguage=EN&APP_ID=B2B'
				. '&SSO_USERID=' . urlencode($cp_user)
				. '&SSO_PASSWORD=' . urlencode($cp_password);
				
  $response = cp_post_page($ch, 'https://www.canadapost.ca/cpid/login/redirect', $query_string);
  
  // get Canada Post customer number
  $regexp = "SSO_CUSTOMER_NUMBER\" value=\"([0123456789]*)(,|\")";
  $matches = '';
  preg_match("/$regexp/siU", $response, $matches);
  $cp_customer = $matches[1];
	
  $response = cp_submit_page($ch, $response, 'https://www.canadapost.ca');

  // Sanity Check and Progress Report
  if (strstr($response, '<input type=hidden name="SSO_VERSION_MAJOR" value="3">') === FALSE) {
	cp_error(2, 'Failed check in ' . __FILE__ . ' at line ' . __LINE__  . '. This most likely means that Canada Post has changed their user interface. You need to update your Canada Post Automatic Shipping Labels module.');
	curl_close($ch); die(); /////////////////////
  } else {
	cp_progress(2, 'Logged in.');
  }
  


#56 ONLINE   greasemonkey

greasemonkey
  • Members
  • 106 posts
  • Real Name:Scott
  • Gender:Male

Posted 07 August 2010 - 06:51 PM

So I think I've found the answer in another post...

Apparently not passing Step 2 is almost always to do with the cURL missing OpenSSL AND! libssh2...

Right now my cURL is
cURL support  enabled  
cURL Information  libcurl/7.19.0 OpenSSL/0.9.8k zlib/1.1.3  

Just waiting for my host to reconfigure the cURL (it didn't seem like it would be an issue... other than the system admin has to do it and they don't work on the weekend).

#57 ONLINE   greasemonkey

greasemonkey
  • Members
  • 106 posts
  • Real Name:Scott
  • Gender:Male

Posted 29 January 2011 - 10:15 PM

Hi All, I haven't worked on this in a while... but I'm now back working at it again... I have changed hosts and they have compile cURL with libssh2

Quote

curl
cURL support  enabled  
cURL Information  libcurl/7.21.3 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5 libssh2/1.2.7  

However, I still cannot pass step 2.

Quote

Step 2. Error: Failed check in /home/********/public_html/osc_admin/ship_canadapost.php at line 347. This most likely means that Canada Post has changed their user interface. You need to update your Canada Post Automatic Shipping Labels module.

I sure port 30000 is open... as Canada Post Quotes (I belive) come through port 30000.

Quote

Enter CanadaPost Server Port
30000

So... I'm not sure what this issue is...

The only thing I'm not 100% clear on is; what login info do I use?

Or the login to EST I presume??? Or the login to sellonline?

Right now I'm testing with the EST login info;

$cp_user = '<********>';
$cp_password = '<******>';
$cp_contract = '<00********>';		  // if you have a CP contract, put it here to pay via
						   // account instead of credit card
$cp_use_account = 1;	   // set to 1 to pay via account instead of credit card


Any suggestions would be a great help...

Currently the the code at step 2 looks like;

// 2. LOG IN

  $response = cp_get_page($ch, 'https://www.canadapost.ca/cpid/login.jsp?SSO_REFERRER_URL=https://www.canadapost.ca');
  
  $response = cp_get_page($ch, 'https://www.canadapost.ca/cpid/apps/signIn?LOCALE=en');
  
  $query_string = 'cpidSignIn:signIn.x=46&cpidSignIn:signIn.y=11&cpidSignIn_SUBMIT=1'


#58 ONLINE   greasemonkey

greasemonkey
  • Members
  • 106 posts
  • Real Name:Scott
  • Gender:Male

Posted 30 January 2011 - 04:32 PM

Ok, I've got this working... Kinda... It seems I forgot to remove the "<" ">" from the login info.

It is creating the lable on the Can Post site... However NOT able to open it.

Warning: fopen(http://www.mysite.ca/shop/images/canadapost/611.pdf) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/*******/public_html/osc_admin/ship_canadapost.php on line 755

Warning: fwrite(): supplied argument is not a valid stream resource in /home/*******/public_html/osc_admin/ship_canadapost.php on line 756

Warning: fclose(): supplied argument is not a valid stream resource in /home/*******/public_html/osc_admin/ship_canadapost.php on line 757

I have double checked... and I have uploaded and changed the file permission to 777 here; /public_html/osc_admin/images/canadapost/

What is funny is the above error is pointing to my "catalog";
 fopen(http://www.mysite.ca/shop/images/canadapost/611.pdf)
Shouldn't it be pointing to;
osc_admin/images/canadapost/
????????

#59 ONLINE   greasemonkey

greasemonkey
  • Members
  • 106 posts
  • Real Name:Scott
  • Gender:Male

Posted 31 January 2011 - 01:57 AM

Ok, I'm new here and very new to php. BUT I managed to figure it out (although I'm certain this is the long way... after hours of trial and error).

Below are my edits... just in case it helps someone else (I take no responsibily for these edits... all I can say is they worked for me).

In admin/ship_canadapost.php

change (on or about line 72);

$label_file = DIR_WS_IMAGES . 'canadapost/' . $order_id . '.pdf';
to;

$label_file = '/home/******/public_html/admin/images/canadapost/' . $order_id . '.pdf';

Change (on or about line 755-757);

  
$fh = fopen($label_file, 'wb');
  fwrite($fh, $response);
  fclose($fh);
to;

$fh = fopen('/home/*****/public_html/admin/images/canadapost/' . $order_id . '.pdf', 'wb');
		fwrite($fh, $response);
		fclose($fh);

Change (on or about 795);

echo '<a href="' . $label_file . '">Open PDF</a></b><br><br>';
to;

echo '<b>PDF Label: <a href="' . sprintf(LABEL_FILE,$order_id) . '" target="_blank">Open</a></b><br><br>';
This also opens the label in a new window.

In admin/includes/languages/english/ship_canadapost.php

add (just below <?php);

define('LABEL_FILE', 'http://www.mysite.com/admin/images/canadapost/%s.pdf');


#60   johanv

johanv
  • Members
  • 49 posts
  • Real Name:Jonathon

Posted 21 February 2011 - 06:35 PM

Anyone else getting the error message today?
"
Error: Failed check in ship_canadapost.php at line 347. This most likely means that Canada Post has changed their user interface. You need to update your Canada Post Automatic Shipping Labels module.
"

I was having trouble accessing the CP website this morning, but it seems to be available again.  

Johan