OSCOMMERCE SUPPORT CALL 702-453-3332

 

Help - Search - Members - Calendar
Full Version: Canada Post Automated Labels 2.0 AND Canada Post Shipping Module 4.0
osCommerce Community Support Forums > osCommerce Online Merchant v2.x > Contributions / Add-Ons > Shipping Modules
Pages: 1, 2
insaini
This is the official topic for the combined package of

Canada Post Automated Labels 2.0 and Canada Post Shipping Module 4.0

*Improvements*
-------------------

- AJAX Label Generation
- osCommerce Units in configuration (rather than with each individual product)
- Both contributions now are connected to each other via VentureOne information


This has been tested as much as I could. I will support this as well as I can however if I dont reply try sending me a PM or emailing me.
Lets get some of you using this asap so we can be sure all the kinks are out.

Download Here http://addons.oscommerce.com/info/5842
J
insaini
Just a screenshot..

insaini
Ive uploaded versions 2.1 of Automated Labels and 4.1 of the Shipping Module.

Automated Labels 2.1 Requires Shipping Module 4.1 as they are basically connected in the way they work.

The Shipping Module will output something like this

Canada Post [1 box(es) to be shipped] 'package_name' - 'weight'(kg) (Expedited US Business etc...)

The 'weight' component is the total weight of the package including the weight of your items AND your packaging material. This weight is then extracted by Automated Labels and is used as the total package weight value.. before you were required to input the total package weight which is no longer necessary but you do still have that option to do so. This makes shipping labels a lot easier.

Next when I have time I will also add packaging dimensions to the shipping module output and have automated labels extract those values as well as currently you have enter those values yourself..

As well I will also implement methodology for Multiple Automated Labels.. (for multiple boxes being returned by the Canada Post shipping module) .. currently the automated labels software can only handle 1 box shipments...

The full package is on the contribution page.. also fixed was a bug with domestic shipments.. everything seems to be working just fine..
insaini
There was a missing '&' character in the payment sequence in the ship_canadapost_ajax.php file.. as well ive updated the label filename logic to the sequence associated with it..

Full package is uploaded.

J
sinryder
wow man THANK YOUUU so much .. this is exactly was i was looking for. creating these labels was a headache
insaini
QUOTE (sinryder @ Apr 11 2008, 03:21 AM) *
wow man THANK YOUUU so much .. this is exactly was i was looking for. creating these labels was a headache


Glad its worked out for you.. but I cant take all the credit.. Natrium created the original contribution without it I could never have produced this extension..

thumbsup.gif

J
insaini
Uploaded is Canada Post Automated Labels 2.2 and Canada Post Shipping Module 4.1

The only changes were to the Automated Labels .. there was a missing include and a button file.. There was also a custom input text field function which wasnt necessary and cut out.. also updated were the install instructions.. no extra added functionality in this release.

J
chrisjclay
I'm wondering if anyone has been able to get this working on a GoDaddy shared hosting account yet? According to the installation instructions,

QUOTE
libcurl-7.12 does not work and is what comes with GoDaddy Virtual Dedicated Servers. You will need to replace with a higher version (other versions not tested) in order for this contribution to work)


I've tried contacting GoDaddy to see how I can replace libcurl-7.12 with 7.18 but haven't heard back yet... Any help would be most appreciated!

Chris

P.S. Thanks for all your hard work smile.gif
chrisjclay
Just to follow up, here's the word back from GoDaddy re: cURL support:

QUOTE
Thank you for contacting Online Support with regards to this issue. We do support CURL extensions on all of our Linux hosting plans. The current version of cURL supported is 7.16.2, and unfortunately we cannot upgrade this at this time. I sincerely apologize for any inconvenience this may have caused.
insaini
QUOTE (chrisjclay @ Apr 21 2008, 04:09 PM) *
Just to follow up, here's the word back from GoDaddy re: cURL support:


Chris, it may work on 7.16 .. I can't say for sure..the most important thing is that curl is built with openssl .. the way you can verify this is by going to admin -> tools -> server info ..

scroll to curl and see how its been built (it should include openssl at least v0.97)

you can also see if it works by commenting out step 3 to step 10 in ship_canadapost_ajax.php

CODE
case 1:
break;
case 2:
break; /*
case 3:
break;
..
case 10:
break; */
default:
break;


comment out case 3 to case 10 .. if when you click submit it displays "Logged In" for step 2 .. then you know it will work.

J
chrisjclay
QUOTE (insaini @ Apr 21 2008, 01:15 PM) *
scroll to curl and see how its been built (it should include openssl at least v0.97)


Looks like it may work after all then smile.gif Here's what I found under "server info":

QUOTE (server info)
CURL support enabled
CURL Information libcurl/7.10.6 OpenSSL/0.9.7a ipv6 zlib/1.2.3


I'll experiment some more this evening.

Chris
insaini
QUOTE (chrisjclay @ Apr 21 2008, 05:25 PM) *
Looks like it may work after all then smile.gif Here's what I found under "server info":
I'll experiment some more this evening.

Chris


hmm.. well that does say libcurl 7.10 .. which isnt libcurl 7.16 .. but give it a go and see how it works out..
rulix
I'm trying to install this mod on a newly install of osCommerce v2.2 RC2a.

Running the database install for this mod it's failing.

Line
ADD products_length DECIMAL(6,2) DEFAULT '12' NOT NULL after products_dim_type,
fails because I do not have column "products_dim_type".

Looking at the upgrade db sql file, we're dropping the column:
ALTER TABLE products DROP products_dim_type;

