shoppingmallv2 init...
This commit is contained in:
parent
bde957f3a8
commit
bea8009722
@ -98,7 +98,7 @@ class EcommerceController extends Controller
|
|||||||
//주문추가
|
//주문추가
|
||||||
$entity = $this->getOrderModel()->addCart($this->_viewDatas['fieldDatas']);
|
$entity = $this->getOrderModel()->addCart($this->_viewDatas['fieldDatas']);
|
||||||
//상품재고감소
|
//상품재고감소
|
||||||
$this->getProductModel()->addCart($product, $this->_viewDatas['fieldDatas']['quantity']);
|
$product = $this->getProductModel()->addCart($product, $this->_viewDatas['fieldDatas']['quantity']);
|
||||||
//주문정보 세션에 넣기
|
//주문정보 세션에 넣기
|
||||||
$order_uids = $this->_session->get(SESSION_NAMES['CART']) ?: array();
|
$order_uids = $this->_session->get(SESSION_NAMES['CART']) ?: array();
|
||||||
$this->_session->set(SESSION_NAMES['CART'], [...$order_uids, $entity->getPrimaryKey()]);
|
$this->_session->set(SESSION_NAMES['CART'], [...$order_uids, $entity->getPrimaryKey()]);
|
||||||
@ -145,7 +145,7 @@ class EcommerceController extends Controller
|
|||||||
//상품정보 가져오기
|
//상품정보 가져오기
|
||||||
$product = $this->getProductModel()->getEntity([$this->getProductModel()->getPrimaryKey() => $entity->product_uid]);
|
$product = $this->getProductModel()->getEntity([$this->getProductModel()->getPrimaryKey() => $entity->product_uid]);
|
||||||
//상품반환
|
//상품반환
|
||||||
$this->getProductModel()->cancelCart($product, $entity->quantity);
|
$product = $this->getProductModel()->cancelCart($product, $entity->quantity);
|
||||||
//주문정보 세션에서 빼기
|
//주문정보 세션에서 빼기
|
||||||
$order_uids = $this->_session->get(SESSION_NAMES['CART']) ?: array();
|
$order_uids = $this->_session->get(SESSION_NAMES['CART']) ?: array();
|
||||||
$temps = array();
|
$temps = array();
|
||||||
|
|||||||
@ -95,7 +95,7 @@ class BoardController extends FrontController
|
|||||||
//권한체크
|
//권한체크
|
||||||
$this->isRole('view', $entity);
|
$this->isRole('view', $entity);
|
||||||
//조회수 올리기
|
//조회수 올리기
|
||||||
$this->_model->addViewCount($entity);
|
$entity = $this->_model->addViewCount($entity);
|
||||||
return parent::view_process($entity);
|
return parent::view_process($entity);
|
||||||
}
|
}
|
||||||
//Index관련
|
//Index관련
|
||||||
|
|||||||
@ -45,7 +45,7 @@ class ProductController extends FrontController
|
|||||||
//권한체크
|
//권한체크
|
||||||
$this->isRole('view', $entity);
|
$this->isRole('view', $entity);
|
||||||
//조회수 올리기
|
//조회수 올리기
|
||||||
$this->_model->addViewCount($entity);
|
$entity = $this->_model->addViewCount($entity);
|
||||||
return parent::view_process($entity);
|
return parent::view_process($entity);
|
||||||
}
|
}
|
||||||
//Index관련
|
//Index관련
|
||||||
|
|||||||
@ -109,7 +109,7 @@ class ProductModel extends BaseModel
|
|||||||
return $this->save_process($entity);
|
return $this->save_process($entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
//장바구니에 넣기
|
//장바구니에 넣기(재고수량빼기)
|
||||||
final public function addCart(ProductEntity $entity, int $quantity): ProductEntity
|
final public function addCart(ProductEntity $entity, int $quantity): ProductEntity
|
||||||
{
|
{
|
||||||
if ($entity->stock == $quantity) {
|
if ($entity->stock == $quantity) {
|
||||||
@ -118,7 +118,7 @@ class ProductModel extends BaseModel
|
|||||||
$entity->stock -= $quantity;
|
$entity->stock -= $quantity;
|
||||||
return $this->save_process($entity);
|
return $this->save_process($entity);
|
||||||
}
|
}
|
||||||
//장바구니에 빼기
|
//장바구니에 빼기(재고수량더하기)
|
||||||
public function cancelCart(ProductEntity $entity, int $quantity)
|
public function cancelCart(ProductEntity $entity, int $quantity)
|
||||||
{
|
{
|
||||||
if ($entity->status == self::STATUS_OUTOFSTOCK) {
|
if ($entity->status == self::STATUS_OUTOFSTOCK) {
|
||||||
|
|||||||
@ -1,17 +1,19 @@
|
|||||||
<?= $this->extend('layouts/front') ?>
|
<?= $this->extend('layouts/front') ?>
|
||||||
<?= $this->section('content') ?>
|
<?= $this->section('content') ?>
|
||||||
|
<?= var_export($viewDatas['entity'], true);
|
||||||
|
exit; ?>
|
||||||
<link href="/css/front/content.css" media="screen" rel="stylesheet" type="text/css" />
|
<link href="/css/front/content.css" media="screen" rel="stylesheet" type="text/css" />
|
||||||
<div id="content">
|
<div id="content">
|
||||||
<div><?= html_entity_decode($viewDatas['category']->head) ?></div>
|
<div><?= html_entity_decode($viewDatas['category']->head) ?></div>
|
||||||
<table class="form table table-bordered table-striped">
|
<table class="form table table-bordered table-striped">
|
||||||
<tbody>
|
<tbody>
|
||||||
<?php foreach ($viewDatas['fields'] as $field) : ?>
|
<?php foreach ($viewDatas['fields'] as $field) : ?>
|
||||||
<tr></tr>
|
<tr>
|
||||||
<td class="label"><?= getFieldLabel_BoardHelper($field, $viewDatas) ?></td>
|
<td class="label"><?= getFieldLabel_BoardHelper($field, $viewDatas) ?></td>
|
||||||
<td class="column">
|
<td class="column">
|
||||||
<?= getFieldView_BoardHelper($field, $viewDatas['entity'], $viewDatas) ?>
|
<?= getFieldView_BoardHelper($field, $viewDatas['entity'], $viewDatas) ?>
|
||||||
<?= validation_show_error($field); ?>
|
<?= validation_show_error($field); ?>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user