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/ProductListRenderer.php +15 -2 1.3.21 → 1.6.5 View file →
@@ -13,13 +13,20 @@
13 13 protected $wrapperClass = null;
14 14
15 15 protected $cursor = null;
16 16
17 - public function __construct($products, $listTitle = null, $wrapperClass = null)
17 + protected $columns = 4;
18 +
19 + protected $hideExcerpt = false;
20 +
21 + public function __construct($products, $listTitle = null, $wrapperClass = null, $config = [])
18 22 {
19 23 $this->products = $products;
20 24 $this->listTitle = $listTitle;
21 25 $this->wrapperClass = $wrapperClass;
26 + $columns = Arr::get($config, 'columns', 4);
27 + $this->columns = max(1, min(6, intval($columns)));
28 + $this->hideExcerpt = Arr::get($config, 'hide_excerpt', false);
22 29
23 30 if($products instanceof \FluentCart\Framework\Pagination\CursorPaginator){
24 31 $this->cursor = wp_parse_args(wp_parse_url($products->nextPageUrl(), PHP_URL_QUERY));
25 32 $this->cursor = Arr::get($this->cursor, 'cursor', '');
@@ -34,8 +41,13 @@
34 41 ($this->products instanceof \FluentCart\Framework\Pagination\CursorPaginator && $this->products->count() === 0)
35 42 ) {
36 43 return '';
37 44 }
45 +
46 + $columns = $this->columns
47 + ? 'style="--fct-product-list-columns: ' . $this->columns . ';"'
48 + : '';
49 +
38 50 ?>
39 51 <section class="fct-product-list-container <?php echo esc_attr($this->wrapperClass); ?>" aria-label="<?php echo esc_attr($this->listTitle ?: __('Product List', 'fluent-cart')); ?>">
40 52 <?php $this->renderTitle(); ?>
41 53 <div
@@ -42,8 +54,9 @@
42 54 class="fct-product-list"
43 55 role="list"
44 56 aria-live="polite"
45 57 aria-busy="false"
58 + <?php echo $columns; ?>
46 59 >
47 60 <?php $this->renderProductList(); ?>
48 61 </div>
49 62 </section>
@@ -53,9 +66,9 @@
53 66 public function renderProductList()
54 67 {
55 68
56 69 foreach ($this->products as $index => $product) {
57 - $config = [];
70 + $config = ['hide_excerpt' => $this->hideExcerpt];
58 71 if($index == 0 && $this->cursor){
59 72 $config['cursor'] = $this->cursor;
60 73 }
61 74 ?>