Exemplo n.º 1
0
 /**
  * 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();
     }
 }
               </a>
             </div>
		 
             <div class="versan_top_m">
             <?php 
echo zen_image($template->get_template_dir('tu_07.gif', DIR_WS_TEMPLATE, $current_page_base, 'images') . '/tu_07.gif');
?>
              <?php 
echo zen_address_label($_SESSION['customer_id'], $_SESSION['sendto'], true, ' ', '<br />');
?>
             </div>
		</div>
		
		<div class="clear"></div>
 <?php 
if (zen_count_shipping_modules() > 0) {
    ?>
		<div class="verdart">
            <h6><?php 
    echo TEXT_SHIPPING_TITLE;
    ?>
</h6>
            <p><?php 
    echo TEXT_SHIPPING;
    ?>
</p>
            
            <div class="verdart_c">
                <div id="verdart_t">
                   <?php 
    require $template->get_template_dir('tpl_checkout_shipping_block.php', DIR_WS_TEMPLATE, $current_page_base, 'templates') . '/tpl_checkout_shipping_block.php';
Exemplo n.º 3
0
                $checklist[] = $val['id'] . '_' . $method['id'];
            }
        } else {
            // skip
        }
    }
    $checkval = $_SESSION['shipping']['id'];
    if (!in_array($checkval, $checklist) && $_SESSION['shipping']['id'] != 'free_free') {
        $messageStack->add('checkout_shipping', ERROR_PLEASE_RESELECT_SHIPPING_METHOD, 'error');
    }
}
// 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']) && zen_count_shipping_modules() > 1) {
    $_SESSION['shipping'] = $shipping_modules->cheapest();
}
// Should address-edit button be offered?
$displayAddressEdit = MAX_ADDRESS_BOOK_ENTRIES >= 2;
// if shipping-edit button should be overridden, do so
$editShippingButtonLink = zen_href_link(FILENAME_CHECKOUT_SHIPPING_ADDRESS, '', 'SSL');
if (isset($_SESSION['payment']) && method_exists(${$_SESSION}['payment'], 'alterShippingEditButton')) {
    $theLink = ${$_SESSION}['payment']->alterShippingEditButton();
    if ($theLink) {
        $editShippingButtonLink = $theLink;
        $displayAddressEdit = true;
    }
}
require DIR_WS_CLASSES . 'payment.php';
$payment_modules = new payment();
Exemplo n.º 4
0
         $db->Execute($sql);
     } else {
         // do not update referral was added before
     }
 }
 if (isset(${$_SESSION}['payment']->form_action_url)) {
     $form_action_url = ${$_SESSION}['payment']->form_action_url;
 } else {
     $form_action_url = zen_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL');
 }
 // process the selected shipping method
 if (zen_not_null($_POST['comments'])) {
     $_SESSION['comments'] = zen_db_prepare_input($_POST['comments']);
 }
 $comments = $_SESSION['comments'];
 if (zen_count_shipping_modules() > 0 || $free_shipping == true) {
     if (isset($_POST['insurance_checked']) && $_POST['insurance_checked'] == "false") {
         $insurance_checked = $_SESSION['insurance']['price'];
         $_SESSION['coupons']['insurance_checked'] = "true";
     }
     if (isset($_POST['coupon_prices']) && $_POST['coupon_prices'] != "") {
         $_SESSION['coupons']['prices'] = $_POST['coupon_prices'];
     }
     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 {
Exemplo n.º 5
0
    $checklist = array();
    foreach ($quotes as $key => $val) {
        foreach ($val['methods'] as $key2 => $method) {
            $checklist[] = $val['id'] . '_' . $method['id'];
        }
    }
    $checkval = is_array($_SESSION['shipping']) ? $_SESSION['shipping']['id'] : $_SESSION['shipping'];
    if (!in_array($checkval, $checklist)) {
        $messageStack->add('checkout_shipping', ERROR_PLEASE_RESELECT_SHIPPING_METHOD, 'error');
    }
}
// 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 (!$_SESSION['shipping'] || $_SESSION['shipping'] && $_SESSION['shipping'] == false && zen_count_shipping_modules() > 1) {
    $_SESSION['shipping'] = $shipping_modules->cheapest();
}
// Should address-edit button be offered?
$displayAddressEdit = MAX_ADDRESS_BOOK_ENTRIES >= 2;
// if shipping-edit button should be overridden, do so
$editShippingButtonLink = zen_href_link(FILENAME_CHECKOUT_SHIPPING_ADDRESS, '', 'SSL');
if (isset($_SESSION['payment']) && method_exists(${$_SESSION}['payment'], 'alterShippingEditButton')) {
    $theLink = ${$_SESSION}['payment']->alterShippingEditButton();
    if ($theLink) {
        $editShippingButtonLink = $theLink;
        $displayAddressEdit = true;
    }
}
$breadcrumb->add(NAVBAR_TITLE_1, zen_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));
$breadcrumb->add(NAVBAR_TITLE_2);
Exemplo n.º 6
0
                $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');