/** * Determine the appropriate shipping method if applicable * By default, selects the lowest-cost quote */ function setShippingMethod() { global $total_count, $total_weight; // ensure that cart contents is calculated properly for weight and value if (!isset($total_weight)) { $total_weight = $_SESSION['cart']->show_weight(); } if (!isset($total_count)) { $total_count = $_SESSION['cart']->count_contents(); } // set the shipping method if one is not already set // defaults to the cheapest shipping method if (!$_SESSION['shipping'] || $_SESSION['shipping'] && $_SESSION['shipping'] == false && zen_count_shipping_modules() > 1) { require_once DIR_WS_CLASSES . 'http_client.php'; require_once DIR_WS_CLASSES . 'shipping.php'; $shipping_Obj = new shipping(); // generate the quotes $shipping_Obj->quote(); // set the cheapest one $_SESSION['shipping'] = $shipping_Obj->cheapest(); } }
} else { $_SESSION['shipping'] = false; xtc_redirect(xtc_href_link(FILENAME_PAYPAL_CHECKOUT, '', 'SSL')); } } if ($kein_versand == 1) { $_SESSION['shipping'] = false; } // get all available shipping quotes $quotes = $shipping_modules->quote(); // 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 (!isset($_SESSION['shipping']) || isset($_SESSION['shipping']) && $_SESSION['shipping'] == false && xtc_count_shipping_modules() > 1) { $_SESSION['shipping'] = $shipping_modules->cheapest(); } if ($kein_versand == 1) { $_SESSION['shipping'] = false; } $order = new order(); // load all enabled payment modules require DIR_WS_CLASSES . 'payment.php'; $payment_modules = new payment($_SESSION['payment']); $payment_modules->update_status(); require DIR_WS_CLASSES . 'order_total.php'; // GV Code ICW ADDED FOR CREDIT CLASS SYSTEM $order_total_modules = new order_total(); $order_total_modules->process(); // GV Code Start $order_total_modules->collect_posts();
if (defined('SHIPPING_ALLOW_UNDEFINED_ZONES') && SHIPPING_ALLOW_UNDEFINED_ZONES == 'False') { tep_session_unregister('shipping'); } else { $shipping = false; tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL')); } } } // get all available shipping quotes $quotes = $shipping_modules->quote(); // 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 (!tep_session_is_registered('shipping') || tep_session_is_registered('shipping') && $shipping == false && tep_count_shipping_modules() > 1) { $shipping = $shipping_modules->cheapest(); } require DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHECKOUT_SHIPPING; if (defined('SHIPPING_ALLOW_UNDEFINED_ZONES') && SHIPPING_ALLOW_UNDEFINED_ZONES == 'False' && !tep_session_is_registered('shipping') && $shipping == false) { $messageStack->add_session('checkout_address', ERROR_NO_SHIPPING_AVAILABLE_TO_SHIPPING_ADDRESS); tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING_ADDRESS, '', 'SSL')); } $breadcrumb->add(NAVBAR_TITLE_1, tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL')); $breadcrumb->add(NAVBAR_TITLE_2, tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL')); require DIR_WS_INCLUDES . 'template_top.php'; ?> <div class="page-header"> <h1><?php echo HEADING_TITLE; ?>
$order->info['shipping_method'] = $selected_shipping['title']; $order->info['shipping_cost'] = $selected_shipping['cost']; $order->info['total'] += $selected_shipping['cost']; } } // virtual products need a free shipping if ($_SESSION['cart']->get_content_type() == 'virtual') { $order->info['shipping_method'] = CART_SHIPPING_METHOD_FREE_TEXT . ' ' . CART_SHIPPING_METHOD_ALL_DOWNLOADS; $order->info['shipping_cost'] = 0; } if ($free_shipping) { $order->info['shipping_method'] = MODULE_ORDER_TOTAL_SHIPPING_TITLE; $order->info['shipping_cost'] = 0; } // set cheapest last $selected_shipping = $shipping_modules->cheapest(); $shipping = $selected_shipping; if (SHOW_SHIPPING_ESTIMATOR_BUTTON == '1') { $show_in = FILENAME_POPUP_SHIPPING_ESTIMATOR; } else { $show_in = FILENAME_SHOPPING_CART; } // if(sizeof($quotes)) { if ($_SESSION['customer_id']) { $addresses = $db->execute("select address_book_id, entry_city as city, entry_postcode as postcode, entry_state as state, entry_zone_id as zone_id, entry_country_id as country_id from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int) $_SESSION['customer_id'] . "'"); // only display addresses if more than 1 if ($addresses->RecordCount() > 1) { while (!$addresses->EOF) { $addresses_array[] = array('id' => $addresses->fields['address_book_id'], 'text' => zen_address_format(zen_get_address_format_id($addresses->fields['country_id']), $addresses->fields, 0, ' ', ' ')); $addresses->MoveNext(); }
} } else { $_SESSION['shipping'] = false; MyOOS_CoreApi::redirect(oos_href_link($aPages['checkout_payment'], '', 'SSL')); } } // get all available shipping quotes $quotes = $oShippingModules->quote(); // 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 ( !isset($_SESSION['shipping']) || ( isset($_SESSION['shipping']) && ($_SESSION['shipping'] == false) && (oos_count_shipping_modules() > 1) ) ) $_SESSION['shipping'] = $oShippingModules->cheapest(); list ($sess_class, $sess_method) = split ('_', $_SESSION['shipping']['id']); // links breadcrumb $oBreadcrumb->add($aLang['navbar_title_1'], oos_href_link($aPages['checkout_shipping'], '', 'SSL')); $oBreadcrumb->add($aLang['navbar_title_2']); $aOption['template_main'] = $sTheme . '/modules/checkout_shipping.html'; $aOption['page_heading'] = $sTheme . '/heading/page_heading.html'; $nPageType = OOS_PAGE_TYPE_CHECKOUT; require 'includes/oos_system.php'; if (!isset($option)) { require 'includes/info_message.php'; require 'includes/oos_blocks.php';
unset($_SESSION['shipping']); } } } else { $_SESSION['shipping'] = false; oos_redirect(oos_href_link($aModules['checkout'], $aFilename['checkout_payment'], '', 'SSL')); } } // get all available shipping quotes $quotes = $oShippingModules->quote(); // 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 (!isset($_SESSION['shipping']) || isset($_SESSION['shipping']) && $_SESSION['shipping'] == false && oos_count_shipping_modules() > 1) { $_SESSION['shipping'] = $oShippingModules->cheapest(); } list($sess_class, $sess_method) = split('_', $_SESSION['shipping']['id']); // links breadcrumb $oBreadcrumb->add($aLang['navbar_title_1'], oos_href_link($aModules['checkout'], $aFilename['checkout_shipping'], '', 'SSL')); $oBreadcrumb->add($aLang['navbar_title_2'], oos_href_link($aModules['checkout'], $aFilename['checkout_shipping'], '', 'SSL')); $aOption['template_main'] = $sTheme . '/modules/checkout_shipping.html'; $aOption['page_heading'] = $sTheme . '/heading/page_heading.html'; $nPageType = OOS_PAGE_TYPE_CHECKOUT; require 'includes/oos_system.php'; if (!isset($option)) { require 'includes/info_message.php'; require 'includes/oos_blocks.php'; require 'includes/oos_counter.php'; } $campaignstable = $oostable['campaigns'];
function osC_Checkout_Shipping() { global $osC_Database, $osC_Session, $osC_Customer, $osC_Services, $breadcrumb, $order, $cart, $total_weight, $total_count, $shipping_modules, $pass, $free_shipping, $quotes; if ($cart->count_contents() < 1) { tep_redirect(tep_href_link(FILENAME_CHECKOUT, '', 'SSL')); } if ($osC_Services->isStarted('breadcrumb')) { $breadcrumb->add(NAVBAR_TITLE_CHECKOUT_SHIPPING, tep_href_link(FILENAME_CHECKOUT, $this->_module, 'SSL')); } if ($osC_Customer->hasDefaultAddress() === false) { $this->page_contents = 'checkout_shipping_address.php'; } // if no shipping destination address was selected, use the customers own address as default if ($osC_Session->exists('sendto') == false) { $osC_Session->set('sendto', $osC_Customer->default_address_id); } else { // verify the selected shipping address $Qcheck = $osC_Database->query('select count(*) as total from :table_address_book where customers_id = :customers_id and address_book_id = :address_book_id'); $Qcheck->bindTable(':table_address_book', TABLE_ADDRESS_BOOK); $Qcheck->bindInt(':customers_id', $osC_Customer->id); $Qcheck->bindInt(':address_book_id', $osC_Session->value('sendto')); $Qcheck->execute(); if ($Qcheck->valueInt('total') != 1) { $osC_Session->set('sendto', $osC_Customer->default_address_id); $osC_Session->remove('shipping'); } } $order = new order(); // register a random ID in the session to check throughout the checkout procedure // against alterations in the shopping cart contents $osC_Session->set('cartID', $cart->cartID); // if the order contains only virtual products, forward the customer to the billing page as // a shipping address is not needed if ($order->content_type == 'virtual') { $false = false; $osC_Session->set('shipping', $false); $osC_Session->set('sendto', $false); tep_redirect(tep_href_link(FILENAME_CHECKOUT, 'payment', 'SSL')); } $total_weight = $cart->show_weight(); $total_count = $cart->count_contents(); // load all enabled shipping modules require DIR_WS_CLASSES . 'shipping.php'; $shipping_modules = new shipping(); if (defined('MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING') && MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING == 'true') { $pass = false; switch (MODULE_ORDER_TOTAL_SHIPPING_DESTINATION) { case 'national': if ($order->delivery['country_id'] == STORE_COUNTRY) { $pass = true; } break; case 'international': if ($order->delivery['country_id'] != STORE_COUNTRY) { $pass = true; } break; case 'both': $pass = true; break; } $free_shipping = false; if ($pass == true && $order->info['total'] - $order->info['shipping_cost'] >= MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER) { $free_shipping = true; include DIR_WS_LANGUAGES . $osC_Session->value('language') . '/modules/order_total/ot_shipping.php'; } } else { $free_shipping = false; } // get all available shipping quotes $quotes = $shipping_modules->quote(); // 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 ($osC_Session->exists('shipping') == false || $osC_Session->exists('shipping') && $osC_Session->value('shipping') == false && tep_count_shipping_modules() > 1) { $osC_Session->set('shipping', $shipping_modules->cheapest()); } if ($_GET[$this->_module] == 'process') { $this->_process(); } }
function confirmation() { global $order, $smarty, $xtPrice, $main, $messageStack, $total_weight, $total_count, $free_shipping; if (isset($_GET['conditions_message'])) { $message_condition = str_replace('\\n', '', ERROR_CONDITIONS_NOT_ACCEPTED); $message_address = str_replace('\\n', '', ERROR_ADDRESS_NOT_ACCEPTED); switch ($_GET['conditions_message']) { case "1": $messageStack->add('checkout_confirmation', $message_condition); break; case "13": $messageStack->add('checkout_confirmation', $message_condition); $messageStack->add('checkout_confirmation', ERROR_CHECKOUT_SHIPPING_NO_METHOD); break; case "2": $messageStack->add('checkout_confirmation', $message_address); break; case "23": $messageStack->add('checkout_confirmation', $message_address); $messageStack->add('checkout_confirmation', ERROR_CHECKOUT_SHIPPING_NO_METHOD); break; case "12": $messageStack->add('checkout_confirmation', $message_condition); $messageStack->add('checkout_confirmation', $message_address); break; case "123": $messageStack->add('checkout_confirmation', $message_condition); $messageStack->add('checkout_confirmation', $message_address); $messageStack->add('checkout_confirmation', ERROR_CHECKOUT_SHIPPING_NO_METHOD); break; case "3": $messageStack->add('checkout_confirmation', ERROR_CHECKOUT_SHIPPING_NO_METHOD); break; } } if ($order->delivery['country']['iso_code_2'] != '') { $_SESSION['delivery_zone'] = $order->delivery['country']['iso_code_2']; } $no_shipping = false; if ($order->content_type == 'virtual' || $order->content_type == 'virtual_weight' || $_SESSION['cart']->count_contents_virtual() == 0) { $no_shipping = true; } $total_weight = $_SESSION['cart']->show_weight(); $total_count = $_SESSION['cart']->count_contents(); // load all enabled shipping modules $shipping_modules = new shipping(); // add unallowed payment / shipping if (defined('MODULE_EXCLUDE_PAYMENT_STATUS') && MODULE_EXCLUDE_PAYMENT_STATUS == 'True') { for ($i = 1; $i <= MODULE_EXCLUDE_PAYMENT_NUMBER; $i++) { $payment_exclude = explode(',', constant('MODULE_EXCLUDE_PAYMENT_PAYMENT_' . $i)); if (in_array($this->code, $payment_exclude)) { $shipping_exclude = explode(',', constant('MODULE_EXCLUDE_PAYMENT_SHIPPING_' . $i)); for ($i = 0, $n = count($shipping_modules->modules); $i < $n; $i++) { if (in_array(substr($shipping_modules->modules[$i], 0, -4), $shipping_exclude)) { unset($shipping_modules->modules[$i]); } } } } } $free_shipping = false; $ot_shipping = new ot_shipping(); $ot_shipping->process(); if ($no_shipping === true) { $_SESSION['shipping'] = false; } // get all available shipping quotes $quotes = $shipping_modules->quote(); // 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 (!isset($_SESSION['shipping']) && CHECK_CHEAPEST_SHIPPING_MODUL == 'true' || isset($_SESSION['shipping']) && $_SESSION['shipping'] == false && xtc_count_shipping_modules() > 1) { $_SESSION['shipping'] = $shipping_modules->cheapest(); } if ($no_shipping === true) { $_SESSION['shipping'] = false; } if (defined('SHOW_SELFPICKUP_FREE') && SHOW_SELFPICKUP_FREE == 'true') { if ($free_shipping == true) { $free_shipping = false; $quotes = array_merge($ot_shipping->quote(), $shipping_modules->quote('selfpickup', 'selfpickup')); } } $module_smarty = new Smarty(); $shipping_block = ''; if (xtc_count_shipping_modules() > 0) { $showtax = $_SESSION['customers_status']['customers_status_show_price_tax']; $module_smarty->assign('FREE_SHIPPING', $free_shipping); # free shipping or not... if ($free_shipping == true) { $module_smarty->assign('FREE_SHIPPING_TITLE', FREE_SHIPPING_TITLE); $module_smarty->assign('FREE_SHIPPING_DESCRIPTION', sprintf(FREE_SHIPPING_DESCRIPTION, $xtPrice->xtcFormat($free_shipping_value_over, true, 0, true)) . xtc_draw_hidden_field('shipping', 'free_free')); $module_smarty->assign('FREE_SHIPPING_ICON', $quotes[$i]['icon']); } else { $radio_buttons = 0; #loop through installed shipping methods... for ($i = 0, $n = sizeof($quotes); $i < $n; $i++) { if (!isset($quotes[$i]['error'])) { for ($j = 0, $n2 = sizeof($quotes[$i]['methods']); $j < $n2; $j++) { # set the radio button to be checked if it is the method chosen $quotes[$i]['methods'][$j]['radio_buttons'] = $radio_buttons; $checked = isset($_SESSION['shipping']) && $quotes[$i]['id'] . '_' . $quotes[$i]['methods'][$j]['id'] == $_SESSION['shipping']['id'] ? true : false; if ($checked == true || $n == 1 && $n2 == 1) { $quotes[$i]['methods'][$j]['checked'] = 1; } if ($n > 1 || $n2 > 1) { if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 0 || !isset($quotes[$i]['tax'])) { $quotes[$i]['tax'] = 0; } $quotes[$i]['methods'][$j]['price'] = $xtPrice->xtcFormat(xtc_add_tax($quotes[$i]['methods'][$j]['cost'], $quotes[$i]['tax']), true, 0, true); $quotes[$i]['methods'][$j]['radio_field'] = xtc_draw_radio_field('shipping', $quotes[$i]['id'] . '_' . $quotes[$i]['methods'][$j]['id'], $checked, 'id="rd-' . ($i + 1) . '" onChange="this.form.submit()"'); } else { if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 0) { $quotes[$i]['tax'] = 0; } $quotes[$i]['methods'][$j]['price'] = $xtPrice->xtcFormat(xtc_add_tax($quotes[$i]['methods'][$j]['cost'], isset($quotes[$i]['tax']) ? $quotes[$i]['tax'] : 0), true, 0, true) . xtc_draw_hidden_field('shipping', $quotes[$i]['id'] . '_' . $quotes[$i]['methods'][$j]['id']); } $radio_buttons++; } } } $module_smarty->assign('module_content', $quotes); } $module_smarty->assign('language', $_SESSION['language']); $module_smarty->caching = 0; $shipping_block = $module_smarty->fetch(CURRENT_TEMPLATE . '/module/checkout_shipping_block.html'); } if ($no_shipping === false) { $module_smarty->assign('FORM_SHIPPING_ACTION', xtc_draw_form('checkout_shipping', xtc_href_link(FILENAME_CHECKOUT_CONFIRMATION, xtc_get_all_get_params(), 'SSL')) . xtc_draw_hidden_field('action', 'process')); $shipping_found = false; for ($i = 0, $n = sizeof($quotes); $i < $n; $i++) { for ($j = 0, $n2 = sizeof($quotes[$i]['methods']); $j < $n2; $j++) { if ($quotes[$i]['id'] . '_' . $quotes[$i]['methods'][$j]['id'] == $_SESSION['shipping']['id']) { $shipping_found = true; break; } } } if ($shipping_found === false) { $module_smarty->assign('shipping_message', ERROR_CHECKOUT_SHIPPING_NO_METHOD); /* if (xtc_count_shipping_modules() == 1) { $module_smarty->assign('BUTTON_CONTINUE', xtc_image_submit('button_confirm.gif', IMAGE_BUTTON_CONFIRM)); } */ } $module_smarty->assign('BUTTON_CONTINUE', xtc_image_submit('button_confirm.gif', IMAGE_BUTTON_CONFIRM)); $module_smarty->assign('FORM_END', '</form>'); if ($no_shipping === false) { $module_smarty->assign('SHIPPING_BLOCK', $shipping_block); } $module_smarty->assign('language', $_SESSION['language']); $module_smarty->caching = 0; $shipping_method = $module_smarty->fetch(DIR_FS_EXTERNAL . '/paypal/templates/shipping_block.html'); $smarty->assign('SHIPPING_METHOD', $shipping_method); } $smarty->assign('SHIPPING_ADDRESS_EDIT', xtc_href_link(FILENAME_CHECKOUT_SHIPPING_ADDRESS, xtc_get_all_get_params(), 'SSL')); $smarty->assign('BILLING_ADDRESS_EDIT', xtc_href_link(FILENAME_CHECKOUT_PAYMENT_ADDRESS, xtc_get_all_get_params(), 'SSL')); $smarty->clear_assign('SHIPPING_EDIT'); $smarty->clear_assign('PAYMENT_EDIT'); //$smarty->clear_assign('PRODUCTS_EDIT'); }
// set the cost to be able to calvculate free shipping $order->info = array('total' => $cart->show_total()); // TAX ???? } // weight and count needed for shipping ! $total_weight = $cart->show_weight(); $total_count = $cart->count_contents(); //require(DIR_WS_CLASSES . 'shipping.php'); if (defined('MVS_STATUS') && MVS_STATUS == 'true') { include DIR_WS_CLASSES . 'vendor_shipping.php'; } else { include DIR_WS_CLASSES . 'shipping.php'; } $shipping_modules = new shipping(); $quotes = $shipping_modules->quote(); $cheapest = $shipping_modules->cheapest(); // set selections for displaying //if (!isset($order->delivery['country'])) { // $order->delivery['country'] = false; //} //if (!isset($order->delivery['postcode'])) { // $order->delivery['postcode'] = false; //} $selected_country = $order->delivery['country']['id']; $selected_zip = $order->delivery['postcode']; if (isset($_SESSION['sendto'])) { $selected_address = $_SESSION['sendto']; } } // eo shipping cost // $info_box_contents = array();