Results 1 to 2 of 2
  1. #1
    Join Date
    May 2008
    Posts
    17
    Plugin Contributions
    0

    Default How do I pass the Shipping Address into the shipping module?

    Hi everyone,

    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.

    UPS:
    Code:
    We are unable to obtain a rate quote for UPS shipping.
    Please contact the store if no other alternative is shown.
    USPS:
    Code:
    -2147219080 - Missing value for Country.
    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.

    I'm using this code:

    PHP Code:
    function GetShippingMethods()
    {   
       
    // $MyZip = '12345';
    // $MyCountry = 'Some Country';
    // etc...
    // 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;">';
          if(isset(
    $Quote['error']))
          {
             
    $HTML .= $Quote['error'];
          }
          else
          {
             
    $HTML .= $Quote['module'];
             foreach(
    $Quote['methods'] AS $Method)
             {
                
    $HTML .= $Method['cost'] . $Method['title'] . $Method['id'];        
             }
          }
          
    $HTML .= '</div>';
       }
       echo 
    'var HTML = "'.rawurlencode($HTML).'";';

    Thanks,

    Nick

  2. #2
    Join Date
    May 2008
    Posts
    17
    Plugin Contributions
    0

    Default Re: How do I pass the Shipping Address into the shipping module?

    * bump *

 

 

Similar Threads

  1. PayPal Module Shipping Address uses Buyer Name
    By TechnoSwiss in forum General Questions
    Replies: 5
    Last Post: 13 Apr 2009, 09:21 PM
  2. Shipping address module needed.. PLEASE HELP!
    By ky3bka in forum Addon Shipping Modules
    Replies: 1
    Last Post: 16 Oct 2008, 07:53 AM
  3. Shipping address module needed.. PLEASE HELP!
    By ky3bka in forum Built-in Shipping and Payment Modules
    Replies: 1
    Last Post: 16 Oct 2008, 06:37 AM
  4. PLEASE HELP! Shipping address module needed..
    By ky3bka in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 16 Oct 2008, 06:34 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •