Page 1 of 2 12 LastLast
Results 1 to 10 of 13
  1. #1
    Join Date
    Feb 2014
    Posts
    42
    Plugin Contributions
    0

    Default Using Zones with cloned flat rate modules

    HI,

    I have cloned flat.php to flatlow.php,flatmed.php and flathigh.php hoping that I can simply trigger flatlow.php if product is under .6 lbs, flatmed.php if it is .6-1 lbs and flathigh.php if it exceeds 1 lbs.

    I installed zones.php and configured 3 zones. When I go to the flat modules, under Shipping Zones it says -none-.

    Questions:

    Am I on the right path here? I want it to just show "Flat rate $5" if up to .6 lbs, "Flat rate $9" if up to 1 lbs, etc. It shows 3 radio buttons and lets the user select so my assumption is I need to configure zones but it doesn't see any of the zones in each flat rate cloned module.

    My drop shipper uses various shipping methods, not always UPS or USPS etc so I want to make this as mindless as possible for the customer.

    Thanks

  2. #2
    Join Date
    Jul 2012
    Posts
    16,732
    Plugin Contributions
    17

    Default Re: Using Zones with cloned flat rate modules

    It's unfortunate that has taken this long for help to be provided on this. I happened to scroll through new posts and saw that there were no replies to this and thought I would see what was up.

    From the detail of the Original Post (OP) it looks like in your list of modules->shipping that you have at least 4 shipping modules enabled. The three clones and then zones. The first three to support weight related processing with the desire to have each also active for various zones. The fourth appears to have been added with the possibility of it also controlling the first three.

    Thing is, that generally speaking each of these shipping modules is independent. The zones module does not control the low, med, nor hi modules.

    The dropdown described as having --none-- is pulling data from the localities area of the admin where zones can be configured. Once configured, they become available for selection.

    Depending on how many zones are to be used and how many of those modules are to be used for each zone, the shipping modules may need to be cloned for each such combination.

    There is a commercial module that can further simplify this and do much more to provide accurate shipping costs, but that really depends on what your overall needs are.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  3. #3
    Join Date
    Feb 2014
    Posts
    42
    Plugin Contributions
    0

    Default Re: Using Zones with cloned flat rate modules

    mc12345678,

    Thanks a mil for the response. You understand completely. I only cater to the US market, and the break down for shipping is 0-.6lbs, .6lbs-1lbs, and then beyond 1lbs.

    Do I need to write code in order to have an if/else happen like "If under .6lbs use flat ratelow.php" ? How do I tell the checkout process to just use one module based on weight?

    Thank you thank you

  4. #4
    Join Date
    Feb 2014
    Posts
    42
    Plugin Contributions
    0

    Default Re: Using Zones with cloned flat rate modules

    Can I really be the only person who has this issue, needing the ability to configure 3 flat rate modules that ZC only shows based on weight?

    It seems straight forward but fails. If there is a how-to somewhere I would appreciate the info.

  5. #5
    Join Date
    Jul 2012
    Posts
    16,732
    Plugin Contributions
    17

    Default Re: Using Zones with cloned flat rate modules

    There have been others with the same module(s) or others, generally speaking the process is the same. Sometimes the code goes in the __construct method, sometimes in the quote method.

    For this (untested) it looks like could incorporate as follows:
    At the end of the __construct method, the following code is expected:
    Code:
          if ($check_flag == false) {
              $this->enabled = false;
            }
          }
        }
    Before the method's closing curly bracket, may want to add this for each of the methods:
    Code:
      if (IS_ADMIN_FLAG != true && $this->enabled == true) {
        $weight = array();
        $weight['use_min'] = false; // set to true/false if the min weight is needed for evaluation
        $weight['use_max'] = true; // set to true/false if the max weight is needed for evaluation 
        $weight['min'] = 0; // enter smallest weight that is permitted for this method
        $weight['max'] = 0.6; // enter weight under which this method still is available.
    
        //if weight of order is outside the band of the allowed, then disable this method.
        if (($weight['use_min'] && $order->total_weight < $weight['min']) || ($weight['use_max'] && $order->total_weight >= $weight['max'])) {
          $this->enabled = false;
        }
      }
    So the above would look like:
    Code:
          if ($check_flag == false) {
              $this->enabled = false;
            }
          }
      if ($this->enabled == true) {
        $weight = array();
        $weight['use_min'] = false; // set to true/false if the min weight is needed for evaluation
        $weight['use_max'] = true; // set to true/false if the max weight is needed for evaluation 
        $weight['min'] = 0; // enter smallest weight that is permitted for this method
        $weight['max'] = 0.6; // enter weight under which this method still is available.
    
        //if weight of order is outside the band of the allowed, then disable this method.
        if (($weight['use_min'] && $order->total_weight < $weight['min']) || ($weight['use_max'] && $order->total_weight >= $weight['max'])) {
          $this->enabled = false;
        }
      }
        }
    For your min flat rate, would say that don't need to use the min value. This is as shown above.
    For your mid rate, would need the low and high values and they need to be set accordingly.
    For your high rate, you may want to limit to your highest weight you will ship, but otherwise would not use the max value.

    Then there is the thought of incorporating those values into the setup instead of being coded with straight numbers as above. That too could be done so that the values are controllable in the admin instead of the file.

    Shoot. I posted before verifying ->total_weight was the right value to use... won't have time to search and edit before post locks. If I'm wrong I'll have to make a separate post. Sorry... meant to search before posting.
    Last edited by mc12345678; 27 Jun 2019 at 08:04 PM.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  6. #6
    Join Date
    Feb 2014
    Posts
    42
    Plugin Contributions
    0

    Default Re: Using Zones with cloned flat rate modules

    Thanks so much for the help.

    What file(s) are we suggesting I edit? Are we suggesting I clone other files to hardcode the values below?

    In -

    $weight = array();
    $weight['use_min'] = false; // set to true/false if the min weight is needed for evaluation
    $weight['use_max'] = true; // set to true/false if the max weight is needed for evaluation
    $weight['min'] = 0; // enter smallest weight that is permitted for this method
    $weight['max'] = 0.6; // enter weight under which this method still is available.

    Am I going to swap use_max for a literal value like 1.0 -

    $weight['1.0'] = true; // set to true/false if the max weight is needed for evaluation

    I'm ok hardcoding the functionality this round. When I get it working I'll report back and then move to making it part of admin.

    Thanks again!

    Eric

  7. #7
    Join Date
    Jul 2012
    Posts
    16,732
    Plugin Contributions
    17

    Default Re: Using Zones with cloned flat rate modules

    The things you would change would be: true, false, 0, and 0.6...
    For the low, use as above.
    For mid: true, true, 0.6, 1.0
    For high: true, false, 1.0, 1000

    The code above is placed in each of the cloned modules. I wrote it so that it could easily be incorporated into all such modules.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  8. #8
    Join Date
    Feb 2014
    Posts
    42
    Plugin Contributions
    0

    Default Re: Using Zones with cloned flat rate modules

    Howdy,

    Plugged in the values in each and it likes flatlow.php, but it doesn't like flatmed.php or flathigh.php. I say doesn't like as admin has the color set to yellow not green, and when I get to anything over .6lbs it only shows flatlow.php.

    Any ideas?

    Eric

  9. #9
    Join Date
    Jul 2012
    Posts
    16,732
    Plugin Contributions
    17

    Default Re: Using Zones with cloned flat rate modules

    Quote Originally Posted by erica62 View Post
    Howdy,

    Plugged in the values in each and it likes flatlow.php, but it doesn't like flatmed.php or flathigh.php. I say doesn't like as admin has the color set to yellow not green, and when I get to anything over .6lbs it only shows flatlow.php.

    Any ideas?

    Eric
    The condition seen on the admin side is not unexpected. When simply looking at the list of shipping modules there is no $order really to evaluate, so only the low would be expected to meet the full criteria.

    That said, when performing checkout, if the variable $order is populated with the product, then only the expected modules should be displayed. That begs the question of at what point(s) in checkout is the associated med or high not showing?

    It could be that need to use the $_SESSION['cart'] variable and associated total weight instead of the $order variable.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  10. #10
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,478
    Plugin Contributions
    88

    Default Re: Using Zones with cloned flat rate modules

    Is there a reason why the built-in table rate shipping doesn't work?

    Set it up to work by the order's weight then specify 0.6:ss,1.0:mm,10000:hhwhere ss is the price to charge when the weight is < 0.6, mm is the price for orders weighing 0.6-1.0 and hh is the price for orders over 1.0?

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. v139h Shipping Module Flat Rate with Zones Set Up
    By bookwise in forum Built-in Shipping and Payment Modules
    Replies: 3
    Last Post: 15 Jan 2012, 09:17 PM
  2. Flat rate shipping not working with zones
    By froldao in forum Built-in Shipping and Payment Modules
    Replies: 3
    Last Post: 23 Feb 2011, 01:18 PM
  3. Flat Rate Shipping with Zones
    By BotRot in forum General Questions
    Replies: 4
    Last Post: 8 Oct 2010, 04:28 AM
  4. Cloned Flat Rate Not Showing
    By forced in forum Addon Shipping Modules
    Replies: 15
    Last Post: 17 Aug 2010, 05:31 AM
  5. My cloned flat and freeoptions modules don't work
    By breadfan in forum Built-in Shipping and Payment Modules
    Replies: 6
    Last Post: 23 Sep 2008, 04:45 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