PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / 1.6.5
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler v1.6.5
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 1.3.19 trunk All 48 releases
← All changes | app/Services/Renderer/ShopAppRenderer.php +17 -0 1.6.2 → 1.6.5 View file →
@@ -7,8 +7,9 @@
7 7 use FluentCart\App\Helpers\Helper;
8 8 use FluentCart\App\Http\Routes\WebRoutes;
9 9 use FluentCart\App\Modules\Templating\AssetLoader;
10 10 use FluentCart\Framework\Pagination\CursorPaginator;
11 +use FluentCart\Framework\Pagination\LengthAwarePaginator;
11 12 use FluentCart\Framework\Support\Arr;
12 13
13 14 class ShopAppRenderer
14 15 {
@@ -90,8 +91,15 @@
90 91 if($this->products instanceof CursorPaginator){
91 92 $this->total = 0;
92 93 }else{
93 94 $this->total = Arr::get($products, 'total', 0);
95 + if (!$this->total && $this->products instanceof LengthAwarePaginator) {
96 + // A raw LengthAwarePaginator's ArrayAccess proxies to its item
97 + // collection, not its own properties, so Arr::get($products, 'total')
98 + // above always misses when the caller passes the paginator directly
99 + // instead of the normalized ['products' => ..., 'total' => ...] shape.
100 + $this->total = $this->products->total();
101 + }
94 102 }
95 103 //$this->total = $products['total'];
96 104
97 105
@@ -120,8 +128,17 @@
120 128
121 129 // Merge allow_out_of_stock from config into defaultFilters
122 130 if (Arr::get($config, 'allow_out_of_stock')) {
123 131 $this->defaultFilters['allow_out_of_stock'] = true;
132 + }
133 +
134 + // Merge wildcard search preset into defaultFilters so it persists in AJAX re-fetches
135 + $wildcard = Arr::get($defaultFilters, 'wildcard', '');
136 + if ($wildcard !== '') {
137 + $this->defaultFilters['wildcard'] = $wildcard;
138 + if (empty($this->defaultFilters['enabled'])) {
139 + $this->defaultFilters['enabled'] = true;
140 + }
124 141 }
125 142
126 143 // Merge sort_by from config filters into defaultFilters for AJAX persistence
127 144 $configFilters = Arr::get($config, 'filters', []);