Conditions | 1 |
Paths | 1 |
Total Lines | 21 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
32 | public function clearCart() |
||
33 | { |
||
34 | $this->getView()->registerJs(<<<JS |
||
35 | $('.cart-remove, .cart-clear, .cart-remove > .fa').on('click', function(event) { |
||
36 | var url = event.target.dataset.action; |
||
37 | (url === undefined) ? (url = $(this).parent().attr('data-action')) : 0; |
||
38 | $.ajax({ |
||
39 | url: url, |
||
40 | type: 'POST', |
||
41 | cache: false, |
||
42 | success: function () { |
||
43 | document.location.reload(true); |
||
44 | }, |
||
45 | error: function(xhr, textStatus, thrownError) { |
||
46 | console.log(textStatus); |
||
47 | } |
||
48 | }); |
||
49 | }); |
||
50 | JS |
||
51 | ); |
||
52 | } |
||
53 | } |
||
54 |