<?php 
require_once 'nsoconfig.php';

$type = $_GET['type'];

switch ($type) {
	case 'brand':
?>
<option selected="selected" value="">--请选择品牌--</option>
<?php
		$catid = $_GET['cat'];
		if(empty($catid)) break;
		
		$brands = getCategoriesByParent($catid);
		if ($brands): foreach($brands as $brand):
?>
<option value="<?php echo $brand['id']?>"><?php echo $brand['name']?></option>
<?php
		endforeach; endif;
		break;
		
	case 'product':
?>
<option selected="selected" value="">--请选择产品--</option>
<?php
		$catid = $_GET['cat'];
		if(empty($catid)) break;
		
		$products = getPostsByCategory($catid);
		if ($products): foreach($products as $product):
?>
<option value="<?php echo $product['post_id']?>"><?php echo $product['title']?></option>
<?php
		endforeach; endif;
		break;
	
	default:
		break;
}
