/
var
/
www
/
vhosts
/
nabawater
/
frontend
/
views
/
item
/
/var/www/vhosts/nabawater/frontend/views/item
mkdir
upload
Name
Size
Mode
Actions
direct-purchase.php
32587
0644
edit
dl
rm
index.php
6099
0644
edit
dl
rm
item_view.php
13456
0644
edit
dl
rm
_direct_purchase_row.php
5941
0644
edit
dl
rm
Edit:
/var/www/vhosts/nabawater/frontend/views/item/item_view.php
(13456B)
<?php /* @var $this yii\web\View */ /* @var $dataProviderVendor \yii\data\ActiveDataProvider */ use yii\helpers\Html; use common\helpers\Com; use yii\widgets\ListView; use yii\helpers\Url; use common\helpers\UploadHelper; use frontend\models\Configuration; use frontend\models\BranchReview; use frontend\components\CActiveForm; $uploadHelper = UploadHelper::getInstance(); $is_user = yii::$app->user->getId(); $cart_product = Com::session(Com::SES_CART); $item_type = $data['item_purchase_type'] == 1 ? 'normal_items' : 'bulk_items'; ?> <?php if(isset($data['item_image'][0]['item_image_path'])) { ?> <section class="banner detail-baner" style="background:url(<?= $data['item_image'][0]['item_image_path'] ?>); background-size: cover; background-repeat: no-repeat;" > <?php } else { ?> <section class="banner detail-baner"> <?php } ?> <div class="container"> <div class="row"> <div class="col-md-6"> <div class="baner-logo"> <a class="b-logo" href="#"><img src="<?= Com::res('images/logo.png', false) ?>" class="img-responsive wow fadeInUp"> </a> </div> </div> </div> </section> <section class="products-tab text-center pd-50"> <div class="container"> <div class="row"> <div class="col-md-8 pd-40"> <div class="goback"> <a href="<?= $data['item_purchase_type'] == 1 ? '/product-list-normal-orders' : '/product-list-bulk-orders'; ?>"> <i class="material-icons">arrow_back</i> Go Back </a> </div> <div class="detail-full"> <div class="detail-header"> <h3></h3><?= $data['item_name'] ?></h3> <p><?= $data['item_short_desc'] ?></p> <div class="rating"><?= $data['rating'] ?><span class="material-icons">star</span>(<?= $data['number_user_rating'] ?>) </div> <?php if($data['is_offer'] == 1){ ?> <p class="payment"><span><?= Com::moneyFormat($data['orginal_price'], true) ?></span><?= Com::moneyFormat($data['item_price'], true) ?></p> <?php } else { ?> <p class="payment"><?= Com::moneyFormat($data['item_price'], true) ?></p> <?php } ?> <div class="button-container item_list" key="<?= $data['item_key'] ?>" cart_type="<?= $data['item_purchase_type'] == 1 ? 'normal_items' : 'bulk_items' ?>"> <button class="cart-qty-minus reduce_qty" type="button" value="-">-</button> <input type="text" name="qty" id="tbox<?= $data['item_key'] ?>" min="0" value="<?= isset($cart_product[$item_type][$data['item_key']]['quantity']) ? $cart_product[$item_type][$data['item_key']]['quantity'] : 0 ?>" class="qty form-control" readonly="" /> <button class="cart-qty-plus add_qty" type="button" value="+">+</button> </div> </div> <?php if(!empty($data['item_description'])){ ?> <h3 class="color-1 description-title">Description</h3> <div class="detail-description"> <?= $data['item_description'] ?> </div> <?php } ?> </div> <div class="review-section"> <h3 class="color-1 description-title"> Reviews <?php if($is_user) { ?> <span class="add-btn"> <a data-toggle="modal" data-target="#exampleModal"> <i class="material-icons"> add_circle_outline </i> </a> </span> <?php } ?> </h3> <?php foreach ($data['review'] as $key => $rev) { ?> <div class="detail-description"> <div class="r-name"><?= $rev['name'] ?></div> <div class="date-time"><?= Date('d/m/Y', strtotime($rev['created_at']))?> <span class="time"><?= Date('H:i A', strtotime($rev['created_at'])) ?></span></div> <p class="rating"><i class="fa fa-star"></i> (<?= $rev['rating'] ?>)</p> <p><?= $rev['review'] ?></p> </div> <?php } ?> <?php if(empty($data['review'])){ ?> <div class="detail-description"> <div class="no-found-body text-center"> <img src="<?= Com::res('images/no-review.png', false) ?>"> <p> No reviews yet !!! </p> </div> </div> <?php } ?> </div> </div> <div class="col-md-4 pd-40"> <div class="card shoping-cart is_stuck"> <div class="card-body"> <?php echo $this->render('/branch/_mini_cart', ['branch_key' => 'normal_items'])?> </div> </div> </div> </div> </div> </section> <!-- Review Modal --> <div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content review-modal"> <div class="modal-header"> <a href="javascript:void(0)" data-dismiss="modal"><i class="fa fa-times"></i></a> <h3 class="modal-title"><?= yii::t('frontend','Add Review') ?></h3> </div> <div class="modal-body"> <?php $models = new BranchReview(); $form = CActiveForm::begin(['id'=>'rating_form'])->setModel($models) ?> <div class="form-group"> <label for="exampleFormControlInput1">Name</label> <?=$form->field($models, 'name') ->textInput(['placeholder' => yii::t('frontend','Name'), 'id' => 'exampleFormControlInput1']) ->label(false); ?> </div> <div class="form-group"> <label for="exampleFormControlTextarea1">Add Review</label> <?=$form->field($models, 'review') ->textInput(['placeholder' => yii::t('frontend','Review'), 'id' => 'exampleFormControlTextarea1']) ->label(false); ?> </div> <div class="form-group"> <label for="exampleFormControlInput1">Add Rating</label> <div class="rate_s" data-rateyo-star-width="18px"></div> </div> <?= $form->field($models, 'item_key')->hiddenInput(['value' => $data['item_key']]) ?> <?= $form->field($models, 'rating')->hiddenInput(['value' => 0]) ?> </div> <div class="modal-footer"> <?= Html::submitButton( yii::t('frontend','Add Review'), [ 'class' => 'btn btn-secondary', ] ) ?> </div> <?php CActiveForm::end(); ?> </div> </div> </div> <script> runOnLoad(function(){ $(".rate_s").rateYo({rating:0}); $(".rate_s").rateYo().on("rateyo.change", function (e, data) { var rating = data.rating; $('#branchreview-rating').val(rating); }); $(document).on('click', '.add_qty', function(e){ var branch_key = $(this).closest('div.item_list').attr('cart_type'); var item_key = $(this).closest('div.item_list').attr('key'); if (branch_key == '' && item_key == '') { e.preventDefault(); }else { Core.ajax({ type: "POST", url: "<?= Url::to(['/branch/add-cart']) ?>", data: { "branch_key": branch_key, "item_key": item_key, "element" : "quantity_add", "is_clear_cart": 0 }, done: function (result) { if(result.status == '<?=Com::SUCCESS?>' && parseInt(result.clear_alert) != 1){ $('#tbox'+item_key).val(parseInt($('#tbox'+item_key).val()) + 1); $('.card-body').html(result.html); $('span.item_counts').html(result.count); Core.success(result.message); return false; } else if (parseInt(result.clear_alert) == 1) { clearCart(branch_key,item_key, 'quantity_add', result.error_message); } else{ Core.error(result.message); } //Core.error(result.message); return false; } }); } }); $(document).on('click', '.reduce_qty', function(e){ var branch_key = $(this).closest('div.item_list').attr('cart_type'); var item_key = $(this).closest('div.item_list').attr('key'); if(parseInt($('#tbox'+item_key).val()) == 0){ Core.error('Add minimum one qty'); return false; } if (branch_key == '' && item_key == '') { e.preventDefault(); }else { Core.ajax({ type: "POST", url: "<?= Url::to(['/branch/add-cart']) ?>", data: { "branch_key": branch_key, "item_key": item_key, "element" : "quantity_subtract", "is_clear_cart": 0 }, done: function (result) { if(result.status == '<?=Com::SUCCESS?>'){ $('#tbox'+item_key).val(parseInt($('#tbox'+item_key).val()) - 1); $('.card-body').html(result.html); $('span.item_counts').html(result.count); } } }); } }); function clearCart(branch_key, item_key, element, msg) { var cart_data = ''; if (element == 'add_item_ingredient') { cart_data = branch_key; $('#ing_modal').modal('toggle'); } if (element == 'quantity_add') { cart_data = { branch_key : branch_key, item_key : item_key, element : element, is_clear_cart : 1 } } iziToast.question({ timeout: 20000, close: false, overlay: true, toastOnce: true, id: 'question', zindex: 999, title: 'Hey', message: msg, position: 'center', buttons: [ ['<button><b>YES</b></button>', function (instance, toast) { instance.hide({ transitionOut: 'fadeOut' }, toast, 'button'); Core.ajax({ type: "POST", url: "<?= Url::to(['/branch/add-cart']) ?>", data: cart_data, done: function (result) { if(result.status == '<?=Com::SUCCESS?>'){ Core.success("Cart cleared"); $('#tbox'+item_key).val(1); // $('#cart').html(result.html); $('.card-body').html(result.html); $('span.item_counts').html(result.count); }else{ Core.error(result.message); } } }); }, true], ['<button>NO</button>', function (instance, toast) { instance.hide({ transitionOut: 'fadeOut' }, toast, 'button'); }], ], onClosing: function(instance, toast, closedBy){ console.info('Closing | closedBy: ' + closedBy); }, onClosed: function(instance, toast, closedBy){ console.info('Closed | closedBy: ' + closedBy); } }); } $('#rating_form').on('beforeSubmit', function() { form = $(this); Core.ajax({ url : '<?= Url::to(['item/add-review']) ?>', type : 'POST', data : form.serializeArray(), done: function (json) { if (json.status == 1) { $('#exampleModal').modal('toggle'); form.trigger('reset'); Core.success(json.message); return; } Core.error(json.message); } }); return false; }); }); </script>
Save
cmd:
run