<?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'];
if($_GET['mode']=="set_special")
{
$sql = "UPDATE products SET is_special='yes' WHERE product_id='$product_id'";
$results = mysql_query($sql);
$smarty->assign('msg','Updated Successfully');
}
if($_GET['mode']=="online")
{
$sql = "UPDATE products SET product_status='online' WHERE product_id='$product_id'";
$results = mysql_query($sql);
$smarty->assign('msg','Updated Successfully');
}
if($_GET['mode']=="offline")
{
$sql = "UPDATE products SET product_status='offline' WHERE product_id='$product_id'";
$results = mysql_query($sql);
$smarty->assign('msg','Updated Successfully');
}
if($_GET['mode']=="undo_special")
{
$sql = "UPDATE products SET is_special='no' WHERE product_id='$product_id'";
$results = mysql_query($sql);
$smarty->assign('msg','Updated Successfully');
}
if($_GET['mode']=="set_featured")
{
$sql = "UPDATE products SET is_featured='yes' WHERE product_id='$product_id'";
$results = mysql_query($sql);
$smarty->assign('msg','Updated Successfully');
}
if($_GET['mode']=="undo_featured")
{
$sql = "UPDATE products SET is_featured='no' WHERE product_id='$product_id'";
$results = mysql_query($sql);
$smarty->assign('msg','Updated Successfully');
}
if($_GET['mode']=="set_new")
{
$sql = "UPDATE products SET is_new='yes' WHERE product_id='$product_id'";
$results = mysql_query($sql);
$smarty->assign('msg','Updated Successfully');
}
if($_GET['mode']=="undo_new")
{
$sql = "UPDATE products SET is_new='no' WHERE product_id='$product_id'";
$results = mysql_query($sql);
$smarty->assign('msg','Updated Successfully');
}
if($_GET['mode']=="set_clearence")
{
$sql = "UPDATE products SET is_clearence='yes' WHERE product_id='$product_id'";
$results = mysql_query($sql);
$smarty->assign('msg','Updated Successfully');
}
if($_GET['mode']=="undo_clearence")
{
$sql = "UPDATE products SET is_clearence='no' WHERE product_id='$product_id'";
$results = mysql_query($sql);
$smarty->assign('msg','Updated Successfully');
}
//manage
$sql = "SELECT * FROM products ORDER BY product_name";
$results = mysql_query($sql);
$total_products = mysql_num_rows($results);
$smarty->assign('total_products', $total_products);
while($row = mysql_fetch_assoc($results) )
{
$all_product_list[] = $row;
//get pro image
$sql_img = "SELECT * FROM product_images WHERE product_id='".$row['product_id']."' ORDER BY is_main DESC";
$results_img = mysql_query($sql_img);
$img_cnt = 0;
while($row_img = mysql_fetch_assoc($results_img) )
{
if($img_cnt<1){
$product_images[] = $row_img;
$img_cnt++;
}
}
// end pro img
}
$smarty->assign('product_images', $product_images);
$smarty->assign('all_product_list', $all_product_list);
//end manage
$smarty->display('list_all_products.tpl');
?>