답변 2개
DB필드에 ca_id4 ... ca_id5
이런식으로 추가하시고 db에 입력하신 후
shop.lib.php
아래와 같이 하신 후에
function set_category($ca_id, $level=1) {
if ($level == 2) {
$this->ca_id2 = $ca_id;
} else if ($level == 3) {
$this->ca_id3 = $ca_id;
} else if ($level == 4) {
$this->ca_id4 = $ca_id;
} else if ($level == 5) {
$this->ca_id5 = $ca_id;
} else if ($level == 6) {
$this->ca_id6 = $ca_id;
} else {
$this->ca_id = $ca_id;
}
}
run()함수에서
// add ca_id4,5,6
if ($this->ca_id || $this->ca_id2 || $this->ca_id3 || $this->ca_id4 || $this->ca_id5 || $this->ca_id6) {
$where_ca_id = array();
if ($this->ca_id) {
$where_ca_id[] = " ca_id like '{$this->ca_id}%' ";
}
if ($this->ca_id2) {
$where_ca_id[] = " ca_id2 like '{$this->ca_id2}%' ";
}
if ($this->ca_id3) {
$where_ca_id[] = " ca_id3 like '{$this->ca_id3}%' ";
}
if ($this->ca_id4) {
$where_ca_id[] = " ca_id4 like '{$this->ca_id4}%' ";
}
if ($this->ca_id5) {
$where_ca_id[] = " ca_id5 like '{$this->ca_id5}%' ";
}
if ($this->ca_id6) {
$where_ca_id[] = " ca_id6 like '{$this->ca_id6}%' ";
}
$where[] = " ( " . implode(" or ", $where_ca_id) . " ) ";
}
카테고리 출력하는 부분에는 아래와 같이 추가하시면 작동합니다.
$list->set_category('50', 1);
$list->set_category('50', 2);
$list->set_category('50', 3);
$list->set_category('50', 4);
$list->set_category('50', 5);
$list->set_category('50', 6);
구현해 놓은게 있는데 설명하려니 좀 복잡하네요 ㅠㅠ
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인