Skip to content

Commit

Permalink
[FIX] Cart.
Browse files Browse the repository at this point in the history
  • Loading branch information
Seiger committed Feb 5, 2025
1 parent 70263f0 commit 3ffc077
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Cart/sCart.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function addProduct(int $productId = 0, int $optionId = 0, int $quantity
}

if (!isset($this->cartData[$productId][$optionId])) {
$this->cartData[$productId][$optionId] = 0;
$this->cartData[$productId][$optionId] = $quantity;
}

if (sCommerce::config('product.inventory_on', 0)) {
Expand All @@ -76,7 +76,7 @@ public function addProduct(int $productId = 0, int $optionId = 0, int $quantity
}
}

$quantity = ($quantity == 1 ? 1 : $quantity);
$quantity = ($quantity == 1 ? $this->cartData[$productId][$optionId] : $quantity);
$this->cartData[$productId][$optionId] = $quantity;
$this->saveCartData();

Expand Down
1 change: 1 addition & 0 deletions src/sCommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ public function convertPrice($price, $currencyFrom = null, $currencyTo = null):
*/
public function convertPriceNumber($price, $currencyFrom, $currencyTo): float
{
$price = preg_replace('/[^\d\.]+/', '', $price);
$rate = config('seiger.settings.sCommerceCurrencies.' . $currencyFrom . '_' . $currencyTo, 1);
return floatval($price) * $rate;
}
Expand Down

0 comments on commit 3ffc077

Please sign in to comment.