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/SearchBarRenderer.php +27 -5 1.3.21 → 1.6.5 View file →
@@ -1,12 +1,8 @@
1 1 <?php
2 2
3 3 namespace FluentCart\App\Services\Renderer;
4 -use FluentCart\Api\StoreSettings;
5 4 use FluentCart\Framework\Support\Arr;
6 -use FluentCart\App\Vite;
7 -use FluentCart\App\Helpers\Helper;
8 -use FluentCart\Api\Resource\ShopResource;
9 5
10 6 class SearchBarRenderer
11 7 {
12 8
@@ -23,8 +19,9 @@
23 19 'class' => 'fluent-cart-search-bar-app-wrapper',
24 20 'data-link-with-shop-app' => esc_attr(Arr::get($this->config, 'link_with_shop_app', false)),
25 21 'data-fluent-cart-search-bar-app-wrapper' => '',
26 22 'data-url-mode' => esc_attr(Arr::get($this->config, 'url_mode', '')),
23 + 'data-show-thumbnail' => esc_attr(Arr::get($this->config, 'show_thumbnail', true) ? 'true' : 'false'),
27 24 ];
28 25
29 26 ?>
30 27
@@ -150,12 +147,17 @@
150 147
151 148 public function renderResultItems($products = [])
152 149 {
153 150 $pageTarget = (Arr::get($this->config, 'url_mode', '') == 'new-tab') ? 'target="_blank"' : '';
151 + $showThumbnail = Arr::get($this->config, 'show_thumbnail', true);
154 152
155 153 foreach ($products as $product) {
156 154 $productTitle = Arr::get($product, 'post_title', '');
157 155 $productUrl = Arr::get($product, 'guid', '');
156 + $thumbnail = $showThumbnail ? Arr::get($product, 'thumbnail', '') : '';
157 + $minPrice = Arr::get($product, 'detail.formatted_min_price', '');
158 + $maxPrice = Arr::get($product, 'detail.formatted_max_price', '');
159 +
158 160 $aria_label = sprintf(
159 161 /* translators: 1: Product title */
160 162 esc_attr__('View product: %1$s', 'fluent-cart'),
161 163 esc_html($productTitle)
@@ -166,9 +168,29 @@
166 168 href="<?php echo esc_url($productUrl) ?>"
167 169 <?php echo esc_html($pageTarget); ?>
168 170 aria-label="<?php echo esc_attr($aria_label); ?>"
169 171 >
170 - <?php echo esc_html($productTitle); ?>
172 + <div class="fct-search-result-info">
173 + <?php if ($thumbnail) : ?>
174 + <img
175 + src="<?php echo esc_url($thumbnail); ?>"
176 + alt="<?php echo esc_attr($productTitle); ?>"
177 + />
178 + <?php endif; ?>
179 +
180 + <span class="fct-search-result-title">
181 + <?php echo esc_html($productTitle); ?>
182 + </span>
183 + </div>
184 +
185 + <?php if ($minPrice) : ?>
186 + <span class="fct-search-result-price">
187 + <?php echo wp_kses_post($minPrice); ?>
188 + <?php if ($maxPrice && $maxPrice !== $minPrice) : ?>
189 + - <?php echo wp_kses_post($maxPrice); ?>
190 + <?php endif; ?>
191 + </span>
192 + <?php endif; ?>
171 193 </a>
172 194 </li>
173 195 <?php
174 196 }