Your currently have no items in your basket. Please add some items to the basket!
} ?>$path='../../';
include($path."includes/header.inc.php");
//all validation and errors
require_once($path.'shop/checkout/includes/validate_basket.php');
require_once($path.'shop/checkout/includes/basket_errors.php');
$basket= new Basket();
/**
* HANDLES THE SUBMIT ARRAY AND CHECKS ONLY ONE KEY EXISTS THEN APPLIES THE SWITCH
*/
if(sizeof($_POST["submit"])==1){
$submit = array_keys($_POST['submit']);
$submit = $submit[0];
}else{
$submit = '';
}
switch($submit){
/*
* APPLIES THE DISCOUNT CODES ENTERED BY THE USER
*/
case "apply_code":
if(!$basket->Set_Coupon($_POST['code'])){
$coupon_error="Sorry, the coupon code you have entered is not valid.";
}else{
$coupon_success="Your coupon code has been set.";
$success = true;
}
break;
/*
* DEALS WITH BASKET QUANTITY UPDATES
*/
case "update_basket":
$basket->Update_Quantities();
$basket->delivery_selected=$_POST['delivery'];
$basket->Set_Delivery_Cost();
$success = true;
break;
/*
* DEALS WITH MEMBER LOGINS IF MEMBERS IS ACTIVATED
*/
case "sign_in":
if($_POST['memberEmail']==''){
$memberErrors['memberEmail'] == 'You did not enter an email address.';
}
if($_POST['memberPassword']==''){
$memberErrors['memberPassword'] == 'You did not enter a password.';
}
if(sizeof($memberErrors)==0){
if($member->Login($_REQUEST['email'], $_REQUEST['password'])){
$_SESSION['member_email'] = $_REQUEST['email'];
$_SESSION['member_password'] = $_REQUEST['password'];
$_SESSION['member_id'] =$member->id;
$basket->Set_Member($member->id);
}else{
$memberErrors['login'] = 'The email address and password you entered were not valid.';
}
}
break;
case "Different Delivery Address?":
echo "show Different Delivery Address?
";
break;
/*
* PERFORMS FULL CHECKOUT VALIDATION PROCEDURE
*/
case "checkout":
//this is dealt with in the validate_basket area!
break;
/*
* DEALS WITH THE POSTCODE FINDER IN THE BILLING AREA
*/
case "billing_postcode":
if(!empty($_POST['billing_postcode'])){
$pc = $_POST['billing_postcode'];
$_REQUEST['postcode']= str_replace(' ', '', clean_db($pc));
$js_disabled = true;
require_once($path.'shop/checkout/includes/ajax_postcode.php');
if(!empty($options)){
$billing_paf = $options;
}else{
$bill_paf_error = true;
}
}
break;
case "billing_paf":
if(!empty($_POST['billing_address_list']) && PAF_ENABLED){
$add = explode(',', $_POST['billing_address_list']);
$_REQUEST['billing_address_line_1'] = $add[0];
if (count($add)==3) {
$_REQUEST['billing_address_line_2'] = $add[1];
} else if (count($add)==4) {
$_REQUEST['billing_address_line_2'] = $add[1].', '.$add[2];
}
$_REQUEST['billing_city'] = $add[count($add)-1];
$_REQUEST['billing_address_line_1']=str_replace('|',',',$_REQUEST['billing_address_line_1']);
$_REQUEST['billing_address_line_2']=str_replace('|',',',$_REQUEST['billing_address_line_2']);
}
break;
/*
* DEALS WITH THE POSTCODE FINDER IN THE SHIPPING AREA
*/
case "shipping_postcode":
if(!empty($_POST['shipping_postcode'])){
$pc = $_POST['shipping_postcode'];
$_REQUEST['postcode']= str_replace(' ', '', clean_db($pc));
$js_disabled = true;
require_once($path.'shop/checkout/includes/ajax_postcode.php');
if(!empty($options)){
$shipping_paf = $options;
}else{
$ship_paf_error = true;
}
}
break;
case "shipping_paf":
if(!empty($_POST['shipping_address_list_nojs']) && PAF_ENABLED){
$add = explode(',', $_POST['shipping_address_list_nojs']);
$_REQUEST['billing_address_line_1'] = $add[0];
if (count($add)==3) {
$_REQUEST['billing_address_line_2'] = $add[1];
} else if (count($add)==4) {
$_REQUEST['billing_address_line_2'] = $add[1].' '.$add[2];
}
$_REQUEST['billing_city'] = $add[count($add)-1];
$_REQUEST['billing_address_line_1']=str_replace('|',',',$_REQUEST['billing_address_line_1']);
$_REQUEST['billing_address_line_2']=str_replace('|',',',$_REQUEST['billing_address_line_2']);
}
break;
case "update_basket_enter":
default:
if(!empty($_POST['code'])){
if(!$basket->Set_Coupon($_POST['code'])){
$coupon_error="Sorry, the coupon code you have entered is not valid.";
}else{
$coupon_success="Your coupon code has been set.";
$success = true;
}
}
if (PAF_ENABLED) {
if(!empty($_POST['billing_postcode']) || !empty($_POST['shipping_postcode'])){
if(!empty($_POST['billing_postcode'])){
$pc = $_POST['billing_postcode'];
$_REQUEST['postcode']= str_replace(' ', '', clean_db($pc));
$js_disabled = true;
require_once($path.'shop/checkout/includes/ajax_postcode.php');
if(!empty($options)){
$billing_paf = $options;
}else{
$bill_paf_error = true;
}
}
if(!empty($_POST['shipping_postcode'])){
$pc = $_POST['shipping_postcode'];
$_REQUEST['postcode']= str_replace(' ', '', clean_db($pc));
$js_disabled = true;
require_once($path.'shop/checkout/includes/ajax_postcode.php');
if(!empty($options)){
$shipping_paf = $options;
}else{
$ship_paf_error = true;
}
}
}
}
$basket->Update_Quantities();
if(!empty($_POST['delivery'])){
$basket->delivery_selected=$_POST['delivery'];
$basket->Set_Delivery_Cost();
$success = true;
}
break;
}
/**
* DEALING WITH DELETES IS A LITTLE DIFFERENT, USING delete[id_of_product] DELETES THE PRODUCT.
* ALSO ALLOWS FOR MULTIPLE DELETE IN THE FUTURE, THIS NEEDS THE UPDATED DELETE_ITEM FUNCTION FOR THE BAKSET CLASS
*/
if(isset($_POST['delete'])){
foreach($_POST['delete'] as $del_id => $value){
$basket->Delete_Items($del_id);
}
}
$basket = new basket();
$basket->Go_Basket();
require_once($path.'shop/checkout/includes/basket_defaults.php');
$page_title = "Your Shopping Basket | ". SITE_NAME;
$description = "";
$keywords = "";
$slideshow = false;
$brandimage = false;
include($path."templates/header.php");
if(sizeof($basket->items)>0)
{
include($path.'shop/checkout/templates/basket.php');
} else {
?>
Your currently have no items in your basket. Please add some items to the basket!
} ?>