Ejemplo n.º 1
0
    $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');
}
Ejemplo n.º 2
0
<?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');
}
Ejemplo n.º 3
0
// if the no delivery address, try to get one by default
if (empty($_SESSION['sendto']) || !$gBitCustomer->isValidAddress($order->delivery)) {
    if ($defaultAddressId = $gBitCustomer->getDefaultAddress()) {
        $order->delivery = $gBitCustomer->getAddress($defaultAddressId);
        $_SESSION['sendto'] = $defaultAddressId;
    }
}
if (isset($_REQUEST['change_address']) || !$gBitCustomer->isValidAddress($order->delivery)) {
    if ($addresses = $gBitCustomer->getAddresses()) {
        $gBitSmarty->assign('addresses', $addresses);
    }
    $gBitSmarty->assign('changeAddress', TRUE);
} else {
    // load all enabled shipping modules
    require BITCOMMERCE_PKG_PATH . 'classes/CommerceShipping.php';
    $shipping = new CommerceShipping();
    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;