shoppingmallv2 init...
This commit is contained in:
parent
aa8225569d
commit
6a941223d1
@ -85,11 +85,11 @@ class EcommerceController extends Controller
|
|||||||
//상품정보 가져오기
|
//상품정보 가져오기
|
||||||
$product = $this->getProductModel()->getEntity([$this->getProductModel()->getPrimaryKey() => $this->_viewDatas['fieldDatas']['product_uid']]);
|
$product = $this->getProductModel()->getEntity([$this->getProductModel()->getPrimaryKey() => $this->_viewDatas['fieldDatas']['product_uid']]);
|
||||||
//재고수 비교
|
//재고수 비교
|
||||||
if ($product->getStock() < $this->_viewDatas['fieldDatas']['quantity']) {
|
if ($product->stock < $this->_viewDatas['fieldDatas']['quantity']) {
|
||||||
throw new \Exception("구매수량이 너무 많습니다.\n구매수량:{$this->_viewDatas['fieldDatas']['quantity']}개, 남은 재고수량:{$product->getStock()}개");
|
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']) {
|
if ($price != $this->_viewDatas['fieldDatas']['price']) {
|
||||||
throw new \Exception("실 상품금액{$price} 와 구매금액{$this->_viewDatas['fieldDatas']['price']}이 서로 다릅니다.");
|
throw new \Exception("실 상품금액{$price} 와 구매금액{$this->_viewDatas['fieldDatas']['price']}이 서로 다릅니다.");
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user