Page 2 of 2 FirstFirst 12
Results 11 to 18 of 18
  1. #11
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    9,677
    Plugin Contributions
    123

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

    I tried the search @lat9 suggested and also came up with nothing.
    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.

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

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

    I can't see where the json_encode bit has anything to do with this.
    .

    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. #13
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,684
    Plugin Contributions
    9

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

    Quote Originally Posted by DrByte View Post
    I can't see where the json_encode bit has anything to do with this.
    dbltoe stated he was getting an error log that says:

    Notice: Malformed value for session-based shipping module; customer will need to re-select: false in /includes/classes/order.php on line 323

    which is coming from this line of code:

    PHP Code:
    trigger_error('Malformed value for session-based shipping module; customer will need to re-select: ' json_encode($_SESSION['shipping']), E_USER_NOTICE); 
    lat9 asked to search for a particular section of code, which 3 of us could not find.

    if the json_encode of $_SESSION['shipping'] returns false, that would explain why people are seeing false in their logs.

    as i previously stated, i am not sure if this helps with the OP, but there was a request to look for some code, which a number of us did, and that request was based on what was seen in the log, and i am now only providing a reason as to how false got into the log without $_SESSION['shipping'] being set to false.

    hope that's clear.
    author of square Webpay.
    mxWorks has premium plugins. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

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

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

    As indicated here: https://www.zen-cart.com/showthread....71#post1377371

    If the "cheapest" method in the shipping class has the potential to return false even if all else is "correctly" setup. That is a point where $_SESSION['shipping'] can be set to false without 'false' being hardcoded to "suit" said search...

    Ways this could "physically" happen:
    $this->modules is not an array (note though there are other checks and operations in normal processing at least in includes/modules/pages/checkout_shipping/header_php.php to not attempt to get the result of the cheapest function unless "basically" this condition has already been met.

    So, next chance?
    Basically there are no $rates calculated, this involves using the default value of $cheapest which is false at that point and the internal loop never gets processed to change the value of $cheapest to one of the rates.
    Last chance within this method: an observer of NOTIFY_SHIPPING_MODULE_CALCULATE_CHEAPEST has set $cheapest to false.

    So what does it take in a default install to get to the cheapest method calculation?

    $_SESSION['shipping'] isn't set, $_SESSION['shipping']['id'] is not set, or $_SESSION['shipping']['id'] is falsey. Then if any of those are true, if there is at least one shipping module...

    How is it that specifically no rates get set? A few different ways: $quotes['methods'] is empty (not set, an array of zero elements, a pair of quotes, the value 0, false, etc...). If there are methods with quotes but the cost is not set as in: $quotes['methods'][$i]['cost'] is not set.


    Then... Doing a search for points where $_SESSION['shipping'] is set, assuming that consistent code formatting is used to then search on '$_SESSION['shipping'] = ', there are very few cases at all where it is set to anything let alone a non-array. Basically as already stated in a default install there are two places where this could occur: paying with paypal or standard checkout when stepping through the header file.

    That said, there is also the assignment of $shipping_modules->cheapest to $shipping in includes/modules/shipping_estimator.php though I don't know yet what impact that would have if it is set to false at that point. And that was just found by searching on 'cheapest('. I didn't try with a space before the parentheses. Nor have I sought for any weird situations like use of a variable assigned to 'cheapest' and using it as a function...
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  5. #15
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,684
    Plugin Contributions
    9

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

    entirely possible that cheapest could return false as well.... probably a more likely culprit...
    author of square Webpay.
    mxWorks has premium plugins. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

  6. #16
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,473
    Plugin Contributions
    88

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

    I'll note that we (myself included) have somewhat drifted from the original post's query. In the condition I'm investigating, $_SESSION['shipping'] is not set.

    From what I've seen so far trolling through the PayPal and raw-access logs, the customer started out with OPC's guest-checkout, went to pay via PayPal Express Checkout and received the dreaded PayPal 10486 (the transaction couldn't be completed). About 5 minutes later, the customer apparently resolved their payment issue and returned to the store (no longer in guest checkout).

    The paypalwpp payment method created an account for the customer and merrily created the order ... with no shipping. The 'shipping' order-total for the order shows a shipping_method of '' (empty string) and a value of 0.

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

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

    Alternatively and to wrap back around to the original question/information (started before prompted in a previous message), it looks like it could be possible that a purchase could be made with $_SESSION['shipping'] not being set if during ec_step2 the cart is determined/identified as possibly being changed, because the order is not present (does not appear to be in the path of being set until after this "change in contents") the section of code mentioned is "processed" and then with the store *not* setup to select the cheapest shipping method, then a purchase appears to be able to complete through paypal without $_SESSION['shipping'] being set. Additionally, because $_SESSION['shipping'] was unset when the cart "discrepancy" was identified, this path of processing would result in reaching the code snippet in the OP but bypassing it because $_SESSION['shipping'] is not set. So the last conditions that cause(d) unsetting are from includes/modules/paypalwpp.php at/around Line 1875:
    Code:
    (isset($response['SHIPPINGCALCULATIONMODE']) && $response['SHIPPINGCALCULATIONMODE'] != 'Callback') && (!(isset($_SESSION['paypal_ec_markflow']) && $_SESSION['paypal_ec_markflow'] == 1))
    There doesn't appear to be anything at this point that ensures correction to the shipping session value in this situation.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  8. #18
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,473
    Plugin Contributions
    88

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

    Quote Originally Posted by mc12345678 View Post
    Alternatively and to wrap back around to the original question/information (started before prompted in a previous message), it looks like it could be possible that a purchase could be made with $_SESSION['shipping'] not being set if during ec_step2 the cart is determined/identified as possibly being changed, because the order is not present (does not appear to be in the path of being set until after this "change in contents") the section of code mentioned is "processed" and then with the store *not* setup to select the cheapest shipping method, then a purchase appears to be able to complete through paypal without $_SESSION['shipping'] being set. Additionally, because $_SESSION['shipping'] was unset when the cart "discrepancy" was identified, this path of processing would result in reaching the code snippet in the OP but bypassing it because $_SESSION['shipping'] is not set. So the last conditions that cause(d) unsetting are from includes/modules/paypalwpp.php at/around Line 1875:
    Code:
    (isset($response['SHIPPINGCALCULATIONMODE']) && $response['SHIPPINGCALCULATIONMODE'] != 'Callback') && (!(isset($_SESSION['paypal_ec_markflow']) && $_SESSION['paypal_ec_markflow'] == 1))
    There doesn't appear to be anything at this point that ensures correction to the shipping session value in this situation.
    Noting that the SHIPPINGCALCULATIONMODE element of the response was not set.

 

 
Page 2 of 2 FirstFirst 12

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