48 lines
2.2 KiB
PHP
48 lines
2.2 KiB
PHP
<?= $this->extend('layouts/front') ?>
|
|
<?= $this->section('content') ?>
|
|
<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_ProductHelper($field, $viewDatas) ?></td>
|
|
<td class="column">
|
|
<?= getFieldView_ProductHelper($field, $viewDatas['entity'], $viewDatas) ?>
|
|
<?= validation_show_error($field); ?>
|
|
</td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
</tbody>
|
|
</table>
|
|
<div style="text-align:center">
|
|
<?php if ($viewDatas['entity']->status == DEFAULTS['STATUS']) : ?>
|
|
<?= form_open(URLS['addCart'], ['method' => 'post']) ?>
|
|
<?= form_hidden("product_uid", $viewDatas['entity']->getPrimaryKey()) ?>
|
|
<input type="hidden" id="price" name="price" value="<?= ($viewDatas['entity']->price) * 1 ?>">
|
|
<?php
|
|
$quantityOptions = [DEFAULTS['EMPTY'] => "구매수량 선택"];
|
|
for ($i = 1; $i <= $viewDatas['entity']->stock; $i++) {
|
|
$quantityOptions[$i] = $i . "개";
|
|
}
|
|
?>
|
|
구매 수량 : <?= form_dropdown('quantity', $quantityOptions, 1, ['onChange' => "cal_price(this.options[this.selectedIndex].value)"]); ?>
|
|
구매 금액 : <span id="order_price"><?= number_format($viewDatas['entity']->price * 1) ?></span>원
|
|
<?= form_submit('', '최소:1 ~ 최대:' . $viewDatas['entity']->stock, array("class" => "btn btn-outline btn-primary")); ?>
|
|
<?= form_close(); ?>
|
|
<script>
|
|
function cal_price(quantity) {
|
|
var price = 0;
|
|
price = <?= $viewDatas['entity']->price ?> * quantity;;
|
|
document.getElementById('price').value = price;
|
|
document.getElementById('order_price').textContent = new Intl.NumberFormat().format(price);
|
|
}
|
|
</script>
|
|
<?php else : ?>
|
|
이제품은 현재[<?= lang('Product.STATUS.' . $viewDatas['entity']->status) ?>]입니다.
|
|
<?php endif ?>
|
|
</div>
|
|
<div><?= html_entity_decode($viewDatas['category']->tail) ?></div>
|
|
</div>
|
|
<?= $this->endSection() ?>
|