Commit 2d99e842 authored by Artem's avatar Artem

fix negative amount of prodcut in shopping cart

parent 1cc9a314
...@@ -50,7 +50,7 @@ class Cart /*extends Model*/ ...@@ -50,7 +50,7 @@ class Cart /*extends Model*/
public function updateQty($products_qty) public function updateQty($products_qty)
{ {
foreach ($products_qty as $id => $qty) { foreach ($products_qty as $id => $qty) {
if (!$qty) { if ($qty <= 0) {
$this->removeItem($id); $this->removeItem($id);
} else { } else {
$this->items[$id]['qty'] = (int)$qty; $this->items[$id]['qty'] = (int)$qty;
......
...@@ -76,6 +76,7 @@ ...@@ -76,6 +76,7 @@
<td>€ {{ $product['item']->price }}</td> <td>€ {{ $product['item']->price }}</td>
<td> <td>
<input type="number" <input type="number"
min="0"
class="js-qty-input form-control text-center" class="js-qty-input form-control text-center"
data-product_id="{{ $product['item']->id }}" data-product_id="{{ $product['item']->id }}"
value="{{ $product['qty'] }}"> value="{{ $product['qty'] }}">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment