Page 1 of 2 12 LastLast
Results 1 to 10 of 18
  1. #1
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,399
    Plugin Contributions
    87

    Default How can an order be valid without $_SESSION['shipping'] being set?

    I've noted zc156 since I'm chasing an issue on a site with zc156c installed, but the question is still valid for zc157+.

    Notice that the zc157c version of the order.php class (lines 312 thru 326):
    Code:
        $shipping_module_code = '';
        // A shipping-module's 'code', if present in the session, **must** contain a '_' character, separating
        // the shipping module's name from the selected method, e.g. 'module_method'.  That '_' cannot be the first
        // character of the 'code' value.
        //
        // If that's not the case, issue a PHP Notice and reset the shipping to its unselected state.
        //
        if (isset($_SESSION['shipping'])) {
            if (!empty($_SESSION['shipping']['id']) && strpos((string)$_SESSION['shipping']['id'], '_')) {
                $shipping_module_code = $_SESSION['shipping']['id'];
            } else {
                trigger_error('Malformed value for session-based shipping module; customer will need to re-select: ' . json_encode($_SESSION['shipping']), E_USER_NOTICE);
                unset($_SESSION['shipping']);
            }
        }
    ... defaults that shipping_module_code to a blank string if the session's shipping information isn't set, which ultimately leads to a 0-value shipping being applied. Can anyone identify a scenario where a valid order doesn't have a shipping selection registered in $_SESSION['shipping']?

  2. #2
    Join Date
    Jan 2004
    Posts
    66,364
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: How can an order be valid without $_SESSION['shipping'] being set?

    It shouldn't happen.

    I don't know why it's happening. I know I've dug around a bit and came up with nothing. I think it's related to specific modules.

    The trigger_error call was added so that the invalid situation would log itself and take the shopper back through shipping selection before completing the order.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  3. #3
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,399
    Plugin Contributions
    87

    Default Re: How can an order be valid without $_SESSION['shipping'] being set?

    Yes, but that trigger_error is only going to be hit if the $_SESSION['shipping'] is set!

  4. #4
    Join Date
    Jan 2004
    Location
    N of San Antonio TX
    Posts
    9,105
    Plugin Contributions
    11

    Default Re: How can an order be valid without $_SESSION['shipping'] being set?

    Not hijacking, just wondering if this is part of the reason for this log file. Using only Store Pickup and USPS.
    Code:
    PHP Notice: Malformed value for session-based shipping module; customer will need to re-select: false in /includes/classes/order.php on line 323

  5. #5
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,399
    Plugin Contributions
    87

    Default Re: How can an order be valid without $_SESSION['shipping'] being set?

    Quote Originally Posted by dbltoe View Post
    Not hijacking, just wondering if this is part of the reason for this log file. Using only Store Pickup and USPS.
    Code:
    [17-Apr-2021 10:41:12 US/Central] PHP Notice: Malformed value for session-based shipping module; customer will need to re-select: false in /includes/classes/order.php on line 323
    It's more a question of why (and where) the 'malformed' value was set in the first place! What version of Zen Cart and what payment methods are involved?

  6. #6
    Join Date
    Jan 2004
    Location
    N of San Antonio TX
    Posts
    9,105
    Plugin Contributions
    11

    Default Re: How can an order be valid without $_SESSION['shipping'] being set?

    1.5.7c with PayPal, Square and Cash on Pickup

  7. #7
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,399
    Plugin Contributions
    87

    Default Re: How can an order be valid without $_SESSION['shipping'] being set?

    If you scan the site's file-set for storefront occurrences of $_SESSION['shipping'] = false ... where's that being set?

  8. #8
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    9,621
    Plugin Contributions
    123

    Default Re: How can an order be valid without $_SESSION['shipping'] being set?

    Re: @dbltoe question - this is related: https://www.zen-cart.com/showthread....based-shipping
    That Software Guy. My Store: Zen Cart Modifications
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

  9. #9
    Join Date
    Jan 2004
    Location
    N of San Antonio TX
    Posts
    9,105
    Plugin Contributions
    11

    Default Re: How can an order be valid without $_SESSION['shipping'] being set?

    not finding anything. Probably not searching correctly.

  10. #10
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,668
    Plugin Contributions
    11

    Default Re: How can an order be valid without $_SESSION['shipping'] being set?

    Quote Originally Posted by lat9 View Post
    If you scan the site's file-set for storefront occurrences of $_SESSION['shipping'] = false ... where's that being set?
    Quote Originally Posted by dbltoe View Post
    not finding anything. Probably not searching correctly.
    i can not speak to whether dbltoe searched correctly... i can surmise he probably did. i have done some searching in various file sets and have not found the requested code.

    i did determine that the result of json_encode could be false if the data being encoded is not UTF-8. there are other possibilities as well...

    perhaps there is a need to call json_last_error() to find out what the error was if the return is false?

    not sure if this helps with the OP....
    author of square Webpay.
    mxWorks has premium plugins. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. How set up 2 shipping rates by weight without them conflicting at checkout
    By Annie_zaz in forum Built-in Shipping and Payment Modules
    Replies: 7
    Last Post: 7 Mar 2013, 02:56 PM
  2. v150 Where is $_SESSION['customer_id'] being set?
    By jrcook416 in forum General Questions
    Replies: 4
    Last Post: 1 Aug 2012, 01:36 PM
  3. can't generate order using valid credit card
    By feolindo in forum Built-in Shipping and Payment Modules
    Replies: 5
    Last Post: 6 Nov 2008, 07:27 AM
  4. How to set handling fee only without shipping cost
    By smykey in forum Built-in Shipping and Payment Modules
    Replies: 2
    Last Post: 18 Jul 2008, 06:22 PM
  5. where are $_SESSION variables set in order process
    By apathy in forum General Questions
    Replies: 0
    Last Post: 30 May 2008, 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