#325 선호도->평점 ... 10점->5점 ... 검색에 평점 높은순 정렬 추가

This commit is contained in:
gnuboard
2013-11-14 11:28:32 +09:00
parent daf1606cee
commit ecaf18964d
12 changed files with 86 additions and 45 deletions

View File

@ -824,12 +824,9 @@ function display_category($no, $list_mod, $list_row, $img_width, $img_height, $c
// 별
function get_star($score)
{
if ($score > 8) $star = 5;
else if ($score > 6) $star = 4;
else if ($score > 4) $star = 3;
else if ($score > 2) $star = 2;
else if ($score > 0) $star = 1;
else $star = 5;
$star = round($score);
if ($star > 5) $star = 5;
else if ($star < 0) $star = 0;
return $star;
}
@ -1805,6 +1802,16 @@ function update_use_cnt($it_id)
}
// 사용후기의 선호도(별) 평균을 상품테이블에 저장합니다.
function update_use_avg($it_id)
{
global $g5;
$row = sql_fetch(" select count(*) as cnt, sum(is_score) as total from {$g5['g5_shop_item_use_table']} where it_id = '{$it_id}' ");
$average = ($row['total'] && $row['cnt']) ? $row['total'] / $row['cnt'] : 0;
return sql_query(" update {$g5['g5_shop_item_table']} set it_use_avg = '$average' where it_id = '{$it_id}' ");
}
//------------------------------------------------------------------------------
// 주문포인트를 적립한다.
// 설정일이 지난 포인트 부여되지 않은 배송완료된 장바구니 자료에 포인트 부여