Location: PHPKode > projects > Simple PHP Shopping cart - asaancart > asaancart v-0.9/admin/shipping_settings.php
<?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','Shipping Settings');

$shipping_id = $_POST['shipping_id'];
if($shipping_id==""){
$shipping_id = $_GET['shipping_id'];
}

$shipping_name = $_GET['shipping_name'];
$shipping_description = $_GET['shipping_description'];
$email_text = $_GET['email_text'];
$module_id = $_GET['module_id'];


if($_GET['mode']=="enable"){
	$sql = "UPDATE shipping_method SET shipping_enable='yes' WHERE shipping_id=".$shipping_id;
	$results = mysql_query($sql);
	//$smarty->assign('msg', "<span>Done, successfully upadated</span>");
	$update_list=1;
}elseif($_GET['mode']=="disable")
{
	$sql = "UPDATE shipping_method SET shipping_enable='no' WHERE shipping_id=".$shipping_id;
	$results = mysql_query($sql);
	//$smarty->assign('msg', "<span>Done, successfully upadated</span>");
	$update_list=1;
}


if($_GET['mode']=="save")
{	
		$sql = "UPDATE shipping_method SET shipping_name='$shipping_name', shipping_description='$shipping_description', email_text='$email_text', module_id=$module_id, sort_order=0 WHERE shipping_id=$shipping_id";
		$results = mysql_query($sql);
		$smarty->assign('msg', "<span>Done, settings saved successfully</span>");
	$update_list=1;
}

if($_GET['mode']=="add")
{	
		$sql = "INSERT INTO shipping_method (shipping_name, shipping_description, email_text, sort_order) VALUES ('$shipping_name', '$shipping_description', '$email_text', 0)";
		$results = mysql_query($sql);
		$smarty->assign('msg', "<span>Done, settings added successfully</span>");
	$update_list=1;
}

if($_GET['mode']=="delete")
{	
		$sql = "DELETE FROM shipping_method WHERE shipping_id=".$shipping_id;
		$results = mysql_query($sql);
		$smarty->assign('msg', "<span>Done, deleted successfully</span>");
	$update_list=1;
}

$sql = "SELECT * FROM shipping_method";
$results = mysql_query($sql);
while($row = mysql_fetch_assoc($results) )
{
	$list_shipping_methods[] = $row;
}

$smarty->assign('list_shipping_methods', $list_shipping_methods);


$sql = "SELECT * FROM modules WHERE module_category='shipping' AND module_enable='yes'";
$results = mysql_query($sql);
$total_active_shipping_module = mysql_num_rows($results);

while($row = mysql_fetch_assoc($results) )
{
	$list_modules[] = $row;
}

$smarty->assign('total_active_shipping_module', $total_active_shipping_module);
$smarty->assign('list_modules', $list_modules);

if($update_list==1){
	$smarty->display('shipping_settings_form.tpl');
}else{
	$smarty->display('shipping_settings.tpl');
}
?>
Return current item: Simple PHP Shopping cart - asaancart