shoppingmallv2 init...
This commit is contained in:
parent
ed372396b6
commit
3e1bcb29c5
@ -108,8 +108,8 @@ class EcommerceController extends Controller
|
||||
"%s\n 상품명:%s\n 상품갯수:%s개, 구매금액:%s원\n 장바구니에 담았습니다.",
|
||||
$this->_viewDatas['title'],
|
||||
$entity->getTitle(),
|
||||
$entity->getQuantity(),
|
||||
number_format($entity->getPrice())
|
||||
$entity->quantity,
|
||||
number_format($entity->price)
|
||||
);
|
||||
return redirect()->to($this->_session->getFlashdata(SESSION_NAMES['RETURN_URL']));
|
||||
} catch (\Exception $e) {
|
||||
@ -143,9 +143,9 @@ class EcommerceController extends Controller
|
||||
throw new \Exception(__FUNCTION__ . " 오류 발생.\n" . var_export($this->getOrderModel()->errors(), true));
|
||||
}
|
||||
//상품정보 가져오기
|
||||
$product = $this->getProductModel()->getEntity([$this->getProductModel()->getPrimaryKey() => $entity->getProduct_uid()]);
|
||||
$product = $this->getProductModel()->getEntity([$this->getProductModel()->getPrimaryKey() => $entity->product_uid]);
|
||||
//상품반환
|
||||
$this->getProductModel()->cancelCart($product, $entity->getQuantity());
|
||||
$this->getProductModel()->cancelCart($product, $entity->quantity);
|
||||
//주문정보 세션에서 빼기
|
||||
$order_uids = $this->_session->get(SESSION_NAMES['CART']) ?: array();
|
||||
$temps = array();
|
||||
@ -157,7 +157,7 @@ class EcommerceController extends Controller
|
||||
$this->_session->set(SESSION_NAMES['CART'], $temps);
|
||||
//Transaction Commit
|
||||
$this->getOrderModel()->transComplete();
|
||||
$msg = "{$this->_viewDatas['title']}에서 {$entity->getTitle()} {$entity->getQuantity()}개의 주문을 취소하였습니다.";
|
||||
$msg = "{$this->_viewDatas['title']}에서 {$entity->getTitle()} {$entity->quantity}개의 주문을 취소하였습니다.";
|
||||
return redirect()->to($this->_session->getFlashdata(SESSION_NAMES['RETURN_URL']));
|
||||
} catch (\Exception $e) {
|
||||
//Transaction Rollback
|
||||
|
||||
@ -60,7 +60,7 @@ class BoardController extends FrontController
|
||||
protected function update_form_process($entity)
|
||||
{
|
||||
//본인이 작성한글인지 최종확인용 정상접속이 아닌 위회해서 수정을 시도방지용
|
||||
if (!$this->_viewDatas[SESSION_NAMES['ISLOGIN']] || $entity->getUser_Uid() == $this->_viewDatas['auth'][AUTH_FIELDS['ID']]) {
|
||||
if (!$this->_viewDatas[SESSION_NAMES['ISLOGIN']] || $entity->user_uid == $this->_viewDatas['auth'][AUTH_FIELDS['ID']]) {
|
||||
throw new \Exception("작성자 본인글인지 여부가 확인되지 않습니다.");
|
||||
}
|
||||
return parent::update_form_process($entity);
|
||||
@ -68,7 +68,7 @@ class BoardController extends FrontController
|
||||
protected function update_process($entity)
|
||||
{
|
||||
//본인이 작성한글인지 최종확인용 정상접속이 아닌 위회해서 수정을 시도방지용
|
||||
if (!$this->_viewDatas[SESSION_NAMES['ISLOGIN']] || $entity->getUser_Uid() == $this->_viewDatas['auth'][AUTH_FIELDS['ID']]) {
|
||||
if (!$this->_viewDatas[SESSION_NAMES['ISLOGIN']] || $entity->user_uid == $this->_viewDatas['auth'][AUTH_FIELDS['ID']]) {
|
||||
throw new \Exception("작성자 본인글인지 여부가 확인되지 않습니다.");
|
||||
}
|
||||
return parent::update_process($entity);
|
||||
@ -84,7 +84,7 @@ class BoardController extends FrontController
|
||||
protected function delete_process($entity)
|
||||
{
|
||||
//본인이 작성한글인지 최종확인용 정상접속이 아닌 위회해서 삭제 시도 방지용
|
||||
if (!$this->_viewDatas[SESSION_NAMES['ISLOGIN']] || $entity->getUser_Uid() == $this->_viewDatas['auth'][AUTH_FIELDS['ID']]) {
|
||||
if (!$this->_viewDatas[SESSION_NAMES['ISLOGIN']] || $entity->user_uid == $this->_viewDatas['auth'][AUTH_FIELDS['ID']]) {
|
||||
throw new \Exception("작성자 본인글인지 여부가 확인되지 않습니다.");
|
||||
}
|
||||
return parent::delete_process($entity);
|
||||
|
||||
@ -76,13 +76,6 @@ function getFieldView_OrderHelper($field, $entity, array $viewDatas)
|
||||
["target" => "_self"]
|
||||
);
|
||||
break;
|
||||
case 'board_file':
|
||||
case 'upload_file':
|
||||
return $value == DEFAULTS['EMPTY'] ? DEFAULTS['EMPTY'] : anchor(current_url() . "/download/{$field}/{$entity->getPrimaryKey()}", ICONS['IMAGE_FILE'] . explode(DEFAULTS['DELIMITER_FILE'], $value)[0], ["target" => "_self"]);
|
||||
break;
|
||||
case 'view_cnt':
|
||||
return number_format(!$value ? 0 : $value);
|
||||
break;
|
||||
case 'content':
|
||||
return html_entity_decode($value);
|
||||
break;
|
||||
|
||||
@ -79,13 +79,6 @@ function getFieldView_UserSNSHelper($field, $entity, array $viewDatas)
|
||||
["target" => "_self"]
|
||||
);
|
||||
break;
|
||||
case 'board_file':
|
||||
case 'upload_file':
|
||||
return $value == DEFAULTS['EMPTY'] ? DEFAULTS['EMPTY'] : anchor(current_url() . "/download/{$field}/{$entity->getPrimaryKey()}", ICONS['IMAGE_FILE'] . explode(DEFAULTS['DELIMITER_FILE'], $value)[0], ["target" => "_self"]);
|
||||
break;
|
||||
case 'view_cnt':
|
||||
return number_format(!$value ? 0 : $value);
|
||||
break;
|
||||
case 'content':
|
||||
return html_entity_decode($value);
|
||||
break;
|
||||
|
||||
@ -59,7 +59,7 @@ abstract class Adapter
|
||||
$auths[$field] = $entity->getTitle();
|
||||
break;
|
||||
case 'role':
|
||||
$auths[$field] = $entity->getRole();
|
||||
$auths[$field] = $entity->$field;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -112,7 +112,7 @@ class ProductModel extends BaseModel
|
||||
//장바구니에 넣기
|
||||
final public function addCart(ProductEntity $entity, int $quantity): ProductEntity
|
||||
{
|
||||
if ($entity->getStock() == $quantity) {
|
||||
if ($entity->stock == $quantity) {
|
||||
$entity->status = self::STATUS_OUTOFSTOCK;
|
||||
}
|
||||
$entity->stock -= $quantity;
|
||||
@ -121,7 +121,7 @@ class ProductModel extends BaseModel
|
||||
//장바구니에 빼기
|
||||
public function cancelCart(ProductEntity $entity, int $quantity)
|
||||
{
|
||||
if ($entity->getStatus() == self::STATUS_OUTOFSTOCK) {
|
||||
if ($entity->status == self::STATUS_OUTOFSTOCK) {
|
||||
$entity->status = DEFAULTS['STATUS'];
|
||||
}
|
||||
$entity->stock += $quantity;
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
<tbody>
|
||||
<?php $cnt = 0 ?>
|
||||
<?php foreach ($viewDatas['entitys'] as $entity) : ?>
|
||||
<tr id="<?= $entity->getPrimaryKey() ?>" <?= $entity->getStatus() != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?> onClick="indexRowCheckBoxToggle(this)">
|
||||
<tr id="<?= $entity->getPrimaryKey() ?>" <?= $entity->status != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?> onClick="indexRowCheckBoxToggle(this)">
|
||||
<td>
|
||||
<?= form_checkbox(["id" => "checkbox_uid_{$entity->getPrimaryKey()}", "name" => "batchjob_uids[]", "value" => $entity->getPrimaryKey(), "class" => "batchjobuids_checkboxs"]); ?>
|
||||
<?= anchor(current_url() . '/update/' . $entity->getPrimaryKey(), $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $cnt), ["target" => "_self"]) ?>
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
<tbody>
|
||||
<?php $cnt = 0 ?>
|
||||
<?php foreach ($viewDatas['entitys'] as $entity) : ?>
|
||||
<tr id="<?= $entity->getPrimaryKey() ?>" <?= $entity->getStatus() != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?> onClick="indexRowCheckBoxToggle(this)">
|
||||
<tr id="<?= $entity->getPrimaryKey() ?>" <?= $entity->status != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?> onClick="indexRowCheckBoxToggle(this)">
|
||||
<td>
|
||||
<?= form_checkbox(["id" => "checkbox_uid_{$entity->getPrimaryKey()}", "name" => "batchjob_uids[]", "value" => $entity->getPrimaryKey(), "class" => "batchjobuids_checkboxs"]); ?>
|
||||
<?= anchor(current_url() . '/update/' . $entity->getPrimaryKey(), $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $cnt), ["target" => "_self"]) ?>
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
<tbody>
|
||||
<?php $cnt = 0 ?>
|
||||
<?php foreach ($viewDatas['entitys'] as $entity) : ?>
|
||||
<tr id="<?= $entity->getPrimaryKey() ?>" <?= $entity->getStatus() != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?> onClick="indexRowCheckBoxToggle(this)">
|
||||
<tr id="<?= $entity->getPrimaryKey() ?>" <?= $entity->status != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?> onClick="indexRowCheckBoxToggle(this)">
|
||||
<td>
|
||||
<?= form_checkbox(["id" => "checkbox_uid_{$entity->getPrimaryKey()}", "name" => "batchjob_uids[]", "value" => $entity->getPrimaryKey(), "class" => "batchjobuids_checkboxs"]); ?>
|
||||
<?= anchor(current_url() . '/update/' . $entity->getPrimaryKey(), $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $cnt), ["target" => "_self"]) ?>
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
<tbody>
|
||||
<?php $cnt = 0 ?>
|
||||
<?php foreach ($viewDatas['entitys'] as $entity) : ?>
|
||||
<tr id="<?= $entity->getPrimaryKey() ?>" <?= $entity->getStatus() != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?> onClick="indexRowCheckBoxToggle(this)">
|
||||
<tr id="<?= $entity->getPrimaryKey() ?>" <?= $entity->status != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?> onClick="indexRowCheckBoxToggle(this)">
|
||||
<td>
|
||||
<?= form_checkbox(["id" => "checkbox_uid_{$entity->getPrimaryKey()}", "name" => "batchjob_uids[]", "value" => $entity->getPrimaryKey(), "class" => "batchjobuids_checkboxs"]); ?>
|
||||
<?= anchor(current_url() . '/update/' . $entity->getPrimaryKey(), $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $cnt), ["target" => "_self"]) ?>
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
<tbody>
|
||||
<?php $cnt = 0 ?>
|
||||
<?php foreach ($viewDatas['entitys'] as $entity) : ?>
|
||||
<tr id="<?= $entity->getPrimaryKey() ?>" <?= $entity->getStatus() != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?> onClick="indexRowCheckBoxToggle(this)">
|
||||
<tr id="<?= $entity->getPrimaryKey() ?>" <?= $entity->status != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?> onClick="indexRowCheckBoxToggle(this)">
|
||||
<td>
|
||||
<?= form_checkbox(["id" => "checkbox_uid_{$entity->getPrimaryKey()}", "name" => "batchjob_uids[]", "value" => $entity->getPrimaryKey(), "class" => "batchjobuids_checkboxs"]); ?>
|
||||
<?= anchor(current_url() . '/update/' . $entity->getPrimaryKey(), $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $cnt), ["target" => "_self"]) ?>
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
<tbody>
|
||||
<?php $cnt = 0 ?>
|
||||
<?php foreach ($viewDatas['entitys'] as $entity) : ?>
|
||||
<tr id="<?= $entity->getPrimaryKey() ?>" <?= $entity->getStatus() != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?> onClick="indexRowCheckBoxToggle(this)">
|
||||
<tr id="<?= $entity->getPrimaryKey() ?>" <?= $entity->status != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?> onClick="indexRowCheckBoxToggle(this)">
|
||||
<td>
|
||||
<?= form_checkbox(["id" => "checkbox_uid_{$entity->getPrimaryKey()}", "name" => "batchjob_uids[]", "value" => $entity->getPrimaryKey(), "class" => "batchjobuids_checkboxs"]); ?>
|
||||
<?= anchor(current_url() . '/update/' . $entity->getPrimaryKey(), $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $cnt), ["target" => "_self"]) ?>
|
||||
|
||||
@ -16,10 +16,10 @@
|
||||
<tbody>
|
||||
<?php $cnt = 0 ?>
|
||||
<?php foreach ($viewDatas['entitys'] as $entity) : ?>
|
||||
<tr id="<?= $entity->getPrimaryKey() ?>" <?= $entity->getStatus() != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?> onClick="indexRowCheckBoxToggle(this)">
|
||||
<tr id="<?= $entity->getPrimaryKey() ?>" <?= $entity->status != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?> onClick="indexRowCheckBoxToggle(this)">
|
||||
<td>
|
||||
<!-- 사용자가 자신의 작성한것인지 확인되면 update 가능-->
|
||||
<?php if ($viewDatas[SESSION_NAMES['ISLOGIN']] && $entity->getUser_Uid() == $viewDatas['auth'][AUTH_FIELDS['ID']]) : ?>
|
||||
<?php if ($viewDatas[SESSION_NAMES['ISLOGIN']] && $entity->user_uid == $viewDatas['auth'][AUTH_FIELDS['ID']]) : ?>
|
||||
<?= anchor(current_url() . '/update/' . $entity->getPrimaryKey(), $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $cnt), ["target" => "_self"]) ?>
|
||||
<?php else : ?>
|
||||
<?= $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $cnt) ?>
|
||||
@ -30,7 +30,7 @@
|
||||
<?php endforeach ?>
|
||||
<td>
|
||||
<!-- 사용자가 자신의 작성한것인지 확인되면 delete 가능-->
|
||||
<?php if ($viewDatas[SESSION_NAMES['ISLOGIN']] && $entity->getUser_Uid() == $viewDatas['auth'][AUTH_FIELDS['ID']]) : ?>
|
||||
<?php if ($viewDatas[SESSION_NAMES['ISLOGIN']] && $entity->user_uid == $viewDatas['auth'][AUTH_FIELDS['ID']]) : ?>
|
||||
<?= anchor(current_url() . '/delete/' . $entity->getPrimaryKey(), ICONS['DELETE'], ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self"]) ?>
|
||||
<?php endif ?>
|
||||
</td>
|
||||
|
||||
@ -27,7 +27,7 @@
|
||||
<tbody>
|
||||
<?php $cnt = 0 ?>
|
||||
<?php foreach ($viewDatas['entitys'] as $entity) : ?>
|
||||
<tr id="<?= $entity->getPrimaryKey() ?>" <?= $entity->getStatus() != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?> onClick="indexRowCheckBoxToggle(this)">
|
||||
<tr id="<?= $entity->getPrimaryKey() ?>" <?= $entity->status != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?> onClick="indexRowCheckBoxToggle(this)">
|
||||
<td>
|
||||
<?= $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $cnt) ?>
|
||||
</td>
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
<table id="block" class="table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td width="14%" rowspan="3"><?= $entity->getPhotoFileName('middle') ?></td>
|
||||
<td width="14%" rowspan="3"><?= $entity->getFileImage('middle') ?></td>
|
||||
<td width="*">
|
||||
<?= getFieldIndex_Row_ProductHelper('name', $entity, $viewDatas) ?>
|
||||
<td>
|
||||
|
||||
@ -28,7 +28,7 @@
|
||||
<tbody>
|
||||
<?php $cnt = 0 ?>
|
||||
<?php foreach ($viewDatas['entitys'] as $entity) : ?>
|
||||
<tr id="<?= $entity->getPrimaryKey() ?>" <?= $entity->getStatus() != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?> onClick="indexRowCheckBoxToggle(this)">
|
||||
<tr id="<?= $entity->getPrimaryKey() ?>" <?= $entity->status != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?> onClick="indexRowCheckBoxToggle(this)">
|
||||
<td>
|
||||
<?= $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $cnt) ?>
|
||||
</td>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user