<?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','Payment Settings');
$pm_id = 1;//$_POST['pm_id'];
$paypal_id = $_POST['paypal_id'];
$paypal_api_username = $_POST['paypal_api_username'];
$paypal_api_password = $_POST['paypal_api_password'];
$paypal_api_signature = $_POST['paypal_api_signature'];
$bank_deposit = $_POST['bank_deposit'];
$money_order = $_POST['money_order'];
//$activate_paypal = $_POST['activate_paypal'];
$activate_bank_deposit = $_POST['activate_bank_deposit'];
$activate_money_order = $_POST['activate_money_order'];
$activate_bank_check = $_POST['activate_bank_check'];
$bank_deposit_instructions = $_POST['bank_deposit_instructions'];
$money_order_instructions = $_POST['money_order_instructions'];
$bank_check = $_POST['bank_check'];
if($activate_paypal==""){$activate_paypal="no";}
if($activate_bank_deposit==""){$activate_bank_deposit="no";}
if($activate_money_order==""){$activate_money_order="no";}
if($activate_bank_check==""){$activate_bank_check="no";}
if($_POST['btn_submit']=="Save")
{
$sql = "SELECT * FROM payment_options WHERE pm_id=".$pm_id;
$results = mysql_query($sql);
$total_res = mysql_num_rows($results);
if($total_res>0){
$sql = "UPDATE payment_options SET paypal_id='$paypal_id', paypal_api_username='$paypal_api_username', paypal_api_password='$paypal_api_password', paypal_api_signature='$paypal_api_signature', bank_deposit='$bank_deposit', money_order='$money_order', bank_check='$bank_check', activate_money_order='$activate_money_order', activate_paypal='yes', activate_bank_deposit='$activate_bank_deposit', activate_bank_check='$activate_bank_check', bank_deposit_instructions='$bank_deposit_instructions', money_order_instructions='$money_order_instructions' WHERE pm_id=$pm_id";
$results = mysql_query($sql);
//echo $sql;
$smarty->assign('msg', "<span>Done, payment settings saved successfully</span>");
}else{
$smarty->assign('msg', "<span style='color:red'>Sorry, this payment ID is invalid, please contact your system administrator</span>");
}//page cnt
}
$sql = "SELECT * FROM payment_options WHERE pm_id=".$pm_id;
$results = mysql_query($sql);
while($row = mysql_fetch_assoc($results) )
{
$payment_options[] = $row;
}
$smarty->assign('payment_options', $payment_options);
$smarty->display('payment_settings.tpl');
?>