Browse Source

오더뷰파일수정해야함

master
kmj1996 5 years ago
parent
commit
898d318f22
  1. 142
      wheeparam/application/controllers/Order.php
  2. 46
      wheeparam/application/controllers/order.php
  3. 31
      wheeparam/views/themes/desktop/order/form.php
  4. 23
      wheeparam/views/themes/desktop/order/index.php
  5. 31
      wheeparam/views/themes/desktop/order/view.php

142
wheeparam/application/controllers/Order.php

@ -0,0 +1,142 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/**
* Class Order
* ------------------------------------------------------------------------------
* 주문페이지
*/
class Order extends WB_Controller {
public function index()
{
$this->db->select('*');
$this->db->from('order');
$this->db->where('active','Y');
$this->db->order_by('idx DESC');
$result = $this->db->get()->result_array();
$this->data['list'] = $result;
// 레이아웃 & 뷰파일 설정
$this->theme = $this->site->get_layout();
$this->view = "/order/index";
$this->active = "/order/index";
}
public function view($value) {
$this->db->select('*');
$this->db->from('order');
$this->db->where('idx',$value);
$this->db->where('active','Y');
$this->db->order_by('idx DESC');
$result = $this->db->get()->row_array();
$this->data['list'] = $result;
if(! $result) {
alert("없는 페이지 입니다");
exit;
}
// 레이아웃 & 뷰파일 설정
$this->theme = $this->site->get_layout();
$this->view = "/order/view";
$this->active = "/order/view";
}
public function form($value = "")
{ //코드이그나이트에 들어있는것
$this->load->library('form_validation');
// 필수 입력되어야 하는 필드 설정 //input name명
$this->form_validation->set_rules('hu_name', '주문자이름', 'required|min_length[3]');
$this->form_validation->set_rules('ord_name', '상품명', 'required');
$this->form_validation->set_rules('pay', '가격', 'required');
$this->form_validation->set_rules('ord_num', '주문번호', 'required');
$this->form_validation->set_rules('ord_count', '개수', 'required|numeric');
$this->form_validation->set_rules('pos_money', '택배비', 'required');
if($this->form_validation->run() != FALSE )
{
//DB실제컬럼명 <-값을 넣어줌 //input name명
$od['order_hu_name'] = $this->input->post('hu_name', TRUE);
$od['order_name'] = $this->input->post('ord_name', TRUE);
$od['payment'] = $this->input->post('pay', TRUE);
$od['order_num'] = $this->input->post('ord_num', TRUE);
$od['count'] = $this->input->post('ord_count', TRUE);
$od['post_num'] = $this->input->post('pos_num', TRUE);
$od['post_money'] = $this->input->post('pos_money', TRUE);
$od['point'] = $this->input->post('point', TRUE);
if( ! $od['order_hu_name']) alert('주문자 이름은 필수입력입니다.');
if(empty($value)) {
$od['time'] = date('Y-m-d H:i:s');
$this->db->insert('order', $od);
}
else {
$this->db->where('idx', $value);
$this->db->update('order', $od);
}
alert('등록되었습니다.', base_url('order/index'));
}
else
{
$this->data['view'] = array();
// $value 가 비어있지 않을경우만 실행
if( ! empty($value) )
{
$this->db->select('*');
$this->db->from('order');
$this->db->where('idx',$value);
$this->db->where('active','Y');
$this->db->order_by('idx DESC');
$result = $this->db->get()->row_array();
$this->data['view'] = $result;
if(! $this->data['view'])
{
alert("없는 페이지 입니다");
exit;
}
}
// 레이아웃 & 뷰파일 설정
$this->theme = $this->site->get_layout();
$this->view = "/order/form";
$this->active = "/order/form";
}
}
public function remove($value)
{
$data['active'] = 'N';
$this->db->where('idx', $value);
//$this->db->set('active','N');
if( $this->db->update('order',$data)) {
alert('삭제되았습니다..', base_url('order/index'));
}
else {
alert('삭제에 실패했스비다..', base_url('order/index'));
}
}
}

46
wheeparam/application/controllers/order.php

