← All changes
|
app/Services/Integrations/FluentCart/Http/Controller/FluentCartController.php
+8
-7
1.10.01
→
2.5.0
View file →
| @@ -8,8 +8,9 @@ | ||
| 8 | 8 | use FluentCart\App\Models\Product as CartProduct; |
| 9 | 9 | use FluentCart\App\Models\ProductDetail as CartProductDetail; |
| 10 | 10 | use FluentCart\App\Models\ProductVariation as CartProductVariant; |
| 11 | 11 | use FluentCart\App\Services\Permission\PermissionManager as CartPermission; |
| 12 | +use FluentBooking\App\Services\CurrenciesHelper; | |
| 12 | 13 | use FluentBooking\App\Services\Integrations\FluentCart\CartHelper; |
| 13 | 14 | use FluentBooking\Framework\Support\Arr; |
| 14 | 15 | |
| 15 | 16 | class FluentCartController extends Controller |
| @@ -43,10 +44,10 @@ | ||
| 43 | 44 | |
| 44 | 45 | $detailData = [ |
| 45 | 46 | 'post_id' => $createdPostId, |
| 46 | 47 | 'fulfillment_type' => 'digital', |
| 47 | - 'min_price' => $price * 100, | |
| 48 | - 'max_price' => $price * 100, | |
| 48 | + 'min_price' => CurrenciesHelper::toCents($price), | |
| 49 | + 'max_price' => CurrenciesHelper::toCents($price), | |
| 49 | 50 | ]; |
| 50 | 51 | |
| 51 | 52 | $productDetail = CartProductDetail::create($detailData); |
| 52 | 53 | |
| @@ -58,9 +59,9 @@ | ||
| 58 | 59 | 'payment_type' => 'onetime', |
| 59 | 60 | 'total_stock' => 1, |
| 60 | 61 | 'available' => 1, |
| 61 | 62 | 'fulfillment_type' => 'digital', |
| 62 | - 'item_price' => $price * 100, | |
| 63 | + 'item_price' => CurrenciesHelper::toCents($price), | |
| 63 | 64 | 'other_info' => [ |
| 64 | 65 | 'description' => '', |
| 65 | 66 | 'payment_type' => 'onetime', |
| 66 | 67 | 'times' => '', |
| @@ -102,9 +103,9 @@ | ||
| 102 | 103 | $includeId = $request->getSafe('include_id', 'intval'); |
| 103 | 104 | |
| 104 | 105 | $products = CartProduct::query() |
| 105 | 106 | ->select('ID', 'post_title') |
| 106 | - ->where('post_status', 'publish') | |
| 107 | + ->whereIn('post_status', ['publish', 'private']) | |
| 107 | 108 | ->whereHas('detail') |
| 108 | 109 | ->whereHas('variants') |
| 109 | 110 | ->when($search, function ($query) use ($search) { |
| 110 | 111 | $query->where('post_title', 'LIKE', '%' . $search . '%'); |
| @@ -129,9 +130,9 @@ | ||
| 129 | 130 | |
| 130 | 131 | if (!$isIncluded && $includeProductId) { |
| 131 | 132 | $product = CartProduct::where('ID', $includeProductId) |
| 132 | 133 | ->select('ID', 'post_title') |
| 133 | - ->where('post_status', 'publish') | |
| 134 | + ->whereIn('post_status', ['publish', 'private']) | |
| 134 | 135 | ->whereHas('detail') |
| 135 | 136 | ->whereHas('variants') |
| 136 | 137 | ->with(['detail', 'variants' => function ($query) { |
| 137 | 138 | $query->select('id', 'post_id', 'item_price', 'variation_title'); |
| @@ -194,8 +195,8 @@ | ||
| 194 | 195 | |
| 195 | 196 | $calendarEvent->updateMeta('payment_settings', $settings); |
| 196 | 197 | |
| 197 | 198 | return [ |
| 198 | - 'message' => __('Settings has been saved', 'fluent-booking') | |
| 199 | + 'message' => __('Settings have been saved', 'fluent-booking') | |
| 199 | 200 | ]; |
| 200 | 201 | } |
| 201 | -} | |
| 202 | +} | |