← All changes
|
app/Services/Integrations/FluentCart/CartHelper.php
+8
-4
1.10.02
→
2.5.0
View file →
| @@ -11,9 +11,9 @@ | ||
| 11 | 11 | public static function getProduct($productId) |
| 12 | 12 | { |
| 13 | 13 | return CartProductVariant::where('id', $productId) |
| 14 | 14 | ->whereHas('product', function ($query) { |
| 15 | - $query->where('post_status', 'publish'); | |
| 15 | + $query->whereIn('post_status', ['publish', 'private']); | |
| 16 | 16 | }) |
| 17 | 17 | ->first(); |
| 18 | 18 | } |
| 19 | 19 | |
| @@ -73,9 +73,9 @@ | ||
| 73 | 73 | { |
| 74 | 74 | return \FluentCart\App\Vite::getAssetUrl('images/placeholder.svg'); |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | - public static function getCartProductPrice($paymentSettings, $defaultDuration) | |
| 77 | + public static function getCartProductPrice($paymentSettings, $defaultDuration, $formatted = true) | |
| 78 | 78 | { |
| 79 | 79 | $productId = $paymentSettings['cart_product_id']; |
| 80 | 80 | |
| 81 | 81 | if (Arr::get($paymentSettings, 'multi_payment_enabled') == 'yes') { |
| @@ -84,9 +84,13 @@ | ||
| 84 | 84 | |
| 85 | 85 | $price = ''; |
| 86 | 86 | $product = self::getProduct($productId); |
| 87 | 87 | if ($product) { |
| 88 | - $price = $product->formatted_total; | |
| 88 | + if ($formatted) { | |
| 89 | + $price = $product->formatted_total; | |
| 90 | + } else { | |
| 91 | + $price = floatval($product->item_price / 100) ?? 0; | |
| 92 | + } | |
| 89 | 93 | } |
| 90 | 94 | |
| 91 | 95 | return $price; |
| 92 | 96 | } |
| @@ -99,9 +103,9 @@ | ||
| 99 | 103 | } |
| 100 | 104 | |
| 101 | 105 | $products = CartProductVariant::whereIn('id', array_values($productIds)) |
| 102 | 106 | ->whereHas('product', function ($query) { |
| 103 | - $query->where('post_status', 'publish'); | |
| 107 | + $query->whereIn('post_status', ['publish', 'private']); | |
| 104 | 108 | }) |
| 105 | 109 | ->get() |
| 106 | 110 | ->keyBy('id'); |
| 107 | 111 | |