Location: PHPKode > projects > Simple PHP Shopping cart - asaancart > asaancart v-0.9/admin/delete_variant_group_from_product.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");

$group_id = $_GET['group_id'];
$product_id = $_GET['product_id'];
if($_GET['mode']=="delete")
{	
	$sql = "DELETE FROM product_variants WHERE variant_group_id=".$group_id. " AND product_id='$product_id'";
	$results = mysql_query($sql);
		
	$smarty->assign('msg','Done: Deleted Successfully');
	
}


//list variants
//manage
$sql = "SELECT DISTINCT variant_group_id FROM product_variants WHERE product_id='$product_id'";
$results = mysql_query($sql);
while($row = mysql_fetch_assoc($results) )
{
	$sql2 = "SELECT * FROM variant_group WHERE variant_group_id=".$row['variant_group_id'];
	$results2 = mysql_query($sql2);
	while($row2 = mysql_fetch_assoc($results2) )
	{
		$list_product_variant_groups[] = $row2;	
		$list_product_variant_groups_id[] = $row['variant_group_id'];
	}
}

$smarty->assign('list_product_variant_groups', $list_product_variant_groups);
//end manage

///list all sub variants
//manage
$sql = "SELECT * FROM product_variants WHERE product_id='$product_id'";
$results = mysql_query($sql);
$total_v = mysql_num_rows($results);
while($row = mysql_fetch_assoc($results) )
{
	$list_all_product_sub_variants[] = $row;		
}
$smarty->assign('list_all_product_sub_variants', $list_all_product_sub_variants);
//end manage

//end list variants

//remaining

$sql = "SELECT * FROM variant_group WHERE variant_group_id NOT IN (SELECT DISTINCT variant_group_id FROM product_variants WHERE product_id='$product_id')";;
$results = mysql_query($sql);

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

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

//list variants
//manage
$sql = "SELECT * FROM variant_group ORDER BY group_name";
$results = mysql_query($sql);
$total_group = mysql_num_rows($results);
$smarty->assign('total_group', $total_group);

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

$smarty->assign('list_all_variant_group', $list_all_variant_group);
//end manage



///list all sub variants
//manage
$sql = "SELECT * FROM variants ORDER BY variant_name";
$results = mysql_query($sql);
$total_sub_variants = mysql_num_rows($results);
$smarty->assign('total_sub_variants', $total_sub_variants);

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

$smarty->assign('list_all_sub_variants', $list_all_sub_variants);
//end manage

//end list variants
$smarty->display('edit_product_list_variants.tpl');
?>
Return current item: Simple PHP Shopping cart - asaancart