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.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 1.3.19 All 49 releases
← All changes | app/Services/Renderer/ShopAppRenderer.php +8 -0 1.6.4 → 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