<?
include $_SERVER[DOCUMENT_ROOT] . "/common/conf/config.inc.php";
include $_SERVER[DOCUMENT_ROOT] . "/module/category/category.lib.php";
include $_SERVER[DOCUMENT_ROOT] . "/module/product/product.lib.php";

$cat = $_POST["cat"];
$mode = $_POST["mode"];


//DB연결
$dblink = SetConn($_conf_db["main_db"]);

switch ($mode) {
	case "getproduct":
		if (strlen(trim($cat))) {

			//카테고리 목록
			$arrList = getProductListBaseNFile($cat, "", "" ,"" ,"0" ,"");

			$list = array();

			for($i=0;$i<$arrList["total"];$i++){
				$list[] = $arrList['list'][$i];
			}

			$return = array(
						"success"	=> true,
						"result"	=> $list,
						);
		} else {
			$return = array(
							"success"	=> false,
							"result"	=> $list,
							);
		}
		break;
}

//DB해제
SetDisConn($dblink);

echo json_encode($return);
exit;
?>