Forums / Bug Reports / No way for a shipping module to register an error

No way for a shipping module to register an error

Started by lat9 on 11 Feb 2014, 5:20 PM · Views: 686

Results 1 to 1 of 1
11 Feb 2014, 5:20 PM
#1
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,131
Plugin Contributions:
56

No way for a shipping module to register an error

Within the checkout_shipping page's header_php.php processing, there's a check to see if the selected shipping module has recorded an error which should keep the customer on the checkout_shipping page:

        list($module, $method) = explode('_', $_SESSION['shipping']);
        if ( is_object($$module) || ($_SESSION['shipping'] == 'free_free') ) {
          if ($_SESSION['shipping'] == 'free_free') {
            $quote[0]['methods'][0]['title'] = FREE_SHIPPING_TITLE;
            $quote[0]['methods'][0]['cost'] = '0';
          } else {
            $quote = $shipping_modules->quote($method, $module);
          }
          if (isset($quote['error'])) {
            $_SESSION['shipping'] = '';
          } else {

Unfortunately, the $quote value is an array of arrays, so testing for $quote['error'] will never find a match. Need, instead, to code:

        list($module, $method) = explode('_', $_SESSION['shipping']);
        if ( is_object($$module) || ($_SESSION['shipping'] == 'free_free') ) {
          if ($_SESSION['shipping'] == 'free_free') {
            $quote[0]['methods'][0]['title'] = FREE_SHIPPING_TITLE;
            $quote[0]['methods'][0]['cost'] = '0';
          } else {
            $quote = $shipping_modules->quote($method, $module);
          }
          if (isset($quote[0]['error'])) {
            $_SESSION['shipping'] = '';
          } else {