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. USPS - how do I pass variables to the module to add dimensions
    By petepdx in forum Addon Shipping Modules
    Replies: 0
    Last Post: 24 Mar 2013, 03:22 AM
  2. How can I display the shipping address?
    By bparker in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 3 Oct 2009, 10:25 PM
  3. How to Change the language on the shipping module?
    By bjraines in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 25 May 2009, 02:34 AM
  4. How do I get my Shipping rates based on the Billing address instead?
    By multichild in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 22 Nov 2007, 03:16 PM
  5. Replies: 1
    Last Post: 7 Oct 2007, 05:30 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
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR