function goods_filter_of_type($p, &$object) { $cat = $object->system->loadModel('goods/productCat'); if (!$object->catMap) { $object->catMap = $cat->getMapTree(0, ''); } $return['cats'] = $object->catMap; $cat_id = $p['type_id']; if ($p = goods_getfilterProperty($cat_id, $object)) { $return['props'] = $p['props']; $brand = $object->system->loadModel('goods/brand'); $return['brands'] = $brand->getAll(); $return['cat_id'] = $p['cat_id']; $row = $object->db->selectrow('SELECT max(price) as max,min(price) as min FROM sdb_goods where type_id=' . intval($cat_id)); } else { $brand = $object->system->loadModel('goods/brand'); $return['brands'] = $brand->getAll(); $row = $object->db->selectrow('SELECT max(price) as max,min(price) as min FROM sdb_products '); } $modTag = $object->system->loadModel('system/tag'); $return['type_id'] = $cat_id; $return['tags'] = $modTag->tagList('goods'); $return['prices'] = steprange($row['min'], $row['max'], 5); return $return; }
function goods_get_filter($p, &$object) { /* $return['cats']=1; $return['brands']=2; $return['tags']=3; $return['prices']=4; return $return; */ $cat =& $object->system->loadModel('goods/productCat'); if (!$object->catMap) { $object->catMap = $cat->getMapTree(0, ''); } $return['cats'] = $object->catMap; if ($cat_id = $p['cat_id']) { $p = $cat->get($cat_id); $return['props'] = $p['props']; $brand = $object->system->loadModel('goods/brand'); $return['brands'] = $brand->getAll(); $return['cat_id'] = $p['cat_id']; $row = $object->db->selectrow('SELECT max(price) as max,min(price) as min FROM sdb_goods where cat_id=' . intval($cat_id)); } else { $brand = $object->system->loadModel('goods/brand'); $return['brands'] = $brand->getAll(); $row = $object->db->selectrow('SELECT max(price) as max,min(price) as min FROM sdb_products '); } $modTag = $object->system->loadModel('system/tag'); $return['tags'] = $modTag->tagList('goods'); $supplier = $this->system->loadModel('distribution/supplier'); $return['supplier'] = $supplier->getList('supplier_id,supplier_brief_name', '', 0, -1); if ($p['goods_id']) { $oGoods = $object->system->loadModel('trading/goods'); $return['keywords'] = $oGoods->getKeywords($p['goods_id']); } $return['prices'] = steprange($row['min'], $row['max'], 5); return $return; }
function getFilter($p) { $row = $this->db->selectrow('SELECT max(price) as max,min(price) as min FROM sdb_products '); $brand =& $this->system->loadModel('goods/brand'); $return['brands'] = $brand->getAll(); $modTag =& $this->system->loadModel('system/tag'); $return['tags'] = $modTag->tagList('goods'); $return['prices'] = steprange($row['min'], $row['max'], 5); return $return; }
function getFilter($p) { /* $return['cats']=1; $return['brands']=2; $return['tags']=3; $return['prices']=4; return $return; */ $cat =& $this->system->loadModel('goods/productCat'); if (!$this->catMap) { $this->catMap = $cat->get_cat_list(); } $return['cats'] = $this->catMap; if ($cat_id = $p['cat_id']) { $p = $cat->get($cat_id); $return['props'] = $p['props']; $brand = $this->system->loadModel('goods/brand'); $return['brands'] = $brand->getAll(); $return['cat_id'] = $p['cat_id']; $row = $this->db->selectrow('SELECT max(price) as max,min(price) as min FROM sdb_goods where cat_id=' . intval($cat_id)); } else { $brand = $this->system->loadModel('goods/brand'); $return['brands'] = $brand->getAll(); $row = $this->db->selectrow('SELECT max(price) as max,min(price) as min FROM sdb_products '); } $modTag = $this->system->loadModel('system/tag'); $return['tags'] = $modTag->tagList('goods'); if ($p['goods_id']) { $oGoods = $this->system->loadModel('trading/goods'); $return['keywords'] = $oGoods->getKeywords($p['goods_id']); } $return['prices'] = steprange($row['min'], $row['max'], 5); return $return; }
function reBuildCache($catid) { $row = $this->db->selectrow('select max(price) as max,min(price) as min,type_id,count(*) as goods_count from sdb_goods where cat_id=' . intval($catid) . ' group by goods_id'); $type = $this->db->selectrow('select props from sdb_goods_type where type_id=' . $row['type_id']); $rs = $this->db->query('select goods_count,finder from sdb_goods_cat where cat_id=' . intval($catid)); $sql = $this->db->getUpdateSQL($rs, array('goods_count' => $row['goods_count'], 'finder' => array('price' => steprange($row['min'], $rows['max'], 5), 'props' => unserialize($type['props'])))); return !$sql || $this->db->exec($sql); }
function getFilter() { $return = array(); $memberLv = $this->system->loadModel('member/level'); $return['member_lv'] = $memberLv->getList('member_lv_id,name'); $modTag = $this->system->loadModel('system/tag'); $return['tags'] = $modTag->tagList('member'); $row = $this->db->selectrow('SELECT max(advance) as advance,max(point) as point,max(regtime) as regtime FROM sdb_members'); $return['advance'] = steprange(0, $row['advance'], 5); $return['score'] = steprange(0, $row['point'], 5); $return['sex'] = array(array('key' => 1, 'val' => '男'), array('key' => 0, 'val' => '女')); //取后台高级搜索项 $memattr = $this->system->loadModel('member/memberattr'); $filter['attr_group'] = 'select'; $filter['attr_search'] = 'true'; $date = $memattr->getList('*', $filter, 0, -1); for ($i = 0; $i < count($date); $i++) { $return['custom'][$i]['name'] = $date[$i]['attr_name']; $return['custom'][$i]['attr_id'] = $date[$i]['attr_id']; $return['custom'][$i]['option'] = unserialize($date[$i]['attr_option']); } $return['regtime'] = steprange(0, $row['regtime'], 5); return $return; }