@ -1,46 +0,0 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/**
* Class Memo
* ------------------------------------------------------------------------------
* 주문페이지
*/
class order extends WB_Controller {
public function index()
{
$this->db->select('*');
$this->db->from('order');
$this->db->order_by('idx DESC');
$result = $this->db->get()->result_array();
$this->data['list'] = $result;
// 레이아웃 & 뷰파일 설정
$this->theme = $this->site->get_layout();
$this->view = "/order/index";
$this->active = "/order/index";
}
public function view($getValue="") {
$this->db->select('*');
$this->db->from('order');
$this->db->where('idx', $getValue);
$this->db->order_by('idx DESC');
$result = $this->db->get()->row_array();
if(! $result) {
alert("없는 페이지 입니다");
exit;
}
// 레이아웃 & 뷰파일 설정
$this->theme = $this->site->get_layout();
$this->view = "/order/index";
$this->active = "/order/index";
}
}

31
wheeparam/views/themes/desktop/order/form.php

@ -0,0 +1,31 @@
<?php echo validation_errors()?>
<?=form_open_multipart()?>
<h5>주문자명</h5>
<input name="hu_name" value="<?=element('order_hu_name', $view)?>"><br>
<h5>상품명</h5>
<input name="ord_name" value="<?=element('ord_name', $view)?>">
<h5>가격</h5>
<input name="pay" value="<?=element('order_pay', $view)?>">
<h5>주문번호</h5>
<input name="ord_num" value="<?=element('ord_num', $view)?>">
<h5>개수</h5>
<input name="ord_count" value="<?=element('order_hu_name', $view)?>">
<h5>운송장번호</h5>
<input name="pos_num" value="<?=element('pos_num', $view)?>">
<h5>택배비</h5>
<input name="pos_money" value="<?=element('pos_money', $view)?>">
<h5>포인트</h5>
<input name="point" value="<?=element('point', $view)?>">
<h5></h5>
<button type="submit">등록하기</button>
<?=form_close()?>
<!--
<form method="post" accept-charset="UTF-8" action="<?=base_url('order/form')?>">
</form>-->

23
wheeparam/views/themes/desktop/order/index.php

@ -1,22 +1,31 @@
<a href="<?=base_url('order/form')?>">신규등록하기</a>
<table class="table"> <table class="table">
<thead> <thead>
<th>배송확정일</th>
<th>주문번호</th>
<th>주문자명</th>
<th>상품명</th>
<th>수량</th>
<th>배송</th>
<tr>
<th>배송확정일</th>
<th>주문번호</th>
<th>주문자명</th>
<th>상품명</th>
<th>수량</th>
<th>배송</th>
<th>수정</th>
<th>삭제</th>
</tr>
</thead> </thead>
<tbody> <tbody>
<?php foreach ($list as $od):?> <?php foreach ($list as $od):?>
<tr> <tr>
<td><?=date('Y-m-d', strtotime($od['time']))?></td> <td><?=date('Y-m-d', strtotime($od['time']))?></td>
<td><a href="<?=base_url('order/view/').$od['idx']?>"><?php echo $od['order_num']?></a></td> <td><a href="<?=base_url('order/view/').$od['idx']?>"><?php echo $od['order_num']?></a></td>
<td><?=$od['order_hu_name']?></td> <td><?=$od['order_hu_name']?></td>
<td><?=$od['order_name']?></td> <td><?=$od['order_name']?></td>
<td><?=$od['count']?></td> <td><?=$od['count']?></td>
<td><?=$od['status']?></td> <td><?=$od['status']?></td>
<td><a href="<?=base_url('order/form/').$od['idx']?>">수정</a></td>
<td><a href="<?=base_url('order/remove/').$od['idx']?>">삭제</a></td>
</tr> </tr>
<?php endforeach;?> <?php endforeach;?>

31
wheeparam/views/themes/desktop/order/view.php

@ -1 +1,30 @@
<?php
<a href="<?=base_url('order/modify')?>">수정하기</a>
<table class="table">
<tbody>
<tr><h4>결제상세정보 확인</h4></tr>
<tr>
<td>신용카드 결제금액 &nbsp<?php echo $list['payment']?>원</td>
</tr>
<tr>
<td>카드 승인일시 <?php echo $list['time']?></td>
</tr>
<tr>
<td>주문 금액 할인 <?php echo $list['payment_discount']?>원</td>
</tr>
<tr>
<td>결제취소/환불액 <?php echo $list['refund']?>원</td>
</tr>
<tr>
<td>배송비 <?php echo $list['post_money']?>원</td>
</tr>
<tr>
<td>추가 배송비 <?php echo $list['post_add_money']?>원</td>
</tr>
</tbody>
</table>
Loading…
Cancel
Save