Is this column required?
insaini
QUOTE (rulix @ Apr 29 2008, 05:57 PM) *
I'm trying to install this mod on a newly install of osCommerce v2.2 RC2a.

Running the database install for this mod it's failing.

Line
ADD products_length DECIMAL(6,2) DEFAULT '12' NOT NULL after products_dim_type,
fails because I do not have column "products_dim_type".

Looking at the upgrade db sql file, we're dropping the column:
ALTER TABLE products DROP products_dim_type;

Is this column required?



good catch,

it should be

ADD products_length DECIMAL(6,2) DEFAULT '12' NOT NULL after products_weight,

sorry about that.. change it to that and run the script again.. should be good..

J
rulix
QUOTE (insaini @ Apr 29 2008, 07:59 PM) *
good catch,

it should be

ADD products_length DECIMAL(6,2) DEFAULT '12' NOT NULL after products_weight,

sorry about that.. change it to that and run the script again.. should be good..

J


No problem, thank you. smile.gif
rulix
Another thing I found, in the document;

Open admin/categories.php

Find:
$sql_data_array = array('products_quantity' => tep_db_prepare_input($HTTP_POST_VARS['products_quantity']),

It's actually:
$sql_data_array = array('products_quantity' => (int)tep_db_prepare_input($HTTP_POST_VARS['products_quantity']),


You've also got the text:
In the same line after 'pd.product_description' ADD:

It should read:
In the same line after 'pd.products_description' ADD:
insaini
QUOTE (rulix @ Apr 29 2008, 09:00 PM) *
Another thing I found, in the document;

Open admin/categories.php

Find:
$sql_data_array = array('products_quantity' => tep_db_prepare_input($HTTP_POST_VARS['products_quantity']),

It's actually:
$sql_data_array = array('products_quantity' => (int)tep_db_prepare_input($HTTP_POST_VARS['products_quantity']),
You've also got the text:
In the same line after 'pd.product_description' ADD:

It should read:
In the same line after 'pd.products_description' ADD:


Thanks.. ill update the documentation on that..

Hows the module working out otherwise?
rulix
QUOTE (insaini @ Apr 30 2008, 03:55 PM) *
Thanks.. ill update the documentation on that..

Hows the module working out otherwise?



I haven't made it far enough to test it yet. I'm dealing with the empty shopping cart issue at the moment. I'll let you know though.

Thanks. smile.gif
Stump3r
Need help guys.
New install on OSC 2.2 RC2a

Ran the new install SQL file with this result.

CODE
###########################################################################
# CANADA POST SHIPPING MODULE DB QUERIES
###########################################################################
# Canada Post Shipping Module with dimensions using osCommerce stored units
ALTER TABLE products ADD products_length DECIMAL( 6, 2 ) DEFAULT '12' NOT NULL AFTER products_dim_type,
ADD products_width DECIMAL( 6, 2 ) DEFAULT '12' NOT NULL AFTER products_length,
ADD products_height DECIMAL( 6, 2 ) DEFAULT '12' NOT NULL AFTER products_width,
ADD products_ready_to_ship ENUM( '0', '1' ) NOT NULL default '0' AFTER products_height;

MySQL said: Documentation
#1054 - Unknown column 'products_dim_type' in 'products'


If you do all the mods then activate Canada Post with in the Admin, here is the error code from the shopping cart.
CODE
1054 - Unknown column 'p.products_length' in 'field list'

select p.products_id, pd.products_name, p.products_model, p.products_image, p.products_price, p.products_weight, p.products_length, p.products_width, p.products_height, p.products_ready_to_ship, p.products_tax_class_id from products p, products_description pd where p.products_id = '51' and pd.products_id = p.products_id and pd.language_id = '1'

[TEP STOP]


Where do I go, only know enough to be dangerous.

Thanks,
Shane
insaini
QUOTE (Stump3r @ May 2 2008, 01:00 AM) *
Need help guys.
New install on OSC 2.2 RC2a

Ran the new install SQL file with this result.

CODE
###########################################################################
# CANADA POST SHIPPING MODULE DB QUERIES
###########################################################################
# Canada Post Shipping Module with dimensions using osCommerce stored units
ALTER TABLE products ADD products_length DECIMAL( 6, 2 ) DEFAULT '12' NOT NULL AFTER products_dim_type,
ADD products_width DECIMAL( 6, 2 ) DEFAULT '12' NOT NULL AFTER products_length,
ADD products_height DECIMAL( 6, 2 ) DEFAULT '12' NOT NULL AFTER products_width,
ADD products_ready_to_ship ENUM( '0', '1' ) NOT NULL default '0' AFTER products_height;

MySQL said: Documentation
#1054 - Unknown column 'products_dim_type' in 'products'


If you do all the mods then activate Canada Post with in the Admin, here is the error code from the shopping cart.
CODE
1054 - Unknown column 'p.products_length' in 'field list'

select p.products_id, pd.products_name, p.products_model, p.products_image, p.products_price, p.products_weight, p.products_length, p.products_width, p.products_height, p.products_ready_to_ship, p.products_tax_class_id from products p, products_description pd where p.products_id = '51' and pd.products_id = p.products_id and pd.language_id = '1'

[TEP STOP]


Where do I go, only know enough to be dangerous.

Thanks,
Shane



Shane, only had to read post 14 above to note that a change was needed.. take a look

http://forums.oscommerce.com/index.php?s=&...t&p=1242251

once you make the change and run it on the database again you should be fine..

J
Stump3r
QUOTE (insaini @ May 2 2008, 04:37 AM) *
Shane, only had to read post 14 above to note that a change was needed.. take a look

http://forums.oscommerce.com/index.php?s=&...t&p=1242251

once you make the change and run it on the database again you should be fine..

J


J,

Close but no cigar. The automated labels portion of the SQL code still errors.
If you remove it and run the last portion for CP shipping module it runs fine.

Now I have a new error that appears in the Manufacturers module.
CODE
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' countries_id manufacturers' at line 1

select count(*) as total from, countries_id manufacturers

[TEP STOP]


Here is the SQL error that pops up when trying to run Automated label script portion.

CODE
##########################################################################
# CANADA POST AUTOMATED LABELS DB QUERIES
##########################################################################
ALTER TABLE products ALTER TABLE manufacturers ADD countries_id INT NOT NULL;

MySQL said: Documentation
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'TABLE manufacturers ADD countries_id INT NOT NULL' at line 3


What am I missing?
Appreciate the help more than you can know.
KKT
Hey, I'm trying to determine whether this is the right Contribution for me.

I'm in Canada, i have a very small store that just sells some one-off items, some tshirts and buttons, I'm not charging tax and I'm thinking that the easiest thing to do would be to assign different countries or regions a flat shipping rate per item.
I do want to offer full international shipping though. Is this something that can be done with this contribution?

thanks,
KKT
pueblito
Running into a bit of an issue with my install.

Running the provided ship_canadapost.php file I get an error message on top of the screen.

Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /../admin/includes/languages/english/ship_canadapost.php on line 75


I try to process the shippment anyway, but I get back two error messages under "Initialized" :

---

Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /home2/epipccom/public_html/pueblito.ca/admin/includes/languages/english/ship_canadapost.php on line 75
Step 1. Initialized.

Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /home2/epipccom/public_html/pueblito.ca/admin/includes/languages/english/ship_canadapost.php on line 75
Step 2. Error: Failed check in /home2/epipccom/public_html/pueblito.ca/admin/includes/languages/english/ship_canadapost.php at line 17. This most likely means that Canada Post has changed their user interface. You need to update your Canada Post Automatic Shipping Labels module.

---
so I remove the '\' character on line 75 and try to process the order, but I still get the following error message on the right hand side underneath "initialized".

Failed check /../admin/includes/languages/english/ship_canadapost.php at line 17
This most likely means that Canada Post has changed their user interface. You need to
update your Canada Post Automatic Shipping Labels module


If anyone can help I'd be very grateful.

Cheers
insaini
QUOTE (Stump3r @ May 2 2008, 10:54 AM) *
J,

Close but no cigar. The automated labels portion of the SQL code still errors.
If you remove it and run the last portion for CP shipping module it runs fine.

Now I have a new error that appears in the Manufacturers module.
CODE
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' countries_id manufacturers' at line 1

select count(*) as total from, countries_id manufacturers

[TEP STOP]


Here is the SQL error that pops up when trying to run Automated label script portion.

CODE
##########################################################################
# CANADA POST AUTOMATED LABELS DB QUERIES
##########################################################################
ALTER TABLE products ALTER TABLE manufacturers ADD countries_id INT NOT NULL;

MySQL said: Documentation
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'TABLE manufacturers ADD countries_id INT NOT NULL' at line 3


What am I missing?
Appreciate the help more than you can know.



Where did you get that sql command?

ALTER TABLE products ALTER TABLE manufacturers ADD countries_id INT NOT NULL;

That is no where in the contribution..

the command is

CODE
ALTER TABLE products
ADD products_description_short VARCHAR( 64 ) NOT NULL,
ADD products_tariff VARCHAR( 32 ) NOT NULL;

ALTER TABLE manufacturers ADD countries_id INT NOT NULL;

ALTER TABLE orders ADD cp_tracking VARCHAR( 18 ) NULL;


I have no idea where you got that above command that you tried to run and got that error..

J
insaini
QUOTE (KKT @ May 2 2008, 11:11 AM) *
Hey, I'm trying to determine whether this is the right Contribution for me.

I'm in Canada, i have a very small store that just sells some one-off items, some tshirts and buttons, I'm not charging tax and I'm thinking that the easiest thing to do would be to assign different countries or regions a flat shipping rate per item.
I do want to offer full international shipping though. Is this something that can be done with this contribution?

thanks,
KKT


You get whatever shipping methods canada post provides.. that is shipping within canada, usa, or international ..

once you set you sellonline and ventureone accounts.. you can also specify flat rate shipping.. handling charges.. etc..
insaini
QUOTE (pueblito @ May 2 2008, 03:26 PM) *
Running into a bit of an issue with my install.

Running the provided ship_canadapost.php file I get an error message on top of the screen.

Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /../admin/includes/languages/english/ship_canadapost.php on line 75
I try to process the shippment anyway, but I get back two error messages under "Initialized" :

---



I found the problem.. something i missed ..

open the language file /admin/includes/languages/english/ship_canadapost.php

on line 38 you will see

define ('ENTRY_DECLARED_VALUE','Declared Value ('.DEFAULT_CURRENCY.'):');\

remove the ending \

thats it..

J
pueblito
QUOTE (insaini @ May 3 2008, 05:54 AM) *
I found the problem.. something i missed ..

open the language file /admin/includes/languages/english/ship_canadapost.php

on line 38 you will see

define ('ENTRY_DECLARED_VALUE','Declared Value ('.DEFAULT_CURRENCY.'):');\

remove the ending \

thats it..

J


Thanks J. Got that far, but I still get:


Failed check /../admin/includes/languages/english/ship_canadapost.php at line 17
This most likely means that Canada Post has changed their user interface. You need to
update your Canada Post Automatic Shipping Labels module


when I try to submit from the admin screen.
chrisjclay
QUOTE (insaini @ Apr 21 2008, 02:28 PM) *
hmm.. well that does say libcurl 7.10 .. which isnt libcurl 7.16 .. but give it a go and see how it works out..


Hey there,

I did a fresh install of the module and it's still not working on GoDaddy, but it turns out I'll need to add a few lines of code re: a proxy server to get it to work:

QUOTE ("GoDaddy Help Center")
On our shared hosting, any CURL applications that make secure HTTP connections (HTTPS over port 443) need to pass through a proxy server. The address for this proxy server is proxy.shr.secureserver.net and connections must specify the use of port 3128. The code below already includes this information.


GoDaddy posted some sample code here:

http://help.godaddy.com/article/289

Similarly, someone in an older Canada Post mod used the proxy server to get things working on GoDaddy:

QUOTE ("darkknightenterprises")
I couldn't get this thing to work because I forgot to check and make sure that the proxy call in cURL was in the code. Added the needed lines and got it working.


He posted the fix here...

http://www.oscommerce.com/community/contributions,391

which seems to add an extra few lines of code to the mod:

CODE
//Next 2 lines for GoDaddy.com hosting accounts.
curl_setopt ($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
curl_setopt($ch, CURLOPT_PROXY, "http://proxy.shr.secureserver.net:3128");


Similarly, someone posted a similar fix for the Fed Ex module:

QUOTE ("oscommerceIndia.com)
One of our clients was facing issue with the FedEx Module in osCommerce.

The site was running on Godaddy Hosting.

We disabled Fedex. Then in Fedex1.php, we changed the part that references godaddy to:

curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, TRUE);
curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
curl_setopt($ch, CURLOPT_PROXY, “http://proxy.shr.secureserver.net:3128″);

Then enable the module again, and did a rate request, and that’s it.


(from http://oscommerceindia.com/help/2008/01/17...odaddy-hosting/ )

All of this is a bit over my head - I'm hoping someone could give me a hint as to where I should insert these lines of code. The only "curl_setopt" reference I could find was in the ship_canadapost_ajax.php file (under Case 8, around line 481) but when I inserted these lines immediately after it, it didn't seem to do anything. I keep getting the same error, "Cannot reach Canada Post Server. You may refresh this page..."

Please help! I need to get our site online and this module is the last barrier before we can launch it. Thanks again insaini for all your hard work and suggestions...

Chris
insaini
QUOTE (chrisjclay @ May 4 2008, 04:23 AM) *
Hey there,

I did a fresh install of the module and it's still not working on GoDaddy, but it turns out I'll need to add a few lines of code re: a proxy server to get it to work:
GoDaddy posted some sample code here:

http://help.godaddy.com/article/289

Similarly, someone in an older Canada Post mod used the proxy server to get things working on GoDaddy:
He posted the fix here...

http://www.oscommerce.com/community/contributions,391

which seems to add an extra few lines of code to the mod:

CODE
//Next 2 lines for GoDaddy.com hosting accounts.
curl_setopt ($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
curl_setopt($ch, CURLOPT_PROXY, "http://proxy.shr.secureserver.net:3128");


Similarly, someone posted a similar fix for the Fed Ex module:
(from http://oscommerceindia.com/help/2008/01/17...odaddy-hosting/ )

All of this is a bit over my head - I'm hoping someone could give me a hint as to where I should insert these lines of code. The only "curl_setopt" reference I could find was in the ship_canadapost_ajax.php file (under Case 8, around line 481) but when I inserted these lines immediately after it, it didn't seem to do anything. I keep getting the same error, "Cannot reach Canada Post Server. You may refresh this page..."

Please help! I need to get our site online and this module is the last barrier before we can launch it. Thanks again insaini for all your hard work and suggestions...

Chris


Chris, you can add those lines to the ship_canadapost.php function file.. located in /admin/includes/functions .. its the first function at the top of the file...
insaini
QUOTE (pueblito @ May 3 2008, 10:50 AM) *
Thanks J. Got that far, but I still get:
Failed check /../admin/includes/languages/english/ship_canadapost.php at line 17
This most likely means that Canada Post has changed their user interface. You need to
update your Canada Post Automatic Shipping Labels module
when I try to submit from the admin screen.



Hmm.. well thats just the general error .. at what step are you getting this error? I have just created a label yesterday and it went through fine..

also you could have a curl problem in that your curl version may not be the proper version, or you curl was not built with openssl (this is required for https access) .. you can be sure its the openssl problem if it wont get past step 2 (since it cant log you in via https) ..

J
pueblito
QUOTE (insaini @ May 4 2008, 09:21 AM) *
Hmm.. well thats just the general error .. at what step are you getting this error? I have just created a label yesterday and it went through fine..

also you could have a curl problem in that your curl version may not be the proper version, or you curl was not built with openssl (this is required for https access) .. you can be sure its the openssl problem if it wont get past step 2 (since it cant log you in via https) ..

J


Here is what server info shows for cURL/OpenSSL:

Curl
cURL support enabled
cURL Information libcurl/7.18.0 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5

And it is definitely the second step that is causing the problem.

Hmm.... any ideas?

Thanks!
insaini
QUOTE (pueblito @ May 4 2008, 12:41 PM) *
Here is what server info shows for cURL/OpenSSL:

Curl
cURL support enabled
cURL Information libcurl/7.18.0 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5

And it is definitely the second step that is causing the problem.

Hmm.... any ideas?

Thanks!


I believe curl also has to be built with libssh

cURL Information libcurl/7.18.0 OpenSSL/0.9.7a zlib/1.2.1.2 libssh2/0.18
pueblito
QUOTE (pueblito @ May 4 2008, 12:41 PM) *
Here is what server info shows for cURL/OpenSSL:

Curl
cURL support enabled
cURL Information libcurl/7.18.0 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5

And it is definitely the second step that is causing the problem.

Hmm.... any ideas?

Thanks!


Thanks Jesse. I will speak with the host, they've generally been responsive, let's see if they can fix it up. I'll post back with a follow up.

Cheers,

Ivan
chrisjclay
QUOTE (insaini @ May 4 2008, 06:18 AM) *
Chris, you can add those lines to the ship_canadapost.php function file.. located in /admin/includes/functions .. its the first function at the top of the file...


Argh... Still doesn't work. I have one last idea though... "darkknightenterprises" posted another fix here:

http://addons.oscommerce.com/info/391 ... called "A complete work around if you can not get your hosting provider to open port 30000!!!"

He suggests uploading a file, cpcall.php, to a friend's server which then "makes the call to the canadapost server from there and the cURL call from the canadapost.php file calls to it."

I uploaded the included test file to a friend's server and it successfully connected to Canada Post smile.gif So far so good... Now I'm just not sure how to modify the curl call on my own osCommerce site so it calls to the cpcall.php file on my friend's site. Here are the contents of the cpcall.php file that is now sitting on my friend's hosting account (not at GoDaddy!):

CODE
<?php
    function sendToHost($data)
    {
        set_time_limit(5);
        $ch = curl_init("sellonline.canadapost.ca:30000");
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_URL, "sellonline.canadapost.ca:30000");
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
        curl_setopt($ch, CURLOPT_DNS_CACHE_TIMEOUT, 2678400);
        curl_setopt( $ch, CURLOPT_HEADER, 0 );
        curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
        curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
        $buf = "";
        $buf = curl_exec($ch);
        curl_close( $ch );
        if($buf == "")
        {
            $buf = "<?xml version=\"1.0\" ?><eparcel><error><statusMessage>Cannot reach Canada Post Server. ".
                   "You may refresh this page (Press F5) to try again.</statusMessage></error></eparcel>";
        }
    return $buf;
    }

    $data = $_REQUEST['XMLRequest'];
    $response = sendToHost($strXML);
    echo $response;
?>


I assume this is meant to take the place of the function called "function cp_setup" in the file admin>includes>functions>ship_canadapost.php. Any ideas on what I need to do to force the Canada Post module to use the function "sendToHost" that's sitting on my friend's server (in the cpcall.php file) instead of the one found in ship_canadapost.php? If I can figure that out, I think everything else will fall into place. I highlighted in red the part of darkknightenterprise's instructions that don't make sense to me:

QUOTE ("darknightenterprises")
IF you have someone that has a web server online or an account with a web hosting company that has port 30000 open, just upload the test.php to that server and open it in your browser.

If port 30000 is open, you will see an XML response from the Canadapost server. If you don't, then you know that port 30000 is NOT open. IF it is then all you have to do is upload the cpcall.php to a directory on that server then put the URL to the cpcall.php in place of "http://www.yourserver.com/cpcall.php" and your CPC username in place of "CPC_DEMO_XML" in the canadapost.php file that upload it to your osCommerce store in catalog/includes/modules/shipping/canadapost.php and everything should be working perfectly.

I know that it is working because this is how I had to do it to get it to work and I am using this technique now. Good luck getting everything working for your store and may you prosper well in your endevors.


Chris
insaini
QUOTE (chrisjclay @ May 4 2008, 09:52 PM) *
Argh... Still doesn't work. I have one last idea though... "darkknightenterprises" posted another fix here:

http://addons.oscommerce.com/info/391 ... called "A complete work around if you can not get your hosting provider to open port 30000!!!"

He suggests uploading a file, cpcall.php, to a friend's server which then "makes the call to the canadapost server from there and the cURL call from the canadapost.php file calls to it."

I uploaded the included test file to a friend's server and it successfully connected to Canada Post smile.gif So far so good... Now I'm just not sure how to modify the curl call on my own osCommerce site so it calls to the cpcall.php file on my friend's site. Here are the contents of the cpcall.php file that is now sitting on my friend's hosting account (not at GoDaddy!):

CODE
<?php
    function sendToHost($data)
    {
        set_time_limit(5);
        $ch = curl_init("sellonline.canadapost.ca:30000");
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_URL, "sellonline.canadapost.ca:30000");
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
        curl_setopt($ch, CURLOPT_DNS_CACHE_TIMEOUT, 2678400);
        curl_setopt( $ch, CURLOPT_HEADER, 0 );
        curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
        curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
        $buf = "";
        $buf = curl_exec($ch);
        curl_close( $ch );
        if($buf == "")
        {
            $buf = "<?xml version=\"1.0\" ?><eparcel><error><statusMessage>Cannot reach Canada Post Server. ".
                   "You may refresh this page (Press F5) to try again.</statusMessage></error></eparcel>";
        }
    return $buf;
    }

    $data = $_REQUEST['XMLRequest'];
    $response = sendToHost($strXML);
    echo $response;
?>


I assume this is meant to take the place of the function called "function cp_setup" in the file admin>includes>functions>ship_canadapost.php. Any ideas on what I need to do to force the Canada Post module to use the function "sendToHost" that's sitting on my friend's server (in the cpcall.php file) instead of the one found in ship_canadapost.php? If I can figure that out, I think everything else will fall into place. I highlighted in red the part of darkknightenterprise's instructions that don't make sense to me:
Chris



chris.. you would have to place the call to this file in step one of the ajax file.. ship_canadapost_ajax.php load that up.. look at the first step (initialization) .. it has to go before anything else.. However. I do see a problem because the above url is sellonline (which is fine for shipping quotes) but the urls required for label generation are different..

now what I think is.. if you had a problem using godaddy's proxy server .. you may not have set it up correctly.. the automated labels software does not use port 30000 (only the shipping module does) .. be sure to modify the version of the shipping module ive included in the package with the modifications you just posted above (you may need to use your friends server for the shipping module via that php file you posted above) .. however for automated labels.. the proxy settings should have been enough..

one last thing.. when and what errors are you getting? are you getting errors from the shipping module? or the automated labels software?

J
chrisjclay
QUOTE (insaini @ May 5 2008, 03:49 AM) *
chris.. you would have to place the call to this file in step one of the ajax file.. ship_canadapost_ajax.php load that up.. look at the first step (initialization) .. it has to go before anything else.. However. I do see a problem because the above url is sellonline (which is fine for shipping quotes) but the urls required for label generation are different..


To be honest I don't know how to place the call to my friend's external server. I see case1 in ship_canadapost_ajax.php but I'm not sure how to proceed from there sad.gif I know some basic php but my skills are limited and this is over my head... I'm not sure which line of code I should be pasting the link to callcp.php. Right above case one I see several URLS - am I meant to replace one of them? i.e. Should I replace the url in the line that reads "define ('ORIGINAL REFERRER'...)" ? ... or the one in that reads "define (SSO, 'https://....')" ... or should I be looking at a different line of code?

QUOTE (insaini @ May 5 2008, 03:49 AM) *
however for automated labels.. the proxy settings should have been enough.. one last thing.. when and what errors are you getting? are you getting errors from the shipping module? or the automated labels software?


The error appears whenever I try making a test purchase. Each time I get to the "Delivery information" step during Checkout, I get this error:

QUOTE ("osCommerce error")
Cannot reach Canada Post Server. You may refresh this page (Press F5 on your keyboard) to try again.
If you prefer to use canadapost as your shipping method, please contact the The Tale of the Whale via Email.


I've actually never tried generating a label before - I didn't think I'd be able to until I successfully placed a test order. I just tried now for the first time and received this error:

QUOTE ("osCommerce error")
Progress Indicator
Step 1. Initialized.
Step 2. Error: Failed check in /home/content/t/a/l/taleofthewhale/html/store/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.


At any rate, I'm not too worried about the labels - it would be a nice bonus if they worked, but by far the most important thing right now is getting shipping prices from Canada Post during the checkout process.

I thought I'd try switching to GatorHost to see if I have better luck, but they seem to have placed my order on hold because I used Paypal for my payment and am outside the US (I'm in Canada). Anyway, if you have any more suggestions I'd appreciate them and would try them... Otherwise I'll get my order straightened out at GatorHost and try setting up the site there.

Regards,
Chris
insaini
QUOTE (chrisjclay @ May 6 2008, 01:58 AM) *
To be honest I don't know how to place the call to my friend's external server. I see case1 in ship_canadapost_ajax.php but I'm not sure how to proceed from there sad.gif I know some basic php but my skills are limited and this is over my head... I'm not sure which line of code I should be pasting the link to callcp.php. Right above case one I see several URLS - am I meant to replace one of them? i.e. Should I replace the url in the line that reads "define ('ORIGINAL REFERRER'...)" ? ... or the one in that reads "define (SSO, 'https://....')" ... or should I be looking at a different line of code?
The error appears whenever I try making a test purchase. Each time I get to the "Delivery information" step during Checkout, I get this error:
I've actually never tried generating a label before - I didn't think I'd be able to until I successfully placed a test order. I just tried now for the first time and received this error:
At any rate, I'm not too worried about the labels - it would be a nice bonus if they worked, but by far the most important thing right now is getting shipping prices from Canada Post during the checkout process.

I thought I'd try switching to GatorHost to see if I have better luck, but they seem to have placed my order on hold because I used Paypal for my payment and am outside the US (I'm in Canada). Anyway, if you have any more suggestions I'd appreciate them and would try them... Otherwise I'll get my order straightened out at GatorHost and try setting up the site there.

Regards,
Chris



Ahh ok so the changes you need to make are to the shipping module.. not the shipping labels files.. ship_canadapost* files are all for automated labels... the shipping module (only 1 file) is located at catalog/includes/modules/shipping/canadapost.php this is file you need to modify.. and you can modify it like the others have to connect to a friends server .. im sure you can find the modifications in one of the other canadapost shipping threads..

J
chrisjclay
I ended up transferring the site from GoDaddy to HostGator... I just installed the Canada Post Shipping Module 4.1 and it works smile.gif Woohoo! I should have done this much sooner. Thanks again insaini for all your suggestions smile.gif
KKT
Hey, I just had my programmer install this module for me.

He finished and said there's a few details I had to fill in myself, mainly this section (
Configure Canada Post Shipping Module 4.1) in the install.htm directions:

4. Go to your Canada Post module (admin package -> Modules -> Shipping -> Canada Post) and set your Venture One Login, Pass, Credit Card Alias for Label creation payments, and your Credit Card CVV (DO NOT STORE CREDIT CARD INFORMATION ON YOUR WEBSITE, LET CANADAPOST MAINTAIN IT FOR YOU!)

I'm familiar with the VentureOne program b/c I have a card for another small business I operate. However, I don't understand what this credit card information is referring to. I have to have credit card info stored somewhere? I don't recall needing a credit card to set up my VentureOne account.

Can someone please explain? Thanks.
insaini
QUOTE (KKT @ May 10 2008, 09:15 PM) *
Hey, I just had my programmer install this module for me.

He finished and said there's a few details I had to fill in myself, mainly this section (
Configure Canada Post Shipping Module 4.1) in the install.htm directions:

4. Go to your Canada Post module (admin package -> Modules -> Shipping -> Canada Post) and set your Venture One Login, Pass, Credit Card Alias for Label creation payments, and your Credit Card CVV (DO NOT STORE CREDIT CARD INFORMATION ON YOUR WEBSITE, LET CANADAPOST MAINTAIN IT FOR YOU!)

I'm familiar with the VentureOne program b/c I have a card for another small business I operate. However, I don't understand what this credit card information is referring to. I have to have credit card info stored somewhere? I don't recall needing a credit card to set up my VentureOne account.

Can someone please explain? Thanks.


The Credit Card is for when you use automated labels.. if you dont plan on using the automated labels functionality via the admin panel.. then you dont have to worry about it.. if however you intend on using automated labels.. then you need to log into the canadapost shipping application via www.canadapost.com once you login.. store your credit card info at www.canadapost.com once you have it stored there.. automated labels can use it with a reference.. which is the first and last 4 digits with 8 asterisks (*) in the middle .. ie 4324********2343 ... then all you need to pass to canadapost is this reference and the CVV which takes care of the payment for automated labels processing..

again you only need to store this information if you intend on using automated labels...

J
KKT
Okay, that makes sense--thank you.

One other question:
Once I enter in the weight of my items (including packaging I assume?) and my postal code, then is this module going to automatically determine accurate shipping rates for anywhere in the world? Or, do I have to do anything extra in my admin panels to make sure that can happen?

Thanks again.
KKT
And, am I required to buy certain labels from the post office to use the Automated Label aspect, or can I just buy blank labels and this contribution is going to print out the bar code and all other necessary info on those blank labels?

Thanks,
KKT
insaini
QUOTE (KKT @ May 12 2008, 12:24 PM) *
And, am I required to buy certain labels from the post office to use the Automated Label aspect, or can I just buy blank labels and this contribution is going to print out the bar code and all other necessary info on those blank labels?

Thanks,
KKT


The shipping module stores the total shipment weight with every order recorded and this is the value used when in the automated labels software.. if however the shipment weight isnt in the stored shipping details recorded for the order.. automated labels will display a message asking the user to input the correct shipment weight. However yes the shipping module will determine (as long as the dimensions and weights for each of your products has been added and is correct) the exact shipping costs to anyone in the world.. you can also specify a handling charge via your sellOnline account which is automatically added to the shipping charge to the customer as well as fuel charges, etc..

As for the labels.. I use FEDEX labels that I purchased off of ebay.. canadapost doesnt have labels.. although you can use any label sheet or even just blank paper and tape the label onto the box... however the label itself is the exact same as the label received from logging into the canada post shipping application.. barcodes and all that .. nothing to worry about..

J
KKT
Excellent--thanks so much for a fast and thorough reply.

-KKT
KKT
What about in the case of multiple purchases?

2 things I'm selling is Tshirts and Buttons.
I put into the admin the weight and measurements for a single tshirt and I do the same for the buttons--in the case that they are ordered individually.

But, say someone orders 2 Tshirts and 3 packs of buttons (all at once).

At that point, i would package them all together and how is the software going to prepare that price?
I can't seriously put in weight and measurements for every possible combination of what an order could be.

Thanks for your great support.

-KKT

insaini
QUOTE (KKT @ May 17 2008, 02:58 PM) *
What about in the case of multiple purchases?

2 things I'm selling is Tshirts and Buttons.
I put into the admin the weight and measurements for a single tshirt and I do the same for the buttons--in the case that they are ordered individually.

But, say someone orders 2 Tshirts and 3 packs of buttons (all at once).

At that point, i would package them all together and how is the software going to prepare that price?
I can't seriously put in weight and measurements for every possible combination of what an order could be.

Thanks for your great support.

-KKT


That is not a problem.. as long as you have the dimensions and weights entered for each individual item in your catalog .. and you have already defined your boxes in your sellOnline account.. canadapost figures out everything for you..
KKT
QUOTE (insaini @ May 18 2008, 10:01 AM) *
That is not a problem.. as long as you have the dimensions and weights entered for each individual item in your catalog .. and you have already defined your boxes in your sellOnline account.. canadapost figures out everything for you..



By sellOnline account do you mean the admin panel?
I put in the weight and measurements of two of my items in my admin (Categories/Products) and the individual shipping for each is around $6.20 which is normal, but when I put both items in my shopping cart and go to checkout, the shipping is $12.40 so it's just adding both separate amounts together. That's what I was concerned about b/c if i get an order for a shirt and one of my other items, I'm going to ship them together and it's not going to cost $12.40 to ship, it may even still fall under the $6.20. Make sense?

I thought maybe I was supposed to go do something at my canadapost.ca/obc account but that seems separate--just for printing out a label on a some random package not associated with my store.

Thanks,
KKT
insaini
QUOTE (KKT @ May 18 2008, 05:00 PM) *
By sellOnline account do you mean the admin panel?
I put in the weight and measurements of two of my items in my admin (Categories/Products) and the individual shipping for each is around $6.20 which is normal, but when I put both items in my shopping cart and go to checkout, the shipping is $12.40 so it's just adding both separate amounts together. That's what I was concerned about b/c if i get an order for a shirt and one of my other items, I'm going to ship them together and it's not going to cost $12.40 to ship, it may even still fall under the $6.20. Make sense?

I thought maybe I was supposed to go do something at my canadapost.ca/obc account but that seems separate--just for printing out a label on a some random package not associated with my store.

Thanks,
KKT


your sellonline account .. you login with your CPC ID .. I believe this is the address http://sellonline.canadapost.ca/servlet/LogonServlet

login, setup your boxes and shipping options and handling costs.. as per your shipping charge.. its based on item weight and item dimensions.. and canadapost does the calculations.. if for instance item 1 is say 5cm x 5cm x 5cm and item 2 is 10cm x 10cm x 10cm .. if you have a box that is 15cm x 15cm x 15cm .. canadapost will calculate that you can put upto 3 pieces of item 1 and 1 piece of item 2 .. it then adds the weight of these .. if however your selected items takes more space than one box.. i believe it calculates for multiple boxes.. now the charges youve received above seems as though its calculating for 2 separate shipments.. possibly because you havent added your boxes and setup the options in your sellonline account.

J

roback
Okay, installing this contrib on a OSC that already has products in it. followed the instructions and double checked (good instructions I might add) but I am getting some errors.

Firstly let me point out that I have not configured the CP account details yet, but I don't think that is causing the problem. I have also installed the Ultra Pics contrib and I believe that is where the problems are coming from.

So now lets look at the errors:
1) Front End - > shopping_cart.php (Immediately after clicking add to cart). Under the product list box I get the following error:
CODE
Sub-Total: 1054 - Unknown column 'p.products_length' in 'field list'

select p.products_id, pd.products_name, p.products_model, p.products_image, p.products_price, p.products_weight, p.products_length, p.products_width, p.products_height, p.products_ready_to_ship, p.products_tax_class_id from products p, products_description pd where p.products_id = '110' and pd.products_id = p.products_id and pd.language_id = '0'

[TEP STOP]


2)Back End -> Adding Product > Preview Product > Insert. (All part of the admin/categories.php page) When inserting a new product the additional fields appear in the for the CP tariffs, length, weight. But after previewing it and pressing Insert it produces this error:
CODE
1054 - Unknown column 'products_length' in 'field list'

insert into products (products_quantity, products_description_short, products_tariff, products_model, products_price, products_date_available, products_weight, products_length, products_height, products_width, products_ready_to_ship, products_status, products_tax_class_id, manufacturers_id, products_image, products_image_med, products_image_sm_1, products_image_xl_1, products_image_sm_2, products_image_xl_2, products_date_added) values ('100', 'CanPost MOD', 'NONE', '', '3', null, '2.5', '6', '1', '5', '1', '1', '1', '0', '120_bv_M.jpg', '120_bv_M.jpg', '121_bv_M.jpg', '121_bv_M.jpg', '121_fv_M.jpg', '121_fv_M.jpg', now())

[TEP STOP]


3)Back End - > Editing a product (Again admin/categories.php). You receive this error:
CODE
1054 - Unknown column 'p.products_length' in 'field list'

