I've created a new Page Module (By creating a folder in "includes/modules/pages", and adding a "header_php.php" file there.)
It loads when I go to "index.php?main_page=my_page".
On that page, I would like to display rate quotes from the installed shipping modules. (Code listed below)
I'm getting errors back from the shipping APIs, because I haven't set the shipping address anywhere.
We are unable to obtain a rate quote for UPS shipping.
Please contact the store if no other alternative is shown.
I have the full shipping address already, in a variable. What I don't know, is how to pass that variable into the shipping class (or wherever it needs to go) to make it work.
-2147219080 - Missing value for Country.
I'm using this code:
// $MyZip = '12345';
// $MyCountry = 'Some Country';
// Somehow, I need to setup the shipping address here,
// so that the shipping module can find it!
$total_weight = $_SESSION['cart']->show_weight();
$total_count = $_SESSION['cart']->count_contents();
// load all enabled shipping modules
require_once(DIR_WS_CLASSES . 'http_client.php');
require(DIR_WS_CLASSES . 'shipping.php');
$shipping_modules = new shipping;
$Quotes = $shipping_modules->quote();
foreach($Quotes AS $Quote)
$HTML .= '<div style="border:1px solid gray; margin:10px;">';
$HTML .= $Quote['error'];
$HTML .= $Quote['module'];
foreach($Quote['methods'] AS $Method)
$HTML .= $Method['cost'] . $Method['title'] . $Method['id'];
$HTML .= '</div>';
echo 'var HTML = "'.rawurlencode($HTML).'";';