<?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','Manage Attributes values');
$attribute_value = $_GET['attribute_value'];
$attribute_id = $_GET['attribute_id'];
$selected_attribute_name = $_GET['attribute_name'];
$smarty->assign('attribute_id',$attribute_id);
$value_id = $_GET['value_id'];
if($_GET['mode']=="create")
{
if($attribute_id != ""){
$sql = "INSERT INTO attribute_value (attribute_id, attribute_value) VALUES (".$attribute_id.", '".$attribute_value."')";
$results = mysql_query($sql);
$smarty->assign('msg_attrib_value','Done: Created Successfully');
}else{
$smarty->assign('msg_attrib_value','Error: Please select attribute first');
}
$show=TRUE;
}
// delete
if($_GET['mode']=="delete")
{
$sql = "DELETE FROM attribute_value WHERE value_id=".$value_id;
$results = mysql_query($sql);
$smarty->assign('msg_attrib_value','Done: Deleted Successfully');
$show=TRUE;
}
if($_GET['mode']=="show" || $show==TRUE)
{
$sql = "SELECT * FROM attribute_value WHERE attribute_id=".$attribute_id." ORDER BY attribute_value";
$results = mysql_query($sql);
$total_attrib_value = mysql_num_rows($results);
$smarty->assign('total_attrib_value', $total_attrib_value);
while($row = mysql_fetch_assoc($results) )
{
$attrib_value_list[] = $row;
}
$smarty->assign('selected_attribute_name',$selected_attribute_name);
$smarty->assign('attrib_value_list', $attrib_value_list);
}
$smarty->display('show_attrib_value.tpl');
?>