From bea8009722f4d213677c2eabde677b9c4bb0c437 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=B5=9C=EC=A4=80=ED=9D=A0?= Date: Tue, 8 Aug 2023 11:28:40 +0900 Subject: [PATCH] shoppingmallv2 init... --- app/Controllers/EcommerceController.php | 4 ++-- app/Controllers/Front/BoardController.php | 2 +- app/Controllers/Front/ProductController.php | 2 +- app/Models/ProductModel.php | 4 ++-- app/Views/front/board/view.php | 14 ++++++++------ 5 files changed, 14 insertions(+), 12 deletions(-) diff --git a/app/Controllers/EcommerceController.php b/app/Controllers/EcommerceController.php index b8319a1..f0d8cd6 100644 --- a/app/Controllers/EcommerceController.php +++ b/app/Controllers/EcommerceController.php @@ -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(); diff --git a/app/Controllers/Front/BoardController.php b/app/Controllers/Front/BoardController.php index d11fd08..fbf5434 100644 --- a/app/Controllers/Front/BoardController.php +++ b/app/Controllers/Front/BoardController.php @@ -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관련 diff --git a/app/Controllers/Front/ProductController.php b/app/Controllers/Front/ProductController.php index 8e746e7..23c8e70 100644 --- a/app/Controllers/Front/ProductController.php +++ b/app/Controllers/Front/ProductController.php @@ -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관련 diff --git a/app/Models/ProductModel.php b/app/Models/ProductModel.php index c5a70fd..0000502 100644 --- a/app/Models/ProductModel.php +++ b/app/Models/ProductModel.php @@ -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) { diff --git a/app/Views/front/board/view.php b/app/Views/front/board/view.php index 89e7e88..ea8f69d 100644 --- a/app/Views/front/board/view.php +++ b/app/Views/front/board/view.php @@ -1,17 +1,19 @@ extend('layouts/front') ?> section('content') ?> +
head) ?>
- - - + + +
- - -
+ + +