shoppingmallv2 init...

This commit is contained in:
최준흠 2023-08-08 10:27:44 +09:00
parent aa8225569d
commit 6a941223d1

View File

@ -85,11 +85,11 @@ class EcommerceController extends Controller
//상품정보 가져오기
$product = $this->getProductModel()->getEntity([$this->getProductModel()->getPrimaryKey() => $this->_viewDatas['fieldDatas']['product_uid']]);
//재고수 비교
if ($product->getStock() < $this->_viewDatas['fieldDatas']['quantity']) {
throw new \Exception("구매수량이 너무 많습니다.\n구매수량:{$this->_viewDatas['fieldDatas']['quantity']}개, 남은 재고수량:{$product->getStock()}");
if ($product->stock < $this->_viewDatas['fieldDatas']['quantity']) {
throw new \Exception("구매수량이 너무 많습니다.\n구매수량:{$this->_viewDatas['fieldDatas']['quantity']}개, 남은 재고수량:{$product->stock}");
}
//구매 금액 비교
$price = $product->getPrice() * $this->_viewDatas['fieldDatas']['quantity'];
$price = $product->price * $this->_viewDatas['fieldDatas']['quantity'];
if ($price != $this->_viewDatas['fieldDatas']['price']) {
throw new \Exception("실 상품금액{$price} 와 구매금액{$this->_viewDatas['fieldDatas']['price']}이 서로 다릅니다.");
}