shoppingmallv2 init...

This commit is contained in:
최준흠 2023-08-08 11:28:40 +09:00
parent bde957f3a8
commit bea8009722
5 changed files with 14 additions and 12 deletions

View File

@ -98,7 +98,7 @@ class EcommerceController extends Controller
//주문추가
$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();
$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]);
//상품반환
$this->getProductModel()->cancelCart($product, $entity->quantity);
$product = $this->getProductModel()->cancelCart($product, $entity->quantity);
//주문정보 세션에서 빼기
$order_uids = $this->_session->get(SESSION_NAMES['CART']) ?: array();
$temps = array();

View File

@ -95,7 +95,7 @@ class BoardController extends FrontController
//권한체크
$this->isRole('view', $entity);
//조회수 올리기
$this->_model->addViewCount($entity);
$entity = $this->_model->addViewCount($entity);
return parent::view_process($entity);
}
//Index관련

View File

@ -45,7 +45,7 @@ class ProductController extends FrontController
//권한체크
$this->isRole('view', $entity);
//조회수 올리기
$this->_model->addViewCount($entity);
$entity = $this->_model->addViewCount($entity);
return parent::view_process($entity);
}
//Index관련

View File

@ -109,7 +109,7 @@ class ProductModel extends BaseModel
return $this->save_process($entity);
}
//장바구니에 넣기
//장바구니에 넣기(재고수량빼기)
final public function addCart(ProductEntity $entity, int $quantity): ProductEntity
{
if ($entity->stock == $quantity) {
@ -118,7 +118,7 @@ class ProductModel extends BaseModel
$entity->stock -= $quantity;
return $this->save_process($entity);
}
//장바구니에 빼기
//장바구니에 빼기(재고수량더하기)
public function cancelCart(ProductEntity $entity, int $quantity)
{
if ($entity->status == self::STATUS_OUTOFSTOCK) {

View File

@ -1,17 +1,19 @@
<?= $this->extend('layouts/front') ?>
<?= $this->section('content') ?>
<?= var_export($viewDatas['entity'], true);
exit; ?>
<link href="/css/front/content.css" media="screen" rel="stylesheet" type="text/css" />
<div id="content">
<div><?= html_entity_decode($viewDatas['category']->head) ?></div>
<table class="form table table-bordered table-striped">
<tbody>
<?php foreach ($viewDatas['fields'] as $field) : ?>
<tr></tr>
<td class="label"><?= getFieldLabel_BoardHelper($field, $viewDatas) ?></td>
<td class="column">
<?= getFieldView_BoardHelper($field, $viewDatas['entity'], $viewDatas) ?>
<?= validation_show_error($field); ?>
</td>
<tr>
<td class="label"><?= getFieldLabel_BoardHelper($field, $viewDatas) ?></td>
<td class="column">
<?= getFieldView_BoardHelper($field, $viewDatas['entity'], $viewDatas) ?>
<?= validation_show_error($field); ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>