public function getAllNavPrice() { $all = parent::select(array('id', 'price_left', 'price_right'), array('order' => ' price_left ASC,price_right ASC ')); foreach ($all as $value) { $value->price = ''; $value->price .= $value->price_left . '-' . $value->price_right; } return tool::setFormItem($all, 'price', 'price'); }
public function getFrontBrand() { $where = array("id='{$this->R['navid']}'"); $nav = parent::select(array('id', 'sid', 'brand'), array('where' => $where)); $this->tables = array(DB_FREFIX . 'brand'); if ($nav[0]->sid == 0) { $allBrand = parent::select(array('id', 'name', 'type'), array('where' => array("type='{$nav[0]->id}'"))); } elseif (!empty($nav[0]->brand)) { $id = unserialize(htmlspecialchars_decode($nav[0]->brand)); $id = str_replace(',', "','", implode(',', $id)); $where = array("id IN ('{$id}')"); $allBrand = parent::select(array('name', 'id', 'type'), array('where' => $where)); } $allBrand = tool::setFormItem($allBrand, 'id', 'name'); $this->tables = array(DB_FREFIX . 'nav'); return $allBrand; }
public function findAll() { $allAttr = parent::select(array('id', 'name', 'item', 'nav')); $this->tables = array(DB_FREFIX . 'nav'); $allNav = tool::setFormItem(parent::select(array('id', 'name', 'sid'), array('where' => array('sid != 0'))), 'id', 'name'); if ($allAttr) { foreach ($allAttr as $key => $value) { if (!empty($value->nav)) { $nav = explode(',', $value->nav); $value->nav = ''; foreach ($nav as $val) { $value->nav .= $allNav[$val] . ','; } $value->nav = substr($value->nav, 0, -1); } else { $value->nav = '无'; } } } return $allAttr; }