채택완료

전체적용하기

전체 할인율을 적용하려고 합니다.

그래서 

Copy
if ($_POST['act_button'] == "할인율적용") {    auth_check($auth[$sub_menu], 'w');$totals = $_POST['total_count'] + 1;    for ($i=0; $i<$totals; $i++) {        // 실제 번호를 넘김        $k =$i;		if($_POST['it_10'] ){			$discount_price = $_POST['it_cust_price'][$k];			$count_price2 =  $_POST['it_10'] * 0.01;			$count_price3 =  $discount_price * $count_price2;			$total_discount_price = $discount_price - $count_price3;		}else{			$total_discount_price = $_POST['it_price'][$k];		}        $sql = "update {$g5['g5_shop_item_table']}                   set                        it_price       = '{$total_discount_price}',                       it_update_time = '".G5_TIME_YMDHIS."',		    it_5       = '{$_POST['it_10']}'                 where it_id   = '{$_POST['it_id'][$k]}' ";        sql_query($sql);    }}

이렇게 했는데 할인율이 적용은 되는데 

전~~제품이 적용되는게 아니고 

제가 보고 있는 페이지 

예를 들어 1페이지에만 적용이 됩니다..

전~~~체 제품에 적용이 되게 하려면 어떻게 해야되나요~~?

|

답변 1개 / 댓글 1개

채택된 답변
+20 포인트

item table 에서 해당 정보 불러온 다음 할인가 계산해서 업데이트 해보세요~

$sql = "select it_id, it_cust_price, it_10, it_price from {$g5['g5_shop_item_talbe']}";
$result = sql_query($sql);

while($row = sql_fetch_array($result) ){

$it_10 = $row['it_10'];
if($it_10 !== '') {

    // 할인가 계산
} else {
    $total_discount_price = $row['it_price'];
}

$sql2 = "update {$g5['g5_shop_item_table']} set it_pri~~ ";

sql_query($sql2);


}

답변에 대한 댓글 1개

오! 감사합니다 ! ㅎㅎㅎ됏어요 ㅎㅎ

답변을 작성하려면 로그인이 필요합니다.