[ Index ] |
PHP Cross Reference of osCMax 2.0.4 |
[Summary view] [Print] [Text view]
1 <?php 2 /* 3 $Id: checkout_shipping.php 3 2006-05-27 04:59:07Z user $ 4 5 osCMax Power E-Commerce 6 http://oscdox.com 7 8 Copyright 2006 osCMax 9 10 Released under the GNU General Public License 11 */ 12 13 // Most of this file is changed or moved to BTS - Basic Template System - format. 14 // For adding in contribution or modification - parts of this file has been moved to: catalog\templates\fallback\contents\<filename>.tpl.php as a default (sub 'fallback' with your current template to see if there is a template specife change). 15 // catalog\templates\fallback\contents\<filename>.tpl.php as a default (sub 'fallback' with your current template to see if there is a template specife change). 16 // (Sub 'fallback' with your current template to see if there is a template specific file.) 17 18 require ('includes/application_top.php'); 19 require ('includes/classes/http_client.php'); 20 21 // BOF: MOD - Downloads Controller - Free Shipping 22 // Reset $shipping if free shipping is on and weight is not 0 23 if (tep_get_configuration_key_value('MODULE_SHIPPING_FREESHIPPER_STATUS') and $cart->show_weight()!=0) { 24 tep_session_unregister('shipping'); 25 } 26 // EOF: MOD - Downloads Controller - Free Shipping 27 28 // BOF: MOD - Individual Shipping 29 if (tep_get_configuration_key_value('MODULE_SHIPPING_INDVSHIP_STATUS') and $shiptotal) { 30 tep_session_unregister('shipping'); 31 } 32 // EOF: MOD - Individual Shipping 33 34 // if the customer is not logged on, redirect them to the login page 35 if (!tep_session_is_registered('customer_id')) { 36 $navigation->set_snapshot(); 37 tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL')); 38 } 39 40 // if there is nothing in the customers cart, redirect them to the shopping cart page 41 if ($cart->count_contents() < 1) { 42 tep_redirect(tep_href_link(FILENAME_SHOPPING_CART)); 43 } 44 45 // if no shipping destination address was selected, use the customers own address as default 46 if (!tep_session_is_registered('sendto')) { 47 tep_session_register('sendto'); 48 $sendto = $customer_default_address_id; 49 } else { 50 // verify the selected shipping address 51 if ( (is_array($sendto) && empty($sendto)) || is_numeric($sendto) ) { 52 $check_address_query = tep_db_query("select count(*) as total from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$customer_id . "' and address_book_id = '" . (int)$sendto . "'"); 53 $check_address = tep_db_fetch_array($check_address_query); 54 55 if ($check_address['total'] != '1') { 56 $sendto = $customer_default_address_id; 57 if (tep_session_is_registered('shipping')) tep_session_unregister('shipping'); 58 } 59 } 60 } 61 62 require (DIR_WS_CLASSES . 'order.php'); 63 $order = new order; 64 65 // register a random ID in the session to check throughout the checkout procedure 66 // against alterations in the shopping cart contents 67 if (!tep_session_is_registered('cartID')) tep_session_register('cartID'); 68 $cartID = $cart->cartID; 69 70 // if the order contains only virtual products, forward the customer to the billing page as 71 // a shipping address is not needed 72 // LINE CHANGED: MOD - CREDIT CLASS Gift Voucher Contribution 73 // if ($order->content_type == 'virtual') { 74 if (($order->content_type == 'virtual') || ($order->content_type == 'virtual_weight') ) { 75 if (!tep_session_is_registered('shipping')) tep_session_register('shipping'); 76 $shipping = false; 77 $sendto = false; 78 tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL')); 79 } 80 81 $total_weight = $cart->show_weight(); 82 $total_count = $cart->count_contents(); 83 // BOF: MOD - UPSXML 1.3.3 84 if (defined('SHIPPING_DIMENSIONS_SUPPORT') && SHIPPING_DIMENSIONS_SUPPORT == 'Ready-to-ship only') { 85 $dimensions_support = 1; 86 } elseif (defined('SHIPPING_DIMENSIONS_SUPPORT') && SHIPPING_DIMENSIONS_SUPPORT == 'With product dimensions') { 87 $dimensions_support = 2; 88 } else { 89 $dimensions_support = 0; 90 } 91 92 if ($dimensions_support > 0) { 93 require (DIR_WS_CLASSES . 'packing.php'); 94 $packing = new packing; 95 } 96 // EOF: MOD - UPSXML 1.3.3 97 98 // load all enabled shipping modules 99 require (DIR_WS_CLASSES . 'shipping.php'); 100 $shipping_modules = new shipping; 101 102 if ( defined('MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING') && (MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING == 'true') ) { 103 $pass = false; 104 105 switch (MODULE_ORDER_TOTAL_SHIPPING_DESTINATION) { 106 case 'national': 107 if ($order->delivery['country_id'] == STORE_COUNTRY) { 108 $pass = true; 109 } 110 break; 111 case 'international': 112 if ($order->delivery['country_id'] != STORE_COUNTRY) { 113 $pass = true; 114 } 115 break; 116 case 'both': 117 $pass = true; 118 break; 119 } 120 121 $free_shipping = false; 122 if ( ($pass == true) && ($order->info['total'] >= MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER) ) { 123 $free_shipping = true; 124 125 include(DIR_WS_LANGUAGES . $language . '/modules/order_total/ot_shipping.php'); 126 } 127 } else { 128 $free_shipping = false; 129 } 130 131 // process the selected shipping method 132 if ( isset($HTTP_POST_VARS['action']) && ($HTTP_POST_VARS['action'] == 'process') ) { 133 if (!tep_session_is_registered('comments')) tep_session_register('comments'); 134 if (tep_not_null($HTTP_POST_VARS['comments'])) { 135 $comments = tep_db_prepare_input($HTTP_POST_VARS['comments']); 136 } 137 138 if (!tep_session_is_registered('shipping')) tep_session_register('shipping'); 139 140 if ( (tep_count_shipping_modules() > 0) || ($free_shipping == true) ) { 141 if ( (isset($HTTP_POST_VARS['shipping'])) && (strpos($HTTP_POST_VARS['shipping'], '_')) ) { 142 $shipping = $HTTP_POST_VARS['shipping']; 143 144 list($module, $method) = explode('_', $shipping); 145 if ( is_object($$module) || ($shipping == 'free_free') ) { 146 if ($shipping == 'free_free') { 147 $quote[0]['methods'][0]['title'] = FREE_SHIPPING_TITLE; 148 $quote[0]['methods'][0]['cost'] = '0'; 149 } else { 150 $quote = $shipping_modules->quote($method, $module); 151 } 152 if (isset($quote['error'])) { 153 tep_session_unregister('shipping'); 154 } else { 155 if ( (isset($quote[0]['methods'][0]['title'])) && (isset($quote[0]['methods'][0]['cost'])) ) { 156 $shipping = array('id' => $shipping, 157 'title' => (($free_shipping == true) ? $quote[0]['methods'][0]['title'] : $quote[0]['module'] . ' (' . $quote[0]['methods'][0]['title'] . ')'), 158 'cost' => $quote[0]['methods'][0]['cost']); 159 160 tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL')); 161 } 162 } 163 } else { 164 tep_session_unregister('shipping'); 165 } 166 } 167 } else { 168 $shipping = false; 169 170 tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL')); 171 } 172 } 173 174 // get all available shipping quotes 175 $quotes = $shipping_modules->quote(); 176 177 // if no shipping method has been selected, automatically select the cheapest method. 178 // if the modules status was changed when none were available, to save on implementing 179 // a javascript force-selection method, also automatically select the cheapest shipping 180 // method if more than one module is now enabled 181 if ( !tep_session_is_registered('shipping') || ( tep_session_is_registered('shipping') && ($shipping == false) && (tep_count_shipping_modules() > 1) ) ) $shipping = $shipping_modules->cheapest(); 182 183 require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHECKOUT_SHIPPING); 184 185 $breadcrumb->add(NAVBAR_TITLE_1, tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL')); 186 $breadcrumb->add(NAVBAR_TITLE_2, tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL')); 187 188 $content = CONTENT_CHECKOUT_SHIPPING; 189 $javascript = $content . '.js'; 190 191 include (bts_select('main', $content_template)); // BTSv1.5 192 193 require (DIR_WS_INCLUDES . 'application_bottom.php'); 194 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Jan 1 13:43:16 2010 | Cross-referenced by PHPXref 0.7 |