Exemplo n.º 1
0
 public function findDetailsGoods()
 {
     $_oneGoods = parent::select(array('id', 'brand', 'nav', 'service', 'is_up', 'name', 'sales', 'thumbnail', 'thumbnail2', 'sn', 'attr', 'price_sale', 'price_market', 'unit', 'weight', 'content', 'is_freight', 'inventory'), array('where' => array("id='{$this->_R['goodsid']}'")));
     $_oneGoods[0]->content = htmlspecialchars_decode($_oneGoods[0]->content);
     $this->_tables = array(DB_PREFIX . 'brand');
     $_allBrand = Tool::setFormItem(parent::select(array('id', 'name')), 'id', 'name');
     if ($_oneGoods[0]->brand == 0) {
         $_oneGoods[0]->brandname = '其他品牌';
     } else {
         $_oneGoods[0]->brandname = $_allBrand[$_oneGoods[0]->brand];
     }
     $this->_tables = array(DB_PREFIX . 'service');
     $_where = array("id='{$_oneGoods[0]->service}'");
     $_service = parent::select(array('content'), array('where' => $_where, 'limit' => '1'));
     $_oneGoods[0]->service = htmlspecialchars_decode($_service[0]->content);
     $this->_tables = array(DB_PREFIX . 'goods');
     if (isset($_COOKIE['record'][$_oneGoods[0]->id])) {
         setcookie('record[' . $_oneGoods[0]->id . ']', '', time() - 60 * 60 * 24 * 7);
     }
     setcookie('record[' . $_oneGoods[0]->id . ']', serialize(array('id' => $_oneGoods[0]->id, 'nav' => $_oneGoods[0]->nav, 'name' => $_oneGoods[0]->name, 'thumbnail2' => $_oneGoods[0]->thumbnail2, 'price' => $_oneGoods[0]->price_sale)), time() + 60 * 60 * 24 * 7);
     if (isset($_COOKIE['record'])) {
         if (count($_COOKIE['record']) > 2) {
             $_keys = array_keys($_COOKIE['record']);
             setcookie('record[' . $_keys[0] . ']', '', time() - 60 * 60 * 24 * 7);
         }
     }
     return $_oneGoods;
 }
Exemplo n.º 2
0
 public function runUpdate()
 {
     if (isset($_POST['send'])) {
         $this->model->update() ? $this->redirect->success('品牌修改成功', $_POST['prev_url']) : $this->redirect->error('品牌修改失败');
     }
     if (isset($_GET['id'])) {
         $oneBrand = $this->model->findOne();
         $this->tpl->assign('oneBrand', $oneBrand[0]);
         $this->tpl->assign('prev_url', PREV_URL);
         $this->tpl->assign('allMainNavs', Tool::setFormItem($this->nav->getAllMainNavs(), 'id', 'name'));
         $this->tpl->display(ADMIN_STYLE . 'brand/update.tpl');
     }
 }
Exemplo n.º 3
0
 public function runUpdate()
 {
     if (isset($_POST['send'])) {
         $this->model->update() ? $this->redirect->success('管理员修改成功', $_POST['url']) : $this->redirect->error('管理员修改失败');
     }
     if (isset($_GET['id'])) {
         $this->tpl->assign('allLevel', Tool::setFormItem($this->level->findAll(), 'id', 'level_name'));
         $oneManage = $this->model->findOne();
         $this->tpl->assign('oneManage', $oneManage[0]);
         $this->tpl->assign('prev_url', PREV_URL);
         $this->tpl->display(ADMIN_STYLE . 'manage/update.tpl');
     }
 }
Exemplo n.º 4
0
 public function update()
 {
     if (isset($_POST['send'])) {
         if ($this->_model->update()) {
             $this->_redirect->succ(Tool::getPrevPage(), '管理员修改成功');
         } else {
             $this->_redirect->error('管理员修改失败');
         }
     }
     if (isset($_GET['id'])) {
         $this->_tpl->assign('AllLevel', Tool::setFormItem($this->_level->findAll(), 'id', 'level_name'));
         $this->_tpl->assign('OneManage', $this->_model->findOne());
         $this->_tpl->display(SMARTY_ADMIN . 'manage/update.tpl');
     }
 }
Exemplo n.º 5
0
 public function update()
 {
     if (isset($_POST['send'])) {
         if ($this->_model->update()) {
             $this->_redirect->succ(Tool::getPrevPage(), '导航修改成功');
         } else {
             $this->_redirect->error('导航修改失败');
         }
     }
     if (isset($_GET['id'])) {
         $this->_tpl->assign('AllPrice', Tool::setFormItem($this->_price->findAllNav(), 'value', 'value'));
         $this->_tpl->assign('selectedPrice', $this->_model->findUpdatePrice());
         $this->_tpl->assign('selectedBrand', $this->_model->findUpdateBrand());
         $this->_tpl->assign('AllBrand', Tool::setFormItem($this->_brand->findNavBrand(), 'id', 'name'));
         $this->_tpl->assign('OneNav', $this->_model->findOne());
         $this->_tpl->display(SMARTY_ADMIN . 'nav/update.tpl');
     }
 }
