For those of you following this (or come across it in the future) here's what happened. It turns out you NEED to read in the variables being passed from ShopSite before it will work. SO to test your own setup here's what you need to do.
1) be sure you can talk to PHP via the command line. Use SSH to connect and enter php -i If you get a boatload of data about PHP and paths and variable then you're good to go. If not, you may need to locate where php is loaded and use that path - a typical path is: /usr/local/bin/php
2) Setup your Custom Shipping API to point to the file. Be sure it's in the correct location (on the custom shipping api config page within ShopSite admin you'll see the path it expects). Be sure the Ship From zip code is filled in.
3) I used the following very simple PHP file to test the connection and setup.
- Code: Select all
#!/usr/local/bin/php -q
<?php
$stdin = fopen("php://stdin","r");
fscanf($stdin,"%{$_SERVER['CONTENT_LENGTH']}s",$query_string);
parse_str($query_string,$params);
print "status=pass\n";
print "option_count=1\n";
print "s1option=Your Shipping\n";
print "s1price=5.00\n";
?>
The first part of the code came from Michael Wong's original post a few years ago (see below). I updated the PHP server variable to reflect the current syntax ($_SERVER instead of $SERVER).
4) Put the file on the server in the correct location, check that permissions and ownership are the same as on order.cgi (which should be in the same directory).
5) Be sure your Shipping Addon info is saved and that you saved changes on the Shipping configuration page too.
6) Go put something in the cart and view the cart. YOu should see Your Shipping option among the other shipping options.
HTH
G
Followup Resources
1)
http://support.shopsite.com/forums/viewtopic.php?t=2028