function change_order() { $this->isset_cookie(); if (!empty($_POST)) { $id = $_POST['id']; $valbase = $_POST['val']; $val = addslashes(str_replace(' ', '', $valbase)); $data['id'] = $id; if (!empty($val)) { $sql = "update " . $this->table_name('goods') . " set order_by='" . $val . "' where goods_id='{$id}'"; $a = mysql_query($sql, $this->conn); } else { $sql = "select order_by from " . $this->table_name('goods') . " where goods_id='{$id}'"; $product = getFetchRow($sql, $this->conn); $val = $product['order_by']; } if ($a) { $data['say'] = "ok"; $data['val'] = $val; } else { $data['say'] = "error"; } die(json_encode($data)); } else { $data['say'] = "error"; die(json_encode($data)); } }
function goods() { $base = $this->base(); $id = addslashes($_GET['id']); $sql = "select g.*,i.goods_name,i.goods_detail from " . $this->table_name("goods") . " as g " . " left join " . $this->table_name("goods_i8n") . " as i on i.goods_id=g.goods_id " . " where g.goods_id in (" . $id . ") "; $goods = getFetchRow($sql, $this->conn); if (!empty($goods)) { $goods['title'] = explode('<br />', $goods['goods_name']); $goods['detail_arr'] = explode('":;"', $goods['goods_detail']); $pro = $goods; } $cat_id = $goods['cat_id']; $sql = "select c.*,i.cat_name from " . $this->table_name("category") . " as c " . " left join " . $this->table_name("category_i8n") . " as i on i.cat_id=c.cat_id " . " where c.cat_id in (" . $cat_id . ") "; $cat = getFetchRow($sql, $this->conn); $sub_type = $cat['sub_type']; $title = $cat['cat_name']; $sql = "select * from " . $this->table_name("img") . " where type_id='" . $id . "' and point='1' and type='P'"; /* order by order_by asc*/ $bg = getFetchRow($sql, $this->conn); $sql = "SELECT g.goods_id FROM " . $this->table_name('goods') . " as g " . " left join " . $this->table_name("img") . " as img on img.type_id=g.goods_id " . " WHERE g.cat_id=" . $cat_id . " and img.type='P' and img.point='0' and g.is_show='1' AND ((g.goods_id>" . $id . " and g.order_by='" . $goods['order_by'] . "')or g.order_by<'" . $goods['order_by'] . "') order by g.order_by desc,g.goods_id asc LIMIT 1"; $prev = getFetchRow($sql, $this->conn); $sql = "SELECT g.goods_id FROM " . $this->table_name('goods') . " as g " . " left join " . $this->table_name("img") . " as img on img.type_id=g.goods_id " . " WHERE g.cat_id=" . $cat_id . " and img.type='P' and img.point='0' and g.is_show='1' AND ((g.goods_id<" . $id . " and g.order_by='" . $goods['order_by'] . "')or g.order_by>'" . $goods['order_by'] . "') order by g.order_by asc,g.goods_id desc LIMIT 1"; $next = getFetchRow($sql, $this->conn); $tmpPath = $this->sysVar['template'] . 'html/goods.xxx'; include $tmpPath; }
function show_config_detail() { $this->isset_cookie(); if (isset($_GET['id'])) { $act = 'edit'; $id = $_GET['id']; $sql = "select * from " . $this->table_name('config') . " where con_id='{$id}'"; $product = getFetchAll($sql, $this->conn); $sql = "select * from " . $this->table_name('img') . " where type_id='{$id}' and type='CON'"; $img = getFetchRow($sql, $this->conn); //pr($product); $sql = "select * from " . $this->table_name('goods_i8n') . " where goods_id='{$id}' order by i8n asc"; $products = getFetchAll($sql, $this->conn); } else { $act = 'add'; } $tmpPath = $this->sysVar['template'] . 'admin/show_config_detail.php'; include $tmpPath; }
function set_top() { $this->isset_cookie(); if (!empty($_POST)) { $id = $_POST['id']; $data['id'] = $id; $sql = "select type_id from " . $this->table_name('img') . " where img_id='{$id}'"; //pr($sql); $product = getFetchRow($sql, $this->conn); $sql = "update " . $this->table_name('img') . " set point='0' where type_id='" . $product['type_id'] . "' and type='M'"; $a = mysql_query($sql, $this->conn); //pr($sql); $sql = "update " . $this->table_name('img') . " set point='1' where img_id='{$id}'"; //pr($sql); $a = mysql_query($sql, $this->conn); if ($a) { $data['say'] = "ok"; } else { $data['say'] = "error"; } die(json_encode($data)); } else { $data['say'] = "error"; die(json_encode($data)); } }