zc1.5.5f. Investigating an issue with One-Page Checkout, I'm trying to ensure that the processing provided by that plugin is as close to the core handling as possible.
Looking at /includes/modules/pages/checkout_shipping/header_php.php, lines 207-211 read:
Code:
// If no shipping method has been selected, automatically select the cheapest method.
// If the module's status was changed when none were available, to save on implementing
// a javascript force-selection method, also automatically select the cheapest shipping
// method if more than one module is now enabled
if ((!isset($_SESSION['shipping']) || (!isset($_SESSION['shipping']['id']) || $_SESSION['shipping']['id'] == '') && zen_count_shipping_modules() >= 1)) $_SESSION['shipping'] = $shipping_modules->cheapest();
... and I'm trying to understand the intent because I think that there might be some issues with that clause, noting the following behavior:
If $_SESSION['shipping'] is not set, then the cheapest is selected without regard to the shipping-module count.
If $_SESSION['shipping']['id'] is not set, then the cheapest is selected without regard to the shipping-module count.
It looks to me like the check wants to prevent calling $shipping_modules->cheapest() if there are no shipping modules available, which begs a further question:
If no shipping modules are available, should $_SESSION['shipping'] be set and, if so, to what?
I've attached a teeny PHP script that illustrates the various combinations and the comparison results.
test.zip
Bookmarks