Page 1 of 2 12 LastLast
Results 1 to 10 of 14
  1. #1
    Join Date
    Dec 2010
    Location
    Central Indiana
    Posts
    36
    Plugin Contributions
    0

    Default Check Weight AND Zone to Use This Module

    We need to tweak our USPS shipping module.
    It is currently set to only show when the weight is >=2 (greater than or equal to 2 pounds).
    We need it to only do this only for a specific zone.

    So...

    If the weight is <2 pounds AND the zone is US48, don't show this.
    In all other cases, show this module.

    We have fixed shipping for orders under 2 pounds in the US 48 states only, so if someone orders from Hawaii, or any other part of the world, they would see the regular USPS rate only.

    Thanks in advance,

    Joe

  2. #2
    Join Date
    Dec 2010
    Location
    Central Indiana
    Posts
    36
    Plugin Contributions
    0

    Default Re: Check Weight AND Zone to Use This Module

    To make it easier...

    How about we say "don't show this module if the weight is less than 2 for zones 99 and 100 only."

    If weight <2 and geo_zone =99 or 100, false. Else true.

    I am really stretching my available brain power (my wife says that I'm one step above blithering...)

    Joe

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

    Default Re: Check Weight AND Zone to Use This Module

    Try this for me ...

    Edit the file:
    /includes/modules/usps.php

    and add the code in red above the code in black ...
    Code:
    echo 'Country: ' . $order->delivery['country_id'] . ' State: ' . $order->delivery['zone_id'] . '<br>';
        // disable only when entire cart is free shipping
    Now add something to the cart and go to the Shipping Estimator and set the Country to United States ...

    set the state to Alaska ... and click Update what does it say?

    Now set to Hawaii ... and click Update what does it say?
    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!

  4. #4
    Join Date
    Dec 2010
    Location
    Central Indiana
    Posts
    36
    Plugin Contributions
    0

    Default Re: Check Weight AND Zone to Use This Module

    It works normally.
    I have zone 99 (US 48) set to show the two fixed options (under 2 pounds).
    Since AK and HI are not in 99, only USPS shows. This is correct.
    However, if you select a state in zone 99, it shows the fixed rates and USPS. I don't want USPS to show when the weight is <2 in zone 99...
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	AK.jpg 
Views:	63 
Size:	44.0 KB 
ID:	8817   Click image for larger version. 

Name:	HI.jpg 
Views:	55 
Size:	43.3 KB 
ID:	8818   Click image for larger version. 

Name:	FL.jpg 
Views:	53 
Size:	45.6 KB 
ID:	8819  


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

    Default Re: Check Weight AND Zone to Use This Module

    If you were to add the Zone for the US 48 to the USPS shipping module ... then customize the code so that is only checked when the weight is < 2, would that work for you?

    Example:
    Code:
    global $cart;
    if (!IS_ADMIN_FLAG && $_SESSION['cart']->show_weight() < 2) {
        if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_USPS_ZONE > 0) ) {
          $check_flag = false;
          $check = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_USPS_ZONE . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id");
          while (!$check->EOF) {
            if ($check->fields['zone_id'] < 1) {
              $check_flag = true;
              break;
            } elseif ($check->fields['zone_id'] == $order->delivery['zone_id']) {
              $check_flag = true;
              break;
            }
            $check->MoveNext();
          }
    
          if ($check_flag == false) {
            $this->enabled = false;
          }
        }
    }
    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!

  6. #6
    Join Date
    Dec 2010
    Location
    Central Indiana
    Posts
    36
    Plugin Contributions
    0

    Default Re: Check Weight AND Zone to Use This Module

    That sounds like it would work.
    I list the USPS shipping zone as 99 (my US 48 definition).
    Then add your code to the USPS module.
    I just don't see where in the code to specifty 99...

    Joe

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

    Default Re: Check Weight AND Zone to Use This Module

    You don't ...

    The idea is to *only* check that the 48 states is selected when the weight is < 2 ... otherwise, not to test the Zone setting on the module ...

    This would then let everything run USPS and then test if < 2 ...

    Does that work for you? Or is that not limiting things enough?
    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!

  8. #8
    Join Date
    Dec 2010
    Location
    Central Indiana
    Posts
    36
    Plugin Contributions
    0

    Default Re: Check Weight AND Zone to Use This Module

    That would work fine.
    I cant get it to work though.
    When I put a zone in the USPS module, the code changes above don't seem to have any effect.

    Joe

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

    Default Re: Check Weight AND Zone to Use This Module

    Did you add the Zone for the 48 States?

    That Zone restriction should only work when the weight is < 2 ...
    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!

  10. #10
    Join Date
    Dec 2010
    Location
    Central Indiana
    Posts
    36
    Plugin Contributions
    0

    Default Re: Check Weight AND Zone to Use This Module

    Yes. Added US 48 zone.

    Here is what happens:
    <2 in US still shows USPS (should not)
    <2 non US shows no shipping methods (should show USPS)
    >2 US works fine
    >2 non US works fine

    Is it possible that the code change is backwards?
    In the process above, both (less than 2) should be switched.

    Joe

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 2
    Last Post: 4 Jan 2013, 02:52 PM
  2. Shipping by Weight and Zone
    By hc1501 in forum Built-in Shipping and Payment Modules
    Replies: 0
    Last Post: 8 Sep 2010, 11:30 AM
  3. Weight and Zone Shipping
    By bromleysid in forum Built-in Shipping and Payment Modules
    Replies: 3
    Last Post: 25 Feb 2010, 05:14 PM
  4. Custom Zone Definitions, ISO Code, and the Zone Rate Module
    By coffeefan in forum Built-in Shipping and Payment Modules
    Replies: 0
    Last Post: 16 Jul 2009, 10:47 PM
  5. Attribute weight and zone shipping
    By KTNaturals in forum Built-in Shipping and Payment Modules
    Replies: 4
    Last Post: 13 Jan 2008, 03:49 PM

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