Skip to content

Commit

Permalink
Bug in update
Browse files Browse the repository at this point in the history
  • Loading branch information
cjonstrup committed Jan 10, 2021
1 parent a0a5f3d commit a8bad3c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Http/Controllers/EcommerceController.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@ public function destroy(): RedirectResponse

public function update(Request $request): RedirectResponse
{
$basket = $request->input('basket');
$items = $request->input('quantity');

if ($basket['items']) {
if ($items) {
/* @var ItemInterface $item */
foreach ($basket['items'] as $itemIdentifier => $post_item) {
foreach ($items as $itemIdentifier => $quantity) {
if ($item = Basket::item($itemIdentifier)) {
if ($post_item['quantity'] > 0) {
$item->quantity = (int) $post_item['quantity'];
if ($quantity > 0) {
$item->quantity = (int) $quantity;
} else {
Basket::remove($itemIdentifier);
}
Expand Down

0 comments on commit a8bad3c

Please sign in to comment.