<?php
/* 快捷商城系统
 * 版本号：2.0
 * 官网：http://www.kjcms.cn
 * 2015-02-16
 */
class ctl_goods extends mod_goods{
	function act_default() {
		$cid = (int)fun_get::get('cid');
		$this->brand_id = (int)fun_get::get("brand_id");
		$this->category_info = $this->get_category_info($cid);
		$this->arr_attribute=tab_mall_goods_category_attributed::get_list($cid,$this->category_info['pids']);
		$this->arr_attribute_name = array_keys($this->arr_attribute);
		$this->brand_list = cls_obj::get("datasource_inc")->get_brand_list($cid);
		$this->list_goods=$this->get_goods_list( $cid , $this->arr_attribute);
		$act = (fun_is::wap() && $this->category_info['wap_show'] == 2) ? "default.pic" : "";
		if($this->brand_id>0) {
			$this->brand_info = cls_obj::get("datasource_inc")->get_brand_info($this->brand_id);
		}
		return $this->get_view($act);
	}
	function act_ajax_list() {
		$cid = (int)fun_get::get('cid');
		$list_goods=$this->get_goods_list( $cid);
		return fun_format::json($list_goods);
	}


	function act_view() {
		$id = fun_get::get("id");
		$obj_goods = $this->get_goodsinfo($id);
		$obj_goods['goods_detail']=fun_format::wap_cont($obj_goods['goods_detail']);
		$this->goods = $obj_goods;
		return $this->get_view();
	}
	function act_view_detail() {
		$id = fun_get::get("id");
		$obj_goods = $this->get_goodsinfo($id);
		$obj_goods['goods_detail']=fun_format::wap_cont($obj_goods['goods_detail']);
		$this->goods = $obj_goods;
		return $this->get_view();
	}
	function act_view_comment() {
		$id = fun_get::get("id");
		$this->goods = $this->get_goodsinfo($id);
		return $this->get_view();
	}

	function act_category() {
		$this->cid = (int)fun_get::get("cid");
		$this->category_info = $this->get_category_info($this->cid);
		$this->arr_list = cls_obj::get("datasource_inc")->get_category($this->cid);
		if(count($this->arr_list)<1) {
			fun_base::url_jump("?app=goods&cid=" . $this->cid);exit;
		}
		return $this->get_view();
	}
}