$gBitSmarty->assign('errors', "Please select a shipping method"); } } else { // not virtual product, but no shipping cost. $_SESSION['shipping'] = !$free_shipping ? 'free_free' : false; zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL')); } } if ($gBitUser->isRegistered() && zen_count_shipping_modules() && !empty($_SESSION['sendto']) && empty($_REQUEST['change_address'])) { // get all available shipping quotes $quotes = array(); if (empty($free_shipping)) { $quotes = $shipping->quote($gBitCustomer->mCart->show_weight()); } // if no shipping method has been selected, automatically select the cheapest method. // if the modules 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 (empty($_SESSION['shipping']) || $_SESSION['shipping'] && $_SESSION['shipping'] == false && zen_count_shipping_modules() > 1) { $_SESSION['shipping'] = $shipping->cheapest(); } $breadcrumb->add(NAVBAR_TITLE_1, zen_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL')); $breadcrumb->add(NAVBAR_TITLE_2); $gBitSmarty->assign('shippingModules', TRUE); $gBitSmarty->assign('quotes', $quotes); $gBitSmarty->register_object('currencies', $currencies, array(), true, array('formatAddTax')); $gBitSmarty->assign('freeShipping', $free_shipping); $gBitSmarty->assign('sessionShippingId', $_SESSION['shipping']); } } print $gBitSmarty->fetch('bitpackage:bitcommerce/page_checkout_shipping.tpl');