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

$product_id = $_GET['product_id'];
$main_product_id = $_GET['main_product_id'];
$action = $_GET['action'];

//delte
if($action=="related"){
	$sql = "DELETE FROM related_products WHERE related_product_id='$product_id'";
	$results = mysql_query($sql);
	$tbl_name = "related_products";
	$pro_id_field = "related_product_id";
	$tbl_action = "related";
}
elseif($action=="cross"){
	$sql = "DELETE FROM cross_selling_products WHERE cross_product_id='$product_id'";
	$results = mysql_query($sql);
	$tbl_name = "cross_selling_products";
	$pro_id_field = "cross_product_id";
	$tbl_action = "cross";
}


//manage
$sql = "SELECT * FROM ".$tbl_name." WHERE product_id='$main_product_id'";
$results = mysql_query($sql);
$total_products = mysql_num_rows($results);
$smarty->assign('total_products', $total_products);

while($row = mysql_fetch_assoc($results) )
{
	$related_product_id = $row[$pro_id_field];
	$sql2 = "SELECT * FROM products WHERE product_id='$related_product_id'";
	$results2 = mysql_query($sql2);
	while($row2 = mysql_fetch_assoc($results2) )
	{
		$cross_all_product_list[] = $row2;
	}
}
//$smarty->assign('product_images', $product_images);
$smarty->assign('cross_all_product_list', $cross_all_product_list);
$smarty->assign('tbl_action', $tbl_action);
$smarty->assign('main_product_id', $main_product_id);
//end manage



$smarty->display('cross_related_list_all_products_edit.tpl');
?>
Return current item: Simple PHP Shopping cart - asaancart