Skip to content

Commit

Permalink
Fix error process cart with item inactive
Browse files Browse the repository at this point in the history
  • Loading branch information
vncore committed May 1, 2022
1 parent 5eabf44 commit c18cc7f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Config/s-cart.php
@@ -1,7 +1,7 @@
<?php
return [
'core' => '6.9',
'core-sub-version' => '6.9.9',
'core-sub-version' => '6.9.10',
'homepage' => 'https://s-cart.org',
'name' => 'S-Cart',
'github' => 'https://github.com/s-cart/s-cart',
Expand Down
12 changes: 11 additions & 1 deletion src/Library/ShoppingCart/Cart.php
Expand Up @@ -216,7 +216,17 @@ public function content()
if (is_null($this->session->get($this->instance))) {
return new Collection([]);
}

//Check products in cart
$content = $this->session->get($this->instance);
foreach ($content as $key => $item) {
$product = \SCart\Core\Front\Models\ShopProduct::where('id', $item->id)
->where('status', 1) //Active
->where('approve', 1) //Approve
->first();
if (!$product) {
$this->remove($key);
}
}
return $this->session->get($this->instance);
}

Expand Down

0 comments on commit c18cc7f

Please sign in to comment.