Page 2 of 2 FirstFirst 12
Results 11 to 17 of 17
  1. #11
    Join Date
    Jul 2012
    Posts
    16,732
    Plugin Contributions
    17

    Default Re: How do I customize handling weights for this module?

    Still reviewing the major code element, but for clarification, yes the constant > the value is the same as the value < constant, but note the difference in code to be performed following the two examples RodG provided. In his second version, the method is turned on (regardless of any previous off signal) if the shipping weight (yes still to be addressed) is greater than the constant but turned off or remains off if the shipping weight is less that the constant.

    Again, all a matter of perspective and desire.

    Now back to the code review.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  2. #12
    Join Date
    Aug 2005
    Location
    Australia
    Posts
    110
    Plugin Contributions
    1

    Default Re: How do I customize handling weights for this module?

    Each time I have tried to make this work by adding the database value, I have uninstalled and re-installed the module. I have the constant showing in the admin settings for the module but the module fails to disable when the shipping weight reaches the threshold set. It does work with the money limit value and disable when the threshold is reached. This is what makes me wonder what the problem is a problem with the code finding the shipping weight.
    Cheers all,

    Gruntre69

    WayCool
    Zen is Way Cool too!

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

    Default Re: How do I customize handling weights for this module?

    In the function in the above code:
    Code:
        function platinum() {
          global $order, $db;
    Suggest the following modifications:
    Code:
        function __construct() {
          global $order, $db, $shipping_weight;
    I used bold to identify the two changes of making the shipping module PHP 7.0 compliant as well as adding the $shipping_weight value to the constructor. I did *not* modify your use of < or > in the comparison, as that issue still seems to be open.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  4. #14
    Join Date
    Jan 2007
    Location
    Australia
    Posts
    6,167
    Plugin Contributions
    7

    Default Re: How do I customize handling weights for this module?

    Quote Originally Posted by gruntre69 View Post
    I have a feeling that the shipping weight ($shipping_weight) is not available at that line of the code
    Its a shipping module, its going to have the shipping weight available:)

    Try adding a line
    global $shipping_weight ;
    Near the start of the file/function.

    Also, please check other shipping modules to ensure that ive got the variable name correct (im working from memory here, and not even checking if my code examples are correct or not)...

    Sorry, I cant comment on any of the code you supplied this time around, im using a mobile phone at the moment... screen is too small).

    Please follow whatever advice mc1-8 provides (you are in good hands there). He is one of those that i expected would step in as soon as I responded to this thread. :)

    Cheers
    RodG

  5. #15
    Join Date
    Jan 2007
    Location
    Australia
    Posts
    6,167
    Plugin Contributions
    7

    Default Re: How do I customize handling weights for this module?

    Quote Originally Posted by mc12345678 View Post
    In the function in the above code:
    Suggest the following modifications:
    Code:
        function __construct() {
          global $order, $db, $shipping_weight;
    I used bold to identify the two changes of making the shipping module PHP 7.0 compliant as well as adding the $shipping_weight value to the constructor
    Excellent suggestions (stated mainly for the benefit of the OP). Personally I wouldn't have thought about this future proofing while providing the almost certain fix. And you did it without making my head spin for a change <grin>

    G'night
    RodG

  6. #16
    Join Date
    Aug 2005
    Location
    Australia
    Posts
    110
    Plugin Contributions
    1

    Default Re: How do I customize handling weights for this module?

    Quote Originally Posted by mc12345678 View Post
    In the function in the above code:
    Code:
        function platinum() {
          global $order, $db;
    Suggest the following modifications:
    Code:
        function __construct() {
          global $order, $db, $shipping_weight;
    I used bold to identify the two changes of making the shipping module PHP 7.0 compliant as well as adding the $shipping_weight value to the constructor. I did *not* modify your use of < or > in the comparison, as that issue still seems to be open.
    Thank you very much. This has fixed it and it now works! All I need to do now is clone the modules. I really appreciate your help!
    Cheers all,

    Gruntre69

    WayCool
    Zen is Way Cool too!

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

    Default Re: How do I customize handling weights for this module?

    Quote Originally Posted by RodG View Post
    Its a shipping module, its going to have the shipping weight available:)

    Try adding a line
    global $shipping_weight ;
    Near the start of the file/function.

    Also, please check other shipping modules to ensure that ive got the variable name correct (im working from memory here, and not even checking if my code examples are correct or not)...

    Sorry, I cant comment on any of the code you supplied this time around, im using a mobile phone at the moment... screen is too small).

    Please follow whatever advice mc1-8 provides (you are in good hands there). He is one of those that i expected would step in as soon as I responded to this thread. :)

    Cheers
    RodG
    I actually had this one in my "queue" to which to return. Wasn't too sure at the time to which "part" to reply. General weight issue or the dimensional part. :) one far easier than the other. :)

    Although testing hadn't been performed the code when followed did show a difference. Just took a little more than reading the if part of the statement. (personally I had originally overlooked the two sets of code just expecting them to be in some way different. :) and wasn't until they were "called out" that I looked further.)

    Yeah, it's unfortunate that most of the work to make relatively functional "basic" code operational with PHP 7.0 is all in renaming the class constructor. There are some that do more advanced ops or were constructed to be somewhat generic that still require a little effort, but that's not frequent.

    Sadly when I was learning PHP a few years ago, I had begun with that constructor, but then seeing how other ZC apps were written (new and old), I "conformed". I am back on track now.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

 

 
Page 2 of 2 FirstFirst 12

Similar Threads

  1. v154 USPS module returning different rates for same weights
    By Phil S in forum Built-in Shipping and Payment Modules
    Replies: 10
    Last Post: 19 Dec 2015, 05:21 AM
  2. Flat Rate Handling Fee for Payment Module
    By AngiePoo in forum Built-in Shipping and Payment Modules
    Replies: 2
    Last Post: 17 Jan 2010, 09:42 AM
  3. How do I approach this? Max shipping weights
    By Dunk in forum Built-in Shipping and Payment Modules
    Replies: 4
    Last Post: 21 Jan 2009, 05:28 PM
  4. USPS module, disabling a service for certain weights
    By dman76 in forum Built-in Shipping and Payment Modules
    Replies: 1
    Last Post: 18 Nov 2007, 01:58 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