Results 1 to 8 of 8
  1. #1
    Join Date
    Feb 2008
    Location
    Boulder, CO, Dec 2: India
    Posts
    88
    Plugin Contributions
    0

    Default International address: simple add on for shipping

    Hi
    I'm looking for a simple way to make a dollar amount add on for international addresses. That means the script would need to detect an international address (the store is in the USA), and then add on a percentage of the normal shipping rate for that amount. I have the shipping on table rates at the moment. ZC v. 1.3.8

    thanks
    JSC, Boulder

  2. #2
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: International address: simple add on for shipping

    You could test if the:
    $order->delivery['country']['id']

    is 223 or not and if not, then add the additional amount to the cost ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  3. #3
    Join Date
    Feb 2008
    Location
    Boulder, CO, Dec 2: India
    Posts
    88
    Plugin Contributions
    0

    Default Re: International address: simple add on for shipping

    That is excellent Ajeh,

    so ... the US country code is 223. Then I test whether the country code is anything else other than that, if it is, I add the international surcharge. (I would want to exclude Canada from the surcharge.)

    Also, I am one of those developers who implements Zencart without knowing how to write PHP (or very little of it). So I would need an add on, like a plugin or something. Your solution is exactly right, but I'll need something I can "install" rather than write myself.

    BTW, what page would that mod go into, "tpl_checkout_shipping_default.php?"

    thanks,
    JSC

  4. #4
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: International address: simple add on for shipping

    This would be editing the shipping module itself ...

    Shipping modules are in the:
    /includes/modules/shipping

    directory and the changes need to be made to the file(s) that you are using ...

    If you are not able to customize the code yourself, you might want to post to the Commercial Help Wanted ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  5. #5
    Join Date
    Jul 2009
    Posts
    4
    Plugin Contributions
    0

    Default Re: International address: simple add on for shipping

    I'm trying to figure this one out myself. I have some basic programming knowledge and I think I'm getting close. If I can get this working I'll post up my findings.

  6. #6
    Join Date
    Jul 2009
    Posts
    4
    Plugin Contributions
    0

    Default Re: International address: simple add on for shipping

    Here's my very remedial solution. Open your shipping module file located in:

    /includes/modules/shipping

    In my case I'm using per weight unit shipping, so I'm editing the perweightunit.php file. You want to look for the quote function- in this file starts on line 93.

    Lines 97-102 make the initial quote calculation. The best bet is to grab that calculation and wrap the answer in an if/else statement- where you're adding an additional amount to the "quote" if the country is not 223. I haven't quite figured out the proper syntax to do that, so I just wrapped all of line 97-102 into the "if" part of my if/else statement and duplicated those same lines a second time into the "else" part.

    I used the conditional that Ajeh supplied andt set it to NOT equal 223 - the code inside that part of the conditional I added the "10" after the handling fee. The else code I left alone. I'm not sure if that makes sense, so here's my hack code:

    if ($order->delivery['country']['id'] != 223) {
    $this->quotes = array('id' => $this->code,
    'module' => MODULE_SHIPPING_PERWEIGHTUNIT_TEXT_TITLE,
    'methods' => array(array('id' => $this->code,
    'title' => MODULE_SHIPPING_PERWEIGHTUNIT_TEXT_WAY,
    'cost' => (MODULE_SHIPPING_PERWEIGHTUNIT_COST * $total_weight_units) + MODULE_SHIPPING_PERWEIGHTUNIT_HANDLING + 10)));
    }
    else {
    $this->quotes = array('id' => $this->code,
    'module' => MODULE_SHIPPING_PERWEIGHTUNIT_TEXT_TITLE,
    'methods' => array(array('id' => $this->code,
    'title' => MODULE_SHIPPING_PERWEIGHTUNIT_TEXT_WAY,
    'cost' => (MODULE_SHIPPING_PERWEIGHTUNIT_COST * $total_weight_units) + MODULE_SHIPPING_PERWEIGHTUNIT_HANDLING)));
    }



    Hope that helps...

  7. #7
    Join Date
    Nov 2007
    Location
    Upstate NY
    Posts
    232
    Plugin Contributions
    0

    Default Re: International address: simple add on for shipping

    Hi

    I'm trying to add $50 to international orders and no matter what I try the first part of this conditional is used and never the part after the else.

    I tried it as ['country']['id'] != 223 and ['country']['id'] = 223
    I put the + 50 at the beginning and at the end (before the last )))

    I added 100 to the first part and 50 to the second part. For every setting whatever happens in the first part of the statement is what takes effect, whether or not it's !=223 or =223. No matter what country.

    Can someone tell me what's wrong with this block?

    TIA


    /* If is international order add $50 shipping surcharge */
    if ($order->delivery['country']['id'] != 223) {
    $this->quotes = array('id' => $this->code,
    'module' => MODULE_SHIPPING_TABLE_TEXT_TITLE . $show_box_weight,
    'methods' => array(array('id' => $this->code,
    'title' => MODULE_SHIPPING_TABLE_TEXT_WAY,
    'cost' => 50 + $shipping + (MODULE_SHIPPING_TABLE_HANDLING_METHOD == 'Box' ? MODULE_SHIPPING_TABLE_HANDLING * $shipping_num_boxes : MODULE_SHIPPING_TABLE_HANDLING) ) ));
    }
    else {
    $this->quotes = array('id' => $this->code,
    'module' => MODULE_SHIPPING_TABLE_TEXT_TITLE . $show_box_weight,
    'methods' => array(array('id' => $this->code,
    'title' => MODULE_SHIPPING_TABLE_TEXT_WAY,
    'cost' => $shipping + (MODULE_SHIPPING_TABLE_HANDLING_METHOD == 'Box' ? MODULE_SHIPPING_TABLE_HANDLING * $shipping_num_boxes : MODULE_SHIPPING_TABLE_HANDLING)) ));

    }
    /* END If is international order add $50 shipping surcharge */

  8. #8
    Join Date
    Jun 2011
    Posts
    14
    Plugin Contributions
    0

    Default Re: International address: simple add on for shipping

    Quote Originally Posted by ryanc44 View Post
    Here's my very remedial solution. Open your shipping module file located in:

    /includes/modules/shipping

    In my case I'm using per weight unit shipping, so I'm editing the perweightunit.php file. You want to look for the quote function- in this file starts on line 93.

    Lines 97-102 make the initial quote calculation. The best bet is to grab that calculation and wrap the answer in an if/else statement- where you're adding an additional amount to the "quote" if the country is not 223. I haven't quite figured out the proper syntax to do that, so I just wrapped all of line 97-102 into the "if" part of my if/else statement and duplicated those same lines a second time into the "else" part.

    I used the conditional that Ajeh supplied andt set it to NOT equal 223 - the code inside that part of the conditional I added the "10" after the handling fee. The else code I left alone. I'm not sure if that makes sense, so here's my hack code:

    if ($order->delivery['country']['id'] != 223) {
    $this->quotes = array('id' => $this->code,
    'module' => MODULE_SHIPPING_PERWEIGHTUNIT_TEXT_TITLE,
    'methods' => array(array('id' => $this->code,
    'title' => MODULE_SHIPPING_PERWEIGHTUNIT_TEXT_WAY,
    'cost' => (MODULE_SHIPPING_PERWEIGHTUNIT_COST * $total_weight_units) + MODULE_SHIPPING_PERWEIGHTUNIT_HANDLING + 10)));
    }
    else {
    $this->quotes = array('id' => $this->code,
    'module' => MODULE_SHIPPING_PERWEIGHTUNIT_TEXT_TITLE,
    'methods' => array(array('id' => $this->code,
    'title' => MODULE_SHIPPING_PERWEIGHTUNIT_TEXT_WAY,
    'cost' => (MODULE_SHIPPING_PERWEIGHTUNIT_COST * $total_weight_units) + MODULE_SHIPPING_PERWEIGHTUNIT_HANDLING)));
    }



    Hope that helps...
    Did you remove any php from perweightunit.php to add this in, or do I just stick it in after the if statement at line 93, or do I replace the if statement above it and replace it with this?

    Thanks for your help,
    Jessica

 

 

Similar Threads

  1. v154 Simple "Free US Shipping and Flat Rate International"
    By Rick5150 in forum Built-in Shipping and Payment Modules
    Replies: 18
    Last Post: 26 Feb 2015, 04:12 PM
  2. v150 I'd like to add additional shipping for international orders
    By In2Deep in forum Addon Shipping Modules
    Replies: 15
    Last Post: 13 Jun 2013, 07:19 PM
  3. how do add international shipping charges?
    By globalsmoke in forum Built-in Shipping and Payment Modules
    Replies: 1
    Last Post: 13 May 2012, 08:40 PM
  4. Add UPS for International free Shipping
    By aditya369 in forum Built-in Shipping and Payment Modules
    Replies: 21
    Last Post: 19 Oct 2011, 02:15 PM
  5. International Shipping Address
    By skinnyalbert in forum Built-in Shipping and Payment Modules
    Replies: 0
    Last Post: 26 Sep 2011, 03:32 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