$order->info['shipping_method'] = CART_SHIPPING_METHOD_FREE_TEXT . ' ' . CART_SHIPPING_METHOD_ALL_DOWNLOADS; $order->info['shipping_cost'] = 0; } elseif ($freeShipping) { $order->info['shipping_method'] = MODULE_ORDER_TOTAL_SHIPPING_TITLE; $order->info['shipping_cost'] = 0; } elseif (!empty($order->delivery['country']['countries_id'])) { require BITCOMMERCE_PKG_PATH . 'classes/CommerceShipping.php'; // weight and count needed for shipping ! if ($gBitProduct->isValid() && !empty($_REQUEST['cart_quantity'])) { $weight = $gBitProduct->getWeight($_REQUEST['cart_quantity'], $_REQUEST['id']); $order->subtotal = $gBitProduct->getPurchasePrice($_REQUEST['cart_quantity'], $_REQUEST['id']); } elseif ($gBitCustomer->mCart->count_contents() > 0) { $weight = $gBitCustomer->mCart->show_weight(); } else { $weight = 0; } $shipping = new CommerceShipping(); if (empty($stateMenu) || !empty($order->delivery['postcode'])) { $gBitSmarty->assign_by_ref('quotes', $shipping->quote($weight)); } $order->subtotal = $gBitCustomer->mCart->show_total(); } $gBitSmarty->assign('freeShipping', $freeShipping); // end of shipping cost // end free shipping based on order total if ($gBitThemes->isAjaxRequest()) { $gBitSmarty->display('bitpackage:bitcommerce/shipping_estimator_inc.tpl'); } else { $gBitThemes->loadAjax('jquery', array('ui/ui.core.js')); $gBitSystem->display('bitpackage:bitcommerce/popup_shipping_estimator.tpl'); }
<?php // +----------------------------------------------------------------------+ // | bitcommerce Open Source E-commerce | // | Copyright (c) 2009 bitcommerce.org | // | http://www.bitcommerce.org/ | // | This source file is subject to version 2.0 of the GPL license | // +----------------------------------------------------------------------+ // $Id$ require 'includes/application_top.php'; require_once BITCOMMERCE_PKG_PATH . 'classes/CommerceOrder.php'; require BITCOMMERCE_PKG_PATH . 'classes/CommerceShipping.php'; $shipping = new CommerceShipping(); $order->calculate(); // get all available shipping quotes if (!empty($_REQUEST['change_shipping']) && !empty($_REQUEST['shipping'])) { list($module, $method) = explode('_', $_REQUEST['shipping']); if (is_object(${$module})) { $quote = $shipping->quote($order->getWeight(), $method, $module); $order->changeShipping(current($quote), $_REQUEST); zen_redirect($_SERVER['HTTP_REFERER']); } } else { $gBitSmarty->assign('quotes', $shipping->quote($order->getWeight())); print $gBitSmarty->fetch('bitpackage:bitcommerce/admin_shipping_change_ajax.tpl'); }
$free_shipping = false; } if (isset($_POST['action']) && $_POST['action'] == 'process') { if (zen_not_null($_POST['comments'])) { $_SESSION['comments'] = zen_db_prepare_input($_POST['comments']); } if (zen_count_shipping_modules() > 0 || $free_shipping == true) { if (isset($_POST['shipping']) && strpos($_POST['shipping'], '_')) { $_SESSION['shipping'] = $_POST['shipping']; 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->quote($gBitCustomer->mCart->show_weight(), $method, $module); } if (isset($quote['error'])) { $_SESSION['shipping'] = ''; } else { if (isset($quote[0]['methods'][0]['title']) && isset($quote[0]['methods'][0]['cost'])) { $_SESSION['shipping'] = array('id' => $_SESSION['shipping'], 'title' => $free_shipping == true ? $quote[0]['methods'][0]['title'] : $quote[0]['module'] . ' (' . $quote[0]['methods'][0]['title'] . ')', 'cost' => $quote[0]['methods'][0]['cost'], 'code' => !empty($quote[0]['methods'][0]['code']) ? $quote[0]['methods'][0]['code'] : NULL); zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL')); } } } else { $_SESSION['shipping'] = false; } } elseif (empty($free_shipping)) { $gBitSmarty->assign('errors', "Please select a shipping method"); }