| @@ -17,8 +17,10 @@ | ||
| 17 | 17 | protected $columns = 4; |
| 18 | 18 | |
| 19 | 19 | protected $hideExcerpt = false; |
| 20 | 20 | |
| 21 | + protected $ratingContext = ''; | |
| 22 | + | |
| 21 | 23 | public function __construct($products, $listTitle = null, $wrapperClass = null, $config = []) |
| 22 | 24 | { |
| 23 | 25 | $this->products = $products; |
| 24 | 26 | $this->listTitle = $listTitle; |
| @@ -25,8 +27,9 @@ | ||
| 25 | 27 | $this->wrapperClass = $wrapperClass; |
| 26 | 28 | $columns = Arr::get($config, 'columns', 4); |
| 27 | 29 | $this->columns = max(1, min(6, intval($columns))); |
| 28 | 30 | $this->hideExcerpt = Arr::get($config, 'hide_excerpt', false); |
| 31 | + $this->ratingContext = Arr::get($config, 'rating_context', ''); | |
| 29 | 32 | |
| 30 | 33 | if($products instanceof \FluentCart\Framework\Pagination\CursorPaginator){ |
| 31 | 34 | $this->cursor = wp_parse_args(wp_parse_url($products->nextPageUrl(), PHP_URL_QUERY)); |
| 32 | 35 | $this->cursor = Arr::get($this->cursor, 'cursor', ''); |
| @@ -67,8 +70,11 @@ | ||
| 67 | 70 | { |
| 68 | 71 | |
| 69 | 72 | foreach ($this->products as $index => $product) { |
| 70 | 73 | $config = ['hide_excerpt' => $this->hideExcerpt]; |
| 74 | + if ($this->ratingContext) { | |
| 75 | + $config['rating_context'] = $this->ratingContext; | |
| 76 | + } | |
| 71 | 77 | if($index == 0 && $this->cursor){ |
| 72 | 78 | $config['cursor'] = $this->cursor; |
| 73 | 79 | } |
| 74 | 80 | ?> |