PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / 1.7.0
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler v1.7.0
1.7.0 1.6.6 1.6.5 1.6.4 1.6.3 1.6.2 1.6.1 1.6.0 1.5.4 1.5.5 1.5.3 1.5.2 1.5.1 1.5.0 1.4.2 1.4.1 1.4.0 1.3.28 1.3.27 1.3.26 1.3.25 1.3.23 1.3.22 1.3.21 1.3.20 All 50 releases
← All changes | app/Hooks/Handlers/BlockEditors/MiniCartBlockEditor.php +12 -4 1.3.26 → 1.7.0 View file →
@@ -12,9 +12,8 @@
12 12 use FluentCart\App\Services\Renderer\CartDrawerRenderer;
13 13 use FluentCart\App\Services\Renderer\MiniCartRenderer;
14 14 use FluentCart\App\Services\Renderer\ProductRenderer;
15 15 use FluentCart\App\Services\Translations\TransStrings;
16 -use FluentCart\App\Vite;
17 16 use FluentCart\Framework\Support\Arr;
18 17
19 18 class MiniCartBlockEditor extends BlockEditor
20 19 {
@@ -73,9 +72,9 @@
73 72 'slug' => $this->slugPrefix,
74 73 'name' => static::getEditorName(),
75 74 'title' => __('Mini Cart', 'fluent-cart'),
76 75 'description' => __('Display a button for shoppers to quickly view their cart.', 'fluent-cart'),
77 - 'placeholder_image' => Vite::getAssetUrl('images/placeholder.svg'),
76 + 'placeholder_image' => Helper::getProductPlaceholderUrl(),
78 77 ],
79 78 'fluent_cart_block_translation' => TransStrings::blockStrings(),
80 79 ];
81 80 }
@@ -92,15 +91,24 @@
92 91 if (!CartHelper::doingInstantCheckout()) {
93 92 $cart = CartHelper::getCart(null, false);
94 93 if ($cart) {
95 94 $cartData = $cart->cart_data ?? [];
96 - $itemCount = count($cartData);
97 95 }
98 96 }
99 97
98 + $countMode = Arr::get($shortCodeAttribute, 'count_mode', 'distinct_products');
100 99
100 + if ($countMode === 'total_quantity') {
101 + foreach ($cartData as $item) {
102 + $itemCount += (int) ($item['quantity'] ?? 1);
103 + }
104 + } else {
105 + $itemCount = count($cartData);
106 + }
107 +
101 108 $miniCartRenderer = new MiniCartRenderer($cartData, [
102 - 'item_count' => $itemCount
109 + 'item_count' => $itemCount,
110 + 'count_mode' => $countMode,
103 111 ]);
104 112
105 113 ob_start();
106 114 $miniCartRenderer->renderMiniCart($shortCodeAttribute);