select pd.products_name, pd.products_description, p.products_description_short, p.products_tariff , pd.products_url, p.products_id, p.products_quantity, p.products_model, p.products_image, p.products_image_med, p.products_image_lrg, p.products_image_sm_1, p.products_image_xl_1, p.products_image_sm_2, p.products_image_xl_2, p.products_image_sm_3, p.products_image_xl_3, p.products_image_sm_4, p.products_image_xl_4, p.products_image_sm_5, p.products_image_xl_5, p.products_image_sm_6, p.products_image_xl_6, p.products_price, p.products_weight, p.products_length, p.products_width, p.products_height, p.products_ready_to_ship, p.products_date_added, p.products_last_modified, date_format(p.products_date_available, '%Y-%m-%d') as products_date_available, p.products_status, p.products_tax_class_id, p.manufacturers_id from products p, products_description pd where p.products_id = '154' and p.products_id = pd.products_id and pd.language_id = '1'

[TEP STOP]


Now I have two guesses at what the problem could be. All of these segments of code, which were amended from the UltraPic contrib already, are not as they should be. What I did is I compared the code from the instructions with the modified code of UltraPic From what I gathered is that UltraPic interjected a bunch of things between p.products_image and p.products_price. So I interject the weight, length, width, height and ready to ship between the p.products_price and p.products_date_added - effectively keeping things the same (or so I assumed).

the other guess is that the p.products_length was not set up in the database correctly. Though I have very limited experience with this, so I am not even sure how to check/debug this.

I hope that provides sufficient info for someone to help me out.

thanks

Rob
roback
QUOTE (roback @ May 23 2008, 11:28 AM) *
the other guess is that the p.products_length was not set up in the database correctly. Though I have very limited experience with this, so I am not even sure how to check/debug this.


The fine tooth comb of agony has revealed this:
There is no length, width, height or ready to ship column in the DB Products Table.... .... ....

Okay so I went back and did the sql command again... ta-da! Okay so that seemed to fix the errors in all 3 places... BUT now in the front end, My subtotal does not tally up on the first shopping_cart.php page (Or Cart Contents from top right nav). Very odd. No displayed errors. And when you walk through the rest of the checkout process to the checkout_confirmation.php page, it correctly displays the subtotal and other totals.

Any ideas?
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.