안녕하세요! 제가 특정 상품은 포인트 결제를 하지 못하도록 막으려고 하는데요
orderform.sub.php 에 있는
Copy
<div class="sod_frm_point">
<div>
<label for="od_temp_point">使用ポイント(<?php echo $point_unit; ?>点単位)</label>
<input type="hidden" name="max_temp_point" value="<?php echo $temp_point; ?>">
<input type="text" name="od_temp_point" value="0" id="od_temp_point" size="7"> 点
</div>
<div id="sod_frm_pt">
<span><strong>保有ポイント</strong><?php echo display_point($member['mb_point']); ?></span>
<span class="max_point_box"><strong>最大使用可能ポイント</strong><em id="use_max_point"><?php echo display_point($temp_point); ?></em></span>
</div>
</div>
이 부분에 특정 상품의 it_id 를 가지고 와서
Copy
<div class="sod_frm_point">
<?php $sql = " select it_id from {$g5['g5_shop_item_table']} ";
$result = sql_query($sql);
$row=sql_fetch_array($result);
if($row['it_id'] == 1625209813){ ?>
<div>
<label for="od_temp_point">使用ポイント(<?php echo $point_unit; ?>点単位)</label>
<input type="hidden" name="max_temp_point" value="<?php echo $temp_point; ?>">
<input type="text" name="od_temp_point" value="0" id="od_temp_point" size="7"> 点
</div>
<div id="sod_frm_pt">
<span><strong>保有ポイント</strong><?php echo display_point($member['mb_point']); ?></span>
<span class="max_point_box"><strong>最大使用可能ポイント</strong><em id="use_max_point"><?php echo display_point($temp_point); ?></em></span>
</div>
<?php } else { ?>
<div><strong>ポイントで購入できません</strong></div>
<?php } ?>
</div>
이런식으로 만들어보려고 했는데요.. 사실 sql 문이 굉장히 잘못 되어서 if문이 제대로 작동하지 않는거 같은데.. 이럴때는 어떻게 수정을 해야할까요? 어떤 테이블 에서 빼와야하는거죠? 그리고 제가 하고 있는 코드가 맞을까요?
답변 1개 / 댓글 3개
채택된 답변
+20 포인트
4년 전
shop/"orderform.sub.php"에서
// $s_cart_id 로 현재 장바구니 자료 쿼리
$sql = " select a.ct_id,
a.it_id,
a.it_name,
...
$point_flag=true;
for ($i=0; $row=sql_fetch_array($result); $i++)
{
if( $row['it_id']=='특정상품'])
$point_flag=false;
.....
}
포인트 결제 처리하는 부분에서
if( $point_flag) 이렇게 조건을 걸면 되지 않을까요?
답변에 대한 댓글 3개
커피볶는정콩
4년 전
4년 전
if( $row['a.it_id']== 1627370607){
==>
if( $row['it_id']== '1627370607'){
이렇게 하셔야 합니다.
==>
if( $row['it_id']== '1627370607'){
이렇게 하셔야 합니다.
커피볶는정콩
4년 전
감사합니다! 선생님 덕분에 그대로 해결을 했습니다 아이디를 찾아도 범위로 제어하는것이 어렵다는것을 깨닫고 선생님이 만들어주신 $point_flag는 사용하고 포인트로 제어를 하였습니다 0 포인트면 무료니 다 다운받을수있도록 하고 포인트 상품은 일정 포인트가 넘어가면 $point_flag를 false로 만들어서 살수 없겠끔 제어했더니 성공하였습니다 포인트로 제어를 했기 때문에 향후 유지보수를 해야겠지만 그래도 지금은 이렇게 개발을 해보려고 합니다 정말 감사합니다!!
답변을 작성하려면 로그인이 필요합니다.
[code]
//sql 밑
$point_flag=true;
for ($i=0; $row=sql_fetch_array($result); $i++)
{
if( $row['a.it_id']== 1627370607){
$point_flag=false;
}
[/code]
[code]
//하단
<div class="sod_frm_point">
<?php
if($point_flag){
?>
<div>
<label for="od_temp_point">使用ポイント(<?php echo $point_unit; ?>点単位)</label>
<input type="hidden" name="max_temp_point" value="<?php echo $temp_point; ?>">
<input type="text" name="od_temp_point" value="0" id="od_temp_point" size="7"> 点
</div>
<div id="sod_frm_pt">
<span><strong>保有ポイント</strong><?php echo display_point($member['mb_point']); ?></span>
<span class="max_point_box"><strong>最大使用可能ポイント</strong><em id="use_max_point"><?php echo display_point($temp_point); ?></em></span>
</div>
<?php }else {?>
<div>
<label for="od_temp_point">ポイントを使用することができません</label>
<input type="hidden" name="max_temp_point" value="<?php echo $temp_point; ?>">
<input type="hidden" name="od_temp_point" value="0" id="od_temp_point" size="7">
</div>
<div id="sod_frm_pt">
<span><strong>保有ポイント</strong><?php echo display_point($member['mb_point']); ?></span>
<span class="max_point_box"></span>
</div>
<?php }?>
</div>
[/code]
일단 선생님이 조언해주신 $row['it_id']는 위에 조인 쿼리에서 a.it_id으로 가지고 온것인지 it_id 하면 아예 뜨질 않더라고요 그래서 $row['a.it_id']으로 했지만 상품을 가져오지 못하는거 같습니다 왜 그런지 모르겠네요.... 계속 $point_flag=true; 이니까 true 였을때로 작동하는거 같습니다