예제 #1
0
    public function getBasket()
    {
        if (strlen($_POST['q']) > 2) {
            $data = array();
            $sql = '
				SELECT {{tree}}.id FROM {{catalog}} 
				INNER JOIN ({{search}} INNER JOIN {{tree}} ON {{search}}.tree={{tree}}.id)
				USING (tree)
				WHERE {{search}}.search LIKE \'%' . $_POST['q'] . '%\' AND {{tree}}.visible=1
			';
            $temp = DB::getAll($sql, 'id');
            foreach ($temp as $id) {
                $item = Goods::getOne($id);
                $item['sizes'] = Goods::getSizes($id);
                if ($item['sizes']) {
                    $data[] = $item;
                }
            }
            return $data;
        } else {
            return array();
        }
    }
예제 #2
0
파일: goods.php 프로젝트: OldMo/DaoGou
    include_once ADMIN_TEMP . 'product.html';
} elseif ($act == 'add') {
    //新增商品
    //获取商品分类
    $category = new Product();
    $categories = $category->getProduct();
    //加载表单
    include_once ADMIN_TEMP . 'product-add.html';
} elseif ($act == 'modify') {
    //修改商品
    $id = $_GET['id'];
    //获取商品分类
    $category = new Product();
    $categories = $category->getProduct();
    $goods = new Goods();
    $goodss = $goods->getOne($id);
    //var_dump($goodss);exit;
    include_once ADMIN_TEMP . 'product-modify.html';
} elseif ($act == 'delete') {
    //删除商品
    $id = $_GET['id'];
    $goods = new Goods();
    if ($goods->GoodsByDelete($id)) {
        //成功
        ym_manage('goods.php', '商品删除成功!');
    } else {
        //失败
        ym_manage('goods.php?act=product', '商品删除失败!');
    }
    //include_once ADMIN_TEMP . 'product.html';
} elseif ($act == 'insert') {