set_snapshot(); tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL')); } // if there is nothing in the customers cart, redirect them to the shopping cart page if ($cart->count_contents() < 1) { tep_redirect(tep_href_link(FILENAME_SHOPPING_CART)); } // if no shipping destination address was selected, use the customers own address as default if (!tep_session_is_registered('sendto')) { tep_session_register('sendto'); $sendto = $customer_default_address_id; } else { // verify the selected shipping address // PWA BOF if ($customer_id == 0) { $sendto = 1; } else { $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 . "'"); $check_address = tep_db_fetch_array($check_address_query); if ($check_address['total'] != '1') { $sendto = $customer_default_address_id; if (tep_session_is_registered('shipping')) tep_session_unregister('shipping'); } } } // PWA EOF require(DIR_WS_CLASSES . 'order.php'); $order = new order; // register a random ID in the session to check throughout the checkout procedure // against alterations in the shopping cart contents if (!tep_session_is_registered('cartID')) tep_session_register('cartID'); $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') { if (!tep_session_is_registered('shipping')) tep_session_register('shipping'); $shipping = false; $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'] >= MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER) ) { $free_shipping = true; include(DIR_WS_LANGUAGES . $language . '/modules/order_total/ot_shipping.php'); } } else { $free_shipping = false; } // process the selected shipping method if ( isset($HTTP_POST_VARS['action']) && ($HTTP_POST_VARS['action'] == 'process') ) { if (!tep_session_is_registered('comments')) tep_session_register('comments'); if (tep_not_null($HTTP_POST_VARS['comments'])) { $comments = tep_db_prepare_input($HTTP_POST_VARS['comments']); } if (!tep_session_is_registered('shipping')) tep_session_register('shipping'); if ( (tep_count_shipping_modules() > 0) || ($free_shipping == true) ) { if ( (isset($HTTP_POST_VARS['shipping'])) && (strpos($HTTP_POST_VARS['shipping'], '_')) ) { $shipping = $HTTP_POST_VARS['shipping']; list($module, $method) = explode('_', $shipping); if( ($module == '1') && ($method == 'prod') ) { $shipping = array('id' => $shipping, 'title' => "Per Product Shipping", 'cost' => 0.00); tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL')); // tep_redirect(tep_href_link(FILENAME_CHECKOUT_CONFIRMATION, '', 'SSL')); } if ( is_object($$module) || ($shipping == 'free_free') ) { if ($shipping == 'free_free') { $quote[0]['methods'][0]['title'] = FREE_SHIPPING_TITLE; $quote[0]['methods'][0]['cost'] = '0'; } else { $quote = $shipping_modules->quote($method, $module); } if (isset($quote['error'])) { tep_session_unregister('shipping'); } else { if ( (isset($quote[0]['methods'][0]['title'])) && (isset($quote[0]['methods'][0]['cost'])) ) { $shipping = array('id' => $shipping, 'title' => (($free_shipping == true) ? $quote[0]['methods'][0]['title'] : $quote[0]['module'] . ' (' . $quote[0]['methods'][0]['title'] . ')'), 'cost' => $quote[0]['methods'][0]['cost']); tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL')); // tep_redirect(tep_href_link(FILENAME_CHECKOUT_CONFIRMATION, '', 'SSL')); } } } else { 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); $breadcrumb->add(NAVBAR_TITLE_1, tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL')); $breadcrumb->add(NAVBAR_TITLE_2, tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL')); // Added to get Customer First Name and Last Name for Payment Gateway. // $customer_query = tep_db_query("select customers_firstname as fname, customers_lastname as lname from customers where customers_id = '" . (int)$customer_id . "'"); $customer_query = tep_db_query("select customers_firstname as fname, customers_lastname as lname,customers_email_address as theemail, customers_telephone as fphone from customers where customers_id = '" . (int)$customer_id . "'"); $customer = tep_db_fetch_array($customer_query); ?> > Baseball Batting Cages Shopping Cart
0) { ?>

' . tep_image_button('button_change_address.gif', IMAGE_BUTTON_CHANGE_ADDRESS) . ''; ?>
' . TITLE_SHIPPING_ADDRESS . '
' . tep_image(DIR_WS_IMAGES . 'arrow_south_east.gif'); ?>
'); ?>
1 && sizeof($quotes[0]) > 1) { ?> ' . "\n"; } else { echo ' ' . "\n"; } ?> 1) || ($n2 > 1) ) { ?>
0 || (defined('PURCHASE_WITHOUT_ACCOUNT_SEPARATE_SHIPPING') && PURCHASE_WITHOUT_ACCOUNT_SEPARATE_SHIPPING=='yes') )? TEXT_CHOOSE_SHIPPING_DESTINATION . '

' . tep_image_button('button_change_address.gif', IMAGE_BUTTON_CHANGE_ADDRESS) . '':' '); ?>
' . TITLE_PLEASE_SELECT . '
' . tep_image(DIR_WS_IMAGES . 'arrow_east_south.gif'); ?>
 
format(MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER)) . tep_draw_hidden_field('shipping', 'free_free'); ?>
delivery['state']; $notstates = array("Northern Mariana Islands", "Alaska", "American Samoa", "Guam", "Marshall Islands", "Hawaii", "Palau", "Puerto Rico", "Virgin Islands", "Federated States Of Micronesia"); if (in_array($thestate, $notstates)) { $theshiparea='1'; } if ($order->delivery['country_id'] != STORE_COUNTRY || $theshiparea =='1') { $error12='2'; if ($theshiparea != 'Not Continental United States'){$theshiparea='Not United States';} $errorname=' - Country ID = '.$thecountry. ' - '.$theshiparea; } // echo $testcountry; //if ($quotes[0]['methods'][0]['cost'] ==0){$error12='';}else{ if ($quotes[0]['methods'][0]['cost'] != true && $shipping['id'] != true && $error12 =='' && $quotes[0]['methods'][0]['cost'] != '0') { $error12='1'; $errorname=' - Type: '.$shipping['id']. ' - Cost: '.$quotes[0]['methods'][0]['cost']; } //} if ($shipping['id']=='multiship_multiship' && $error12 =='' && $quotes[0]['methods'][0]['cost']!= 'CALL FOR SHIPPING'){ if ($quotes[0]['methods'][0]['cost'] ==0){ if ($quotes[0]['methods'][0]['cost'] != '0'){ $error12='3'; $errorname=' - Type: '.$shipping['id']. ' - Cost: '.$quotes[0]['methods'][0]['cost']; }}} if ($error12 !='' && $error12 !='2'){ echo 'To save you money, due to changing fuel prices.
PLEASE CALL FOR SHIPPING
'.$ThePhoneNumber.'

Tell us that you saw us on the Internet.
'; } if ($error12 !='' && $error12 =='2'){ echo '!* '.$thestate.'
To Ship to locations outside of the Continental United States,
This includes Canada, Alaska, Puerto Rico and Hawaii.
PLEASE CALL FOR A SHIPPING QUOTE :)
'.$ThePhoneNumber.'

or contact us here: '.$TheEmailAddy.'
'; } if ($error12 != ''){ $referral=$_SERVER['HTTP_REFERER']; $remoteaddress=$_SERVER['REMOTE_ADDR']; $remoteaddress2=''.$remoteaddress.''; $no_checkout = true; // echo $error12; $customer_error = tep_address_label($customer_id, $sendto, true); $aemail = $customer['theemail']; $thephone = $customer['fphone']; $products = $cart->get_products(); for ($i=0, $n=sizeof($products); $i<$n; $i++) { // Push all attributes information in an array if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) { while (list($option, $value) = each($products[$i]['attributes'])) { echo tep_draw_hidden_field('id[' . $products[$i]['id'] . '][' . $option . ']', $value); $attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.products_id = '" . $products[$i]['id'] . "' and pa.options_id = '" . $option . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . $value . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . $languages_id . "' and poval.language_id = '" . $languages_id . "'"); $attributes_values = tep_db_fetch_array($attributes); $products[$i][$option]['products_options_name'] = $attributes_values['products_options_name']; $products[$i][$option]['options_values_id'] = $value; $products[$i][$option]['products_options_values_name'] = $attributes_values['products_options_values_name']; $products[$i][$option]['options_values_price'] = $attributes_values['options_values_price']; $products[$i][$option]['price_prefix'] = $attributes_values['price_prefix']; } } } $info_box_contents[$cur_row][] = array('align' => 'center', 'params' => 'class="productListing-data" valign="top"', /* 'text' => tep_draw_checkbox_field('cart_delete[]', $products[$i]['id'])); */ 'text' => tep_draw_form('cart_quantity', tep_href_link(FILENAME_SHOPPING_CART, "action=update_product")) . ""); for ($i=0, $n=sizeof($products); $i<$n; $i++) { $products_name .= '
 
' . ' ' . '
' . $products[$i]['name'] . '   Quantity: '.$products[$i]['quantity'].'
Error Code: '.$error12.$errorname.' '; } $products_name .= '
'; $thetime=time(); $useragent = $_SERVER['HTTP_USER_AGENT']; $bemail="
$aemail"; $showtime=date("l, F jS Y - H:i:s"); $myFile = "admin/ShippingErrors.txt"; $fh = fopen($myFile, 'a'); $stringData = "$showtime
$customer_error\n $bemail \n
$thephone \n
IP: $remoteaddress2\n
$useragent\n \n $products_name \n \n \n"; fwrite($fh, $stringData); fclose($fh); } // end work around and error logging // // // end work around and error logging if (isset($quotes[$i]['error'])) { ?>
format(tep_add_tax($quotes[$i]['methods'][$j]['cost'], (isset($quotes[$i]['tax']) ? $quotes[$i]['tax'] : 0))); */ ?> format(tep_add_tax($quotes[$i]['methods'][$j]['cost'], $quotes[$i]['tax'])) . */ tep_draw_hidden_field('shipping', $quotes[$i]['id'] . '_' . $quotes[$i]['methods'][$j]['id']); ?>
' . TITLE_CONTINUE_CHECKOUT_PROCEDURE . '
' . TEXT_CONTINUE_CHECKOUT_PROCEDURE; ?>