<?php
session_start();
/*
asaancart - easy shopping cart solution
---------------------------------------
Copyright 2009 Nasir Ahmad Khan
Email: hide@address.com
This file is part of asaancart - open source easy shopping cart solution.
asaancart is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
asaancart is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with asaancart. If not, see <http://www.gnu.org/licenses/>.
*/
include("../config/config.php");
include("includes/chk_login_status_inc.php");
$smarty->assign('title','Edit Customer');
$customer_id = $_GET['customer_id'];
//////////////edit
if($_POST['btn_edit']=="Save")
{
if($customer_id==""){
$customer_id = $_POST['customer_id'];
}
$customer_name = $_POST['customer_name'];
$business_name = $_POST['business_name'];
$customer_address = $_POST['customer_address'];
$customer_country = $_POST['customer_country'];
$customer_state = $_POST['customer_state'];
$customer_city = $_POST['customer_city'];
$customer_suburb = $_POST['customer_suburb'];
$customer_postcode = $_POST['customer_postcode'];
$customer_mobile = $_POST['customer_mobile'];
$customer_phone = $_POST['customer_phone'];
$email_address = $_POST['email_address'];
$mailing_list = $_POST['mailing_list'];
if($mailing_list==""){$mailing_list="no";}
//billing
$b_customer_address = $_POST['b_customer_address'];
$b_customer_country = $_POST['b_customer_country'];
$b_customer_state = $_POST['b_customer_state'];
$b_customer_city = $_POST['b_customer_city'];
$b_customer_suburb = $_POST['b_customer_suburb'];
$b_customer_postcode = $_POST['b_customer_postcode'];
//shipping
$s_customer_address = $_POST['s_customer_address'];
$s_customer_country = $_POST['s_customer_country'];
$s_customer_state = $_POST['s_customer_state'];
$s_customer_city = $_POST['s_customer_city'];
$s_customer_suburb = $_POST['s_customer_suburb'];
$s_customer_postcode = $_POST['s_customer_postcode'];
//inser into product table
$sql = "UPDATE customers SET customer_name='$customer_name',business_name='$business_name', customer_address='$customer_address', customer_country='$customer_country', customer_state='$customer_state', customer_city='$customer_city', customer_suburb='$customer_suburb', customer_postcode='$customer_postcode', customer_mobile='$customer_mobile', customer_phone='$customer_phone', email_address='$email_address', b_customer_address='$b_customer_address', b_customer_country='$b_customer_country', b_customer_state='$b_customer_state', b_customer_city='$b_customer_city', b_customer_suburb='$b_customer_suburb', b_customer_postcode='$b_customer_postcode', s_customer_address='$s_customer_address', s_customer_country='$s_customer_country', s_customer_state='$s_customer_state', s_customer_city='$s_customer_city', s_customer_suburb='$s_customer_suburb', s_customer_postcode='$s_customer_postcode', mailing_list='$mailing_list' WHERE customer_id=$customer_id";
$results = mysql_query($sql);
$smarty->assign('msg_customer','Done: Changes saved successfully');
}
/////////////////end edit
//manage
$sql = "SELECT * FROM customers WHERE customer_id=".$customer_id;
$results = mysql_query($sql);
while($row = mysql_fetch_assoc($results) )
{
$selected_customer[] = $row;
/*/get pro image
$sql_img = "SELECT * FROM product_images WHERE product_id='".$row['product_id']."'";
$results_img = mysql_query($sql_img);
while($row_img = mysql_fetch_assoc($results_img) )
{
$product_images[] = $row_img;
}
*/
// end pro img
}
$smarty->assign('selected_customer', $selected_customer);
$smarty->display('edit_customer.tpl');
?>