Page 2 of 2 FirstFirst 12
Results 11 to 15 of 15
  1. #11
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,489
    Plugin Contributions
    88

    Default Re: v155f: Setting the shipping module/method when no shipping is available

    Quote Originally Posted by mc12345678 View Post
    ... So, are you trying to replicate the functionality, or trying to be sure that appropriate options are displayed/made available?
    What I'm trying to do is point out a discrepancy in settings for the in-core 3-page checkout ... as I attempt to keep the 1-page checkout "in line". My belief is that the statement
    Code:
    if ((!isset($_SESSION['shipping']) || (!isset($_SESSION['shipping']['id']) || $_SESSION['shipping']['id'] == '') && zen_count_shipping_modules() >= 1)) $_SESSION['shipping'] = $shipping_modules->cheapest();
    has misplaced parentheses, causing the cheapest to be returned when there are no shipping modules to be set. Perhaps instead:
    Code:
    if ((!isset($_SESSION['shipping']) || !isset($_SESSION['shipping']['id']) || $_SESSION['shipping']['id'] == '') && zen_count_shipping_modules() >= 1) {
        $_SESSION['shipping'] = $shipping_modules->cheapest();
    }
    or, using De Morgan's Laws:
    Code:
    if (!(isset($_SESSION['shipping']) && isset($_SESSION['shipping']['id']) && $_SESSION['shipping']['id'] != '') && zen_count_shipping_modules() >= 1) {
        $_SESSION['shipping'] = $shipping_modules->cheapest();
    }

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

    Default Re: v155f: Setting the shipping module/method when no shipping is available

    Quote Originally Posted by lat9 View Post
    What I'm trying to do is point out a discrepancy in settings for the in-core 3-page checkout ... as I attempt to keep the 1-page checkout "in line". My belief is that the statement
    Code:
    if ((!isset($_SESSION['shipping']) || (!isset($_SESSION['shipping']['id']) || $_SESSION['shipping']['id'] == '') && zen_count_shipping_modules() >= 1)) $_SESSION['shipping'] = $shipping_modules->cheapest();
    has misplaced parentheses, causing the cheapest to be returned when there are no shipping modules to be set. Perhaps instead:
    Code:
    if ((!isset($_SESSION['shipping']) || !isset($_SESSION['shipping']['id']) || $_SESSION['shipping']['id'] == '') && zen_count_shipping_modules() >= 1) {
        $_SESSION['shipping'] = $shipping_modules->cheapest();
    }
    or, using De Morgan's Laws:
    Code:
    if (!(isset($_SESSION['shipping']) && isset($_SESSION['shipping']['id']) && $_SESSION['shipping']['id'] != '') && zen_count_shipping_modules() >= 1) {
        $_SESSION['shipping'] = $shipping_modules->cheapest();
    }
    That may be, but based on $shipping->cheapest() returning false instead of null that there still runs a potential issue in that $_SESSION['shipping'] can be set but not have a value of "worth" (ie. Can become an issue if used at the end notifier.) and that with the way checkout_payment has been modified that it doesn't reject landing at the checkout_payment page if $_SESSION['shipping'] is set to false... ie instead of checking if !isset($_SESSION['shipping']) it should instead check if empty($_SESSION['shipping'])...

    The cheapest() function remains an issue as written in regards to $_SESSION['shipping'] remaining either unset or an array if the only shipping method(s) defined are those that are omitted from being returned as a cheapest option.

    Such that even if the final above if statement were used, then $_SESSION['shipping'] would be set to false if the only available (and enabled) option were the instore pickup module...
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  3. #13
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,489
    Plugin Contributions
    88

    Default Re: v155f: Setting the shipping module/method when no shipping is available

    Whether the function returns false or null is immaterial ... as the code stands, it will still result in $_SESSION['shipping'] to be set to a non-array value when no shipping is available.

    The point is that the clause under-investigation, IMO, should not set an invalid value into $_SESSION['shipping'] if there are no shipping modules available.

  4. #14
    Join Date
    Jul 2012
    Posts
    16,733
    Plugin Contributions
    17

    Default Re: v155f: Setting the shipping module/method when no shipping is available

    Quote Originally Posted by lat9 View Post
    Whether the function returns false or null is immaterial ... as the code stands, it will still result in $_SESSION['shipping'] to be set to a non-array value when no shipping is available.

    The point is that the clause under-investigation, IMO, should not set an invalid value into $_SESSION['shipping'] if there are no shipping modules available.
    To be clear then, what is the definition of a shipping module not being available that is being used?

    In the first paragraph state that it will be a non-array value if one is not-available but then in second paragraph describe an invalid value for the same lack of an available method.

    What constitutes a valid value? Earlier in the thread (understandably a memory recall/direction possibly subject to more information) indicated that it should either be not set or set to an array. Being set to a non-array is still set and doesn't meet that condition.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  5. #15
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,489
    Plugin Contributions
    88

    Default Re: v155f: Setting the shipping module/method when no shipping is available

    Quote Originally Posted by mc12345678 View Post
    To be clear then, what is the definition of a shipping module not being available that is being used?

    In the first paragraph state that it will be a non-array value if one is not-available but then in second paragraph describe an invalid value for the same lack of an available method.

    What constitutes a valid value? Earlier in the thread (understandably a memory recall/direction possibly subject to more information) indicated that it should either be not set or set to an array. Being set to a non-array is still set and doesn't meet that condition.
    Shipping modules can be configured to be enabled for specific zones only ... or based on other conditions, so it's quite possible for a customer to begin a checkout that can't be fulfilled.

    As I said before, I believe that $_SESSION['shipping'] should either not be set or set to an array value (which could be empty).

 

 
Page 2 of 2 FirstFirst 12

Similar Threads

  1. This is currently the only shipping method available to use on this order.
    By dean5000v in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 28 Oct 2009, 03:17 PM
  2. Disable flat rate shipping when free shipping available
    By kazie in forum Built-in Shipping and Payment Modules
    Replies: 7
    Last Post: 6 Oct 2009, 09:59 PM
  3. Only show payment method when UPS shipping method chosen?
    By helen610 in forum Built-in Shipping and Payment Modules
    Replies: 1
    Last Post: 28 Aug 2008, 03:04 AM
  4. Replies: 5
    Last Post: 7 Oct 2006, 05:14 AM
  5. Confused on setting up the shipping module?
    By IncrediBody in forum Built-in Shipping and Payment Modules
    Replies: 7
    Last Post: 31 Aug 2006, 05:27 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