/
var
/
www
/
vhosts
/
ihelp.ro
/
httpdocs
/
templates
/
Carts
/
/var/www/vhosts/ihelp.ro/httpdocs/templates/Carts
mkdir
upload
Name
Size
Mode
Actions
add.php
867
0644
edit
dl
rm
edit.php
1124
0644
edit
dl
rm
index.php
2481
0644
edit
dl
rm
view.bkp.php
6011
0644
edit
dl
rm
view.php
9258
0644
edit
dl
rm
Edit:
/var/www/vhosts/ihelp.ro/httpdocs/templates/Carts/view.bkp.php
(6011B)
<div class="row"> <?php if (!empty($cartItems)) : ?> <div class="column-responsive column-80"> <div class="carts view content"> <div class="related"> <h4><?php echo __('Cosul tau de cumparaturi') ?></h4> <div class="table-responsive"> <table> <tr> <th><?php echo __('Nume produs') ?></th> <th><?php echo __('Id produs') ?></th> <th><?php echo __('Cantitate') ?></th> <th><?php echo __('Pret') ?></th> <th class="actions"><?php echo __('Actions') ?></th> </tr> <?php $i = 0; foreach ($cartItems as $cartItem) { ?> <tr> <td><?php echo h($cartItem->product->name) ?></td> <td><?php echo h($cartItem->product->uuid) ?></td> <td> <?php if ($cartItem->product->stock > 1) : ?> <select name="qnt" class="qntCartProduct" id="<?php echo $cartItem->id ?>"> <?php for ($q = 1; $q <= $cartItem->product->stock; $q++) : ?> <option value="<?php echo $q ?>" <?php echo ($cartItem->qnt == $q) ? 'selected' : '' ?>><?php echo $q ?></option> <?php endfor; ?> </select> <?php else : ?> <?php echo h($cartItem->qnt) ?> <?php endif; ?> </td> <td> <?php echo $this->Number->format($cartItem->product->price * $cartItem->qnt, ['precision' => 0, 'after' => ' Lei']); echo __('Lei'); ?> </td> <td class="actions"> <?php echo $this->Form->postLink(__('Delete'), ['controller' => 'Carts', 'action' => 'delete', $cartItem->id], ['confirm' => __('Are you sure you want to delete # {0}?', $cartItem->product->name)]) ?> </td> </tr> <?php $i++; } ?> </table> </div> </div> </div> </div> <div class="column-responsive column-20"> <div class="view content"> <h4><?php echo __('Sumar comanda'); ?></h4> <p><?php echo __('Cost produse'); ?>:<?php echo $this->Number->format($totalPriceCart, ['precision' => 0, 'after' => ' Lei']) ?></p> <p><?php echo __('Cost livrare'); ?>:<?php echo __('GRATUIT'); ?></p> <hr style="border-top: 0.1rem solid #000;"> <h3><?php echo __('Total'); ?>:<br> <?php echo $this->Number->format($totalPriceCart, ['precision' => 0, 'after' => ' Lei']); ?> </h3> <p> <?= $this->Html->link(__('Continua'), ['controller' => 'Orders', 'action' => 'checkout'], ['class' => 'button']) ?></p> </div> </div> <?php else : ?> <div class="column-responsive column-100"> <div class="carts view content"> <?php echo __('Cosul tau este gol'); ?> </div> </div> <?php endif; ?> </div> <?php $this->append('script'); ?> <script> $(document).ready(function() { $('.qntCartProduct').change(function() { var itemId = $(this).attr('id') var newQnt = $(this).val() $.ajax({ url: "<?php echo $this->Url->build(['controller' => 'Carts', 'action' => 'edit'], ['fullBase' => true]) ?>", type: 'post', dataType: "json", data: { 'id': itemId, 'qnt': newQnt }, beforeSend: function(xhr) { xhr.setRequestHeader('X-CSRF-Token', $('meta[name="_csrfToken"]').attr('content')); }, success: function(response) { if (!response.error && !response.forceRedir) { Swal.fire({ position: 'center', icon: 'success', title: 'Cosul de cumparaturi a fost actualizat', showConfirmButton: false, timerProgressBar: true, timer: 1200, onClose: () => { location.reload(); } }) } else { Swal.fire({ position: 'center', icon: 'error', title: response.msg, showConfirmButton: true, timerProgressBar: true, timer: false, onClose: () => { location.reload(); } }) } } }); }) }) </script> <?php $this->end(); ?>
Save
cmd:
run