Exemplo n.º 6
0
 public function ajaxBrands($param)
 {
     $temp = $this->select(array('name', 'id'), array('where' => array("id IN ('{$param}')")));
     if (!empty($temp)) {
         return urldecode(json_encode(Tool::setFormItem($temp, 'id', 'name')));
     }
 }
Exemplo n.º 7
0
 public function runUpdate()
 {
     if (isset($_POST['send'])) {
         $this->model->update() ? $this->redirect->success('导航修改成功', $_POST['url']) : $this->redirect->error('导航修改失败');
     }
     if (isset($_GET['id'])) {
         $oneNav = $this->model->findOne();
         $allBrands = Tool::setFormItem($this->brand->getAllUpdateBrands(), 'id', 'name');
         $allBrands['1'] = '其他品牌';
         $this->tpl->assign('allPrice', $this->price->getAllNavPrice());
         $this->tpl->assign('allBrands', $allBrands);
         $this->tpl->assign('updateBrands', $this->model->getUpdateBrands());
         $this->tpl->assign('oneNav', $oneNav[0]);
         $this->tpl->assign('prev_url', PREV_URL);
         $this->tpl->display(ADMIN_STYLE . 'nav/update.tpl');
     }
 }
Exemplo n.º 8
0
 public function findAll()
 {
     $_allNav = parent::select(array('id', 'info', 'name', 'sort', 'brand'), array('where' => array("sid='{$this->_R['sid']}'"), 'limit' => $this->_limit, 'order' => 'sort ASC'));
     $this->_tables = array(DB_PREFIX . 'brand');
     $_allBrand = Tool::setFormItem(parent::select(array('id', 'name')), 'id', 'name');
     foreach ($_allNav as $_key => $_value) {
         if (Validate::isNullString($_value->brand)) {
             $_value->brand = '其他品牌';
         } else {
             $_tempArr = unserialize(htmlspecialchars_decode($_value->brand));
             $_value->brand = '';
             foreach ($_tempArr as $_k => $_v) {
                 $_value->brand .= $_allBrand[$_v] . ',';
             }
             $_value->brand = substr($_value->brand, 0, -1);
         }
     }
     return $_allNav;
 }
Exemplo n.º 9
0
 public function getDetailsGoods()
 {
     $where = array("id='{$this->R['goodsid']}'");
     if (!$this->check->checkOne($this, $where)) {
         $this->check->showError();
     }
     $goods = parent::select(array('id', 'nav', 'brand', 'attr', 'name', 'sn', 'price_sale', 'price_market', 'weight', 'price_cost', 'keyword', 'unit', 'unit', 'thumb', 'thumb_small', 'content', 'is_up', 'is_freight', 'inventory', 'service', 'warn_inventory'), array('where' => $where, 'limit' => '1'));
     $this->tables = array(DB_FREFIX . 'brand');
     $allBrand = Tool::setFormItem(parent::select(array('id', 'name')), 'id', 'name');
     if ($goods[0]->brand == 0 || $goods[0]->brand == 1) {
         $goods[0]->brand = '其他品牌';
     } else {
         $goods[0]->brand = $allBrand[$goods[0]->brand];
     }
     //关联到售后服务
     $this->tables = array(DB_FREFIX . 'service');
     $service = parent::select(array('name', 'id', 'content'), array('where' => array("id='{$goods[0]->service}'")));
     $goods[0]->service = htmlspecialchars_decode($service[0]->content);
     $goods[0]->content = htmlspecialchars_decode($goods[0]->content);
     $this->tables = array(DB_FREFIX . 'goods');
     //设置浏览记录
     if (isset($_COOKIE['history'][$goods[0]->id])) {
         setcookie('record[' . $_oneGoods[0]->id . ']', '', time() - 60 * 60 * 24 * 7);
     }
     setcookie('history[' . $goods[0]->id . ']', serialize(array('goodsid' => $goods[0]->id, 'navid' => $goods[0]->nav, 'name' => $goods[0]->name, 'thumb_small' => $goods[0]->thumb_small, 'price_sale' => $goods[0]->price_sale)), time() + 24 * 60 * 60 * 7);
     if (isset($_COOKIE['history'])) {
         $keys = array_keys($_COOKIE['history']);
         if (count($keys) > 5) {
             setcookie('history[' . $keys[0] . ']', '', time() - 7 * 24 * 60 * 60);
         }
     }
     return $goods;
 }
Exemplo n.º 10
0
 public function getAllService()
 {
     $all = parent::select(array('id', 'name'));
     return Tool::setFormItem($all, 'id', 'name');
 }
Exemplo n.º 11
0
 public function findGoodsAttr()
 {
     $_allAttr = parent::select(array('name', 'item'), array('like' => array('nav' => $this->_R['id'])));
     $_allAttr = Tool::setFormItem($_allAttr, 'name', 'item');
     $_goodsAttr = '';
     foreach ($_allAttr as $_key => $_value) {
         $_goodsAttr .= $_key . ':' . $_value . ';';
     }
     $_goodsAttr = substr($_goodsAttr, 0, -1);
     return $_goodsAttr;
 }