PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / 1.3.21
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler v1.3.21
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
fluent-cart / app / Services / Renderer / CartRenderer.php

CartRenderer.php in FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler 1.3.21, at app/Services/Renderer/CartRenderer.php

579 lines 24.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace FluentCart\App\Services\Renderer;
4
5 use FluentCart\Api\StoreSettings;
6 use FluentCart\Framework\Support\Arr;
7 use FluentCart\App\Vite;
8 use FluentCart\App\Helpers\Helper;
9 use FluentCart\App\Helpers\CartCheckoutHelper;
10 use FluentCart\App\Models\Product;
11
12 class CartRenderer
13 {
14 protected $cartItems;
15 protected $storeSettings;
16
17 protected $currentCartItem = [];
18 protected $url = [];
19
20 protected $product = [];
21
22
23 public function __construct($cartItems = [])
24 {
25 $this->storeSettings = new StoreSettings();
26 $this->cartItems = $cartItems;
27 $this->cartItems = Helper::loadBundleChild($this->cartItems, ['*']);
28 }
29
30 public function render()
31 {
32
33 ?>
34
35 <section class="fct-cart-page" aria-labelledby="fct-cart-page-title" role="region">
36 <h2 id="fct-cart-page-title" class="screen-reader-text">
37 <?php esc_html_e('Your Shopping Cart', 'fluent-cart'); ?>
38 </h2>
39
40 <?php $this->renderItems(); ?>
41
42 <?php $this->renderTotal(); ?>
43
44 <div class="fluent-cart-cart-cart-button-wrap" data-fluent-cart-cart-checkout-button-wrap>
45 <?php $this->renderCheckoutButton(); ?>
46 </div>
47
48
49 </section>
50
51 <?php
52 }
53
54
55 public function renderItems()
56 {
57 ?>
58
59 <div class="fct-cart-drawer-content-wrapper" data-fluent-cart-cart-content-wrapper role="presentation">
60 <?php $this->renderList(); ?>
61 </div>
62
63 <?php
64
65 }
66
67 public function renderDummyItems()
68 {
69 $dummy = [
70 [
71 'id' => 0,
72 'post_id' => 0,
73 'fulfillment_type' => '',
74 'other_info' => [
75 'payment_type' => '',
76 ],
77 'quantity' => 0,
78 'price' => 0,
79 'unit_price' => 0,
80 'line_total' => 0,
81 'subtotal' => 0,
82 'line_total_formatted' => '&#36;0',
83 'object_id' => 0,
84 'title' => '',
85 'post_title' => '',
86 'coupon_discount' => 0,
87 'cost' => 0,
88 'featured_media' => '',
89 'view_url' => '',
90 'variation_type' => '',
91 'shipping_charge' => 0,
92 'itemwise_shipping_charge' => 0,
93 ]
94 ];
95
96 $this->renderList($dummy);
97 }
98
99 public function renderList($items = [])
100 {
101 $items = empty($items) ? $this->cartItems : $items;
102
103
104 ?>
105 <div class="fct-cart-drawer-list" data-fluent-cart-cart-list>
106 <?php if (!empty($items)) { ?>
107 <ul class="fct-cart-drawer-list-content" data-fluent-cart-items-wrapper role="list">
108 <?php
109 foreach ($items as $cartItem) {
110 $this->currentCartItem = $cartItem;
111 $this->url = Arr::get($cartItem, 'view_url', '');
112 $this->renderItem();
113 }
114 ?>
115 </ul>
116 <?php } else { ?>
117 <?php $this->renderEmpty(); ?>
118 <?php } ?>
119 </div>
120 <?php
121
122 }
123
124 public function renderItem()
125 {
126 $title = Arr::get($this->currentCartItem, 'title', '');
127
128 ?>
129 <li data-cart-items class="fct-cart-item" role="listitem"
130 aria-label="<?php echo esc_attr($title); ?>">
131 <div class="fct-cart-item-info">
132 <?php $this->renderImage(); ?>
133 <?php $this->renderDetails(); ?>
134 </div>
135 <?php $this->renderSummary(); ?>
136 </li>
137
138 <?php
139 }
140
141 public function renderImage()
142 {
143 $image = Arr::get($this->currentCartItem, 'featured_media');
144 $title = Arr::get($this->currentCartItem, 'title', __('Product Image', 'fluent-cart'));
145
146 if (!$image) {
147 $image = Vite::getAssetUrl('images/placeholder.svg');
148 }
149
150 ?>
151
152 <div class="fct-cart-item-image">
153 <a href="<?php echo esc_url($this->url); ?>">
154 <img src="<?php echo esc_url($image); ?>"
155 data-fluent-cart-cart-list-item-image
156 alt="<?php echo esc_attr($title); ?>"
157 loading="lazy"
158 />
159 </a>
160
161 </div>
162
163 <?php
164 }
165
166 public function renderDetails()
167 {
168 ?>
169
170 <div class="fct-cart-item-details" role="group"
171 aria-label="<?php esc_attr_e('Product Details', 'fluent-cart'); ?>">
172 <?php
173 $this->renderTitles();
174 $this->renderItemPrice();
175 $this->renderQuantity();
176 (new CartItemRenderer($this->currentCartItem))->renderChildVariants();
177 ?>
178
179 </div>
180
181 <?php
182 }
183
184
185
186 public function renderTitles()
187 {
188 $postTitle = Arr::get($this->currentCartItem, 'post_title', '');
189 $variationTitle = Arr::get($this->currentCartItem, 'title', '');
190 $variationType = Arr::get($this->currentCartItem, 'variation_type', 'simple');
191
192 $aria_label = sprintf(
193 /* translators: 1: Post or product title */
194 esc_attr__('View %1$s', 'fluent-cart'),
195 esc_attr($postTitle)
196 );
197
198
199 ?>
200
201 <h3 class="fct-cart-item-title" data-fluent-cart-cart-list-item-title>
202 <a href="<?php echo esc_url($this->url); ?>"
203 aria-label="<?php echo esc_attr($aria_label); ?>"
204 data-fluent-cart-cart-list-item-title-url>
205 <span data-fluent-cart-cart-list-item-title-element>
206 <?php echo esc_html($postTitle); ?>
207 </span>
208 </a>
209 </h3>
210
211 <p class="fct-cart-item-variant <?php echo $variationType === 'simple' ? 'variant-title-hidden' : ''?>"
212 data-fluent-cart-cart-list-item-variation-title>
213 - <?php echo esc_html($variationTitle); ?>
214 </p>
215
216 <?php
217 }
218
219 public function renderItemPrice()
220 {
221 $price = Helper::toDecimal(Arr::get($this->currentCartItem, 'unit_price', 0));
222 $quantity = Arr::get($this->currentCartItem, 'quantity', 1);
223
224 ?>
225 <div class="fct-cart-item-price <?php echo $quantity <= 1 ? 'item-price-hidden' : '' ?>">
226 <span><?php esc_html_e('Unit Price:', 'fluent-cart'); ?></span>
227 <span data-fluent-cart-cart-list-item-price aria-live="polite">
228 <?php echo esc_html($price); ?>
229 </span>
230 </div>
231
232 <?php
233 }
234
235 public function renderQuantity()
236 {
237 $quantity = Arr::get($this->currentCartItem, 'quantity', 0);
238
239 $productId = Arr::get($this->currentCartItem, 'post_id');
240 $this->product = Product::query()->with(['detail'])->find($productId);
241 $soldIndividually = false;
242 if ($this->product) {
243 $soldIndividually = $this->product->soldIndividually();
244 }
245
246 if ($soldIndividually) {
247 return;
248 }
249
250 ?>
251
252 <div class="fct-cart-item-quantity"
253 data-fluent-cart-cart-list-item-quantity-wrapper
254 role="group"
255 aria-label="<?php esc_attr_e('Change Quantity', 'fluent-cart'); ?>"
256 >
257
258 <button
259 class="qty-btn decrease-btn"
260 data-item-id="<?php echo esc_attr($this->currentCartItem['object_id']); ?>"
261 data-fluent-cart-cart-list-item-decrease-button
262 title="<?php esc_attr_e('Decrease Quantity', 'fluent-cart'); ?>"
263 aria-label="<?php esc_attr_e('Decrease Quantity', 'fluent-cart'); ?>"
264 >
265 <svg xmlns="http://www.w3.org/2000/svg" width="12" height="2" viewBox="0 0 12 2" fill="none">
266 <path d="M11.3333 1L0.666662 1" stroke="currentColor" stroke-linecap="round"
267 stroke-linejoin="round"/>
268 </svg>
269 </button>
270
271 <input
272 class="qty-value"
273 min="1"
274 data-item-id="<?php echo esc_attr($this->currentCartItem['object_id']); ?>"
275 data-fluent-cart-cart-list-item-quantity-input
276 value="<?php echo esc_attr($quantity); ?>"
277 aria-label="<?php esc_attr_e('Product Quantity', 'fluent-cart'); ?>"
278 aria-live="polite"
279 />
280
281 <button
282 class="qty-btn increase-btn"
283 data-fluent-cart-cart-list-item-increase-button
284 data-item-id="<?php echo esc_attr($this->currentCartItem['object_id']); ?>"
285 title="<?php esc_attr_e('Increase Quantity', 'fluent-cart'); ?>"
286 aria-label="<?php esc_attr_e('Increase Quantity', 'fluent-cart'); ?>"
287 >
288 <svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12" fill="none">
289 <path d="M6 0.666748L6 11.3334M11.3333 6.00008L0.666672 6.00008" stroke="currentColor"
290 stroke-linecap="round" stroke-linejoin="round"></path>
291 </svg>
292 </button>
293 </div>
294
295 <?php
296 }
297
298
299 public function renderSummary()
300 {
301 ?>
302 <div class="fct-cart-item-summary" role="group"
303 aria-label="<?php esc_attr_e('Cart Item Summary', 'fluent-cart'); ?>">
304 <?php $this->renderItemTotal(); ?>
305 <?php $this->renderRemove(); ?>
306 </div>
307
308 <?php
309 }
310
311 public function renderItemTotal()
312 {
313 $quantity = Arr::get($this->currentCartItem, 'quantity', 0);
314 $totalPrice = Arr::get($this->currentCartItem, 'unit_price', 0) * $quantity;
315
316 if (Arr::get($this->currentCartItem, 'other_info.payment_type', 'onetime') == 'subscription') {
317 if (Arr::get($this->currentCartItem, 'other_info.manage_setup_fee') == 'yes') {
318 $signupFee = Arr::get($this->currentCartItem, 'other_info.signup_fee', 0);
319
320 if (Arr::get($this->currentCartItem, 'other_info.setup_fee_per_item', 'no') == 'yes') {
321 $signupFee = Arr::get($this->currentCartItem, 'other_info.signup_fee', 0) * $quantity;
322 }
323
324 $totalPrice += $signupFee;
325 }
326 }
327
328 $totalPrice = Helper::toDecimal($totalPrice);
329 $aria_label = sprintf(
330 /* translators: 1: Total price */
331 __('Total price for this item: %1$s', 'fluent-cart'),
332 $totalPrice
333 );
334
335 ?>
336 <div class="fct-cart-item-total">
337 <span
338 data-fluent-cart-cart-list-item-total-price
339 aria-live="polite"
340 aria-label="<?php echo esc_attr($aria_label); ?>"
341 >
342 <?php echo esc_html($totalPrice); ?>
343 </span>
344 </div>
345
346 <?php
347 }
348
349 public function renderTotal()
350 {
351
352 $subtotal = CartCheckoutHelper::make()->getItemsAmountSubtotal(true, true);
353 $aria_label = sprintf(
354 /* translators: 1: Total price */
355 __('Total cart price: %1$s', 'fluent-cart'),
356 esc_attr($subtotal)
357 );
358 ?>
359
360 <div
361 data-fluent-cart-cart-total-wrapper
362 class="fct-cart-total-wrapper"
363 role="region"
364 aria-label="<?php esc_attr_e('Cart Total', 'fluent-cart'); ?>"
365 >
366 <span><?php echo esc_html__('Total', 'fluent-cart'); ?>:</span>
367 <span
368 data-fluent-cart-cart-total-price
369 aria-live="polite"
370 aria-label="<?php echo esc_attr($aria_label); ?>"
371 >
372 <?php echo esc_html($subtotal); ?>
373 </span>
374 </div>
375
376 <?php
377
378 }
379
380 public function renderRemove()
381 {
382
383 ?>
384 <div class="fct-cart-item-remove">
385 <button
386 type="button"
387 class="fct-cart-item-delete-button"
388 data-fluent-cart-cart-list-item-delete-button
389 data-item-id="<?php echo esc_attr($this->currentCartItem['object_id']); ?>"
390 aria-label="<?php esc_attr_e('Remove this item from cart', 'fluent-cart'); ?>"
391 title="<?php esc_attr_e('Remove From Cart', 'fluent-cart'); ?>"
392 >
393 <svg xmlns="http://www.w3.org/2000/svg" width="14" height="16" viewBox="0 0 14 16" fill="none">
394 <path d="M12 3.6665L11.5868 10.3499C11.4813 12.0575 11.4285 12.9113 11.0005 13.5251C10.7889 13.8286 10.5164 14.0847 10.2005 14.2772C9.56141 14.6665 8.70599 14.6665 6.99516 14.6665C5.28208 14.6665 4.42554 14.6665 3.78604 14.2765C3.46987 14.0836 3.19733 13.827 2.98579 13.5231C2.55792 12.9082 2.5063 12.0532 2.40307 10.3433L2 3.6665"
395 stroke="currentColor" stroke-linecap="round"></path>
396 <path d="M1 3.66659H13M9.70382 3.66659L9.2487 2.72774C8.94638 2.10409 8.79522 1.79227 8.53448 1.59779C8.47664 1.55465 8.4154 1.51628 8.35135 1.48305C8.06261 1.33325 7.71608 1.33325 7.02302 1.33325C6.31255 1.33325 5.95732 1.33325 5.66379 1.48933C5.59873 1.52392 5.53666 1.56385 5.4782 1.6087C5.21443 1.81105 5.06709 2.13429 4.7724 2.78076L4.36862 3.66659"
397 stroke="currentColor" stroke-linecap="round"></path>
398 <path d="M5.33334 11L5.33334 7" stroke="currentColor" stroke-linecap="round"></path>
399 <path d="M8.66666 11L8.66666 7" stroke="currentColor" stroke-linecap="round"></path>
400 </svg>
401 </button>
402 </div>
403
404 <?php
405 }
406
407 public function renderCheckoutButton()
408 {
409 ?>
410
411 <a class="checkout-button"
412 href="<?php echo esc_attr($this->storeSettings->getCheckoutPage()); ?>"
413 role="button"
414 aria-label="<?php esc_attr_e('Go to checkout page', 'fluent-cart'); ?>">
415 <?php esc_html_e('Go to Checkout', 'fluent-cart'); ?>
416 </a>
417
418 <?php
419
420 }
421
422 public function renderViewCartButton()
423 {
424 return;
425 ?>
426
427 <a class="view-cart-button"
428 href="<?php echo esc_attr($this->storeSettings->getCartPage()); ?>"
429 role="button"
430 aria-label="<?php esc_attr_e('View your shopping cart', 'fluent-cart'); ?>">
431 <?php esc_html_e('View Cart', 'fluent-cart'); ?>
432 </a>
433
434 <?php
435
436 }
437
438 public function renderEmptyCartIcon()
439 { ?>
440 <svg xmlns="http://www.w3.org/2000/svg" width="157" height="137" viewBox="0 0 157 137" fill="none">
441 <path d="M21.5017 135H134.91" stroke="#D6DCE8" stroke-width="2" stroke-miterlimit="10"
442 stroke-linejoin="round"/>
443 <path d="M8.60278 135H18.2925" stroke="#D6DCE8" stroke-width="2" stroke-miterlimit="10"
444 stroke-linejoin="round"/>
445 <path d="M23.1192 26.0612L18.0879 27.0789L21.8382 46.0468L26.8695 45.0291L23.1192 26.0612Z"
446 fill="#D5DDEA"/>
447 <path d="M41.6122 46.1949L38.3471 29.4465H11.9932C10.827 29.4465 9.89417 28.9747 9.1945 28.2671L7.32873 26.144C6.62907 25.4364 7.09551 24.021 8.26162 24.021H40.4461C41.6122 24.021 42.7783 24.9646 43.0116 26.144L46.7431 45.0155L41.6122 46.1949Z"
448 fill="#D5DDEA"/>
449 <path d="M118.342 134.655C123.365 134.655 127.437 130.536 127.437 125.455C127.437 120.374 123.365 116.255 118.342 116.255C113.318 116.255 109.246 120.374 109.246 125.455C109.246 130.536 113.318 134.655 118.342 134.655Z"
450 fill="url(#paint0_linear_2971_9229)"/>
451 <path d="M54.2057 134.655C59.2291 134.655 63.3014 130.536 63.3014 125.455C63.3014 120.374 59.2291 116.255 54.2057 116.255C49.1824 116.255 45.1101 120.374 45.1101 125.455C45.1101 130.536 49.1824 134.655 54.2057 134.655Z"
452 fill="url(#paint1_linear_2971_9229)"/>
453 <path d="M53.4147 103.68L48.3865 104.713L52.6584 125.981L57.6867 124.948L53.4147 103.68Z"
454 fill="#D5DDEA"/>
455 <path d="M118.109 128.05H39.28C38.1139 128.05 36.9478 127.106 36.7146 125.927L31.1173 98.5629C30.884 97.1476 31.8169 95.7322 33.2162 95.4963C34.6156 95.2604 36.0149 96.204 36.2481 97.6194L41.379 122.86H118.342C119.741 122.86 120.907 124.039 120.907 125.455C120.907 126.87 119.741 128.05 118.109 128.05Z"
456 fill="#D5DDEA"/>
457 <path d="M38.8136 134.655C43.837 134.655 47.9093 130.536 47.9093 125.455C47.9093 120.374 43.837 116.255 38.8136 116.255C33.7903 116.255 29.718 120.374 29.718 125.455C29.718 130.536 33.7903 134.655 38.8136 134.655Z"
458 fill="url(#paint2_linear_2971_9229)"/>
459 <path d="M38.8135 129.937C41.2608 129.937 43.2447 127.93 43.2447 125.455C43.2447 122.98 41.2608 120.973 38.8135 120.973C36.3662 120.973 34.3823 122.98 34.3823 125.455C34.3823 127.93 36.3662 129.937 38.8135 129.937Z"
460 fill="#8691AA"/>
461 <path d="M102.949 134.655C107.973 134.655 112.045 130.536 112.045 125.455C112.045 120.374 107.973 116.255 102.949 116.255C97.9258 116.255 93.8535 120.374 93.8535 125.455C93.8535 130.536 97.9258 134.655 102.949 134.655Z"
462 fill="url(#paint3_linear_2971_9229)"/>
463 <path d="M102.949 129.937C105.397 129.937 107.38 127.93 107.38 125.455C107.38 122.98 105.397 120.973 102.949 120.973C100.502 120.973 98.5181 122.98 98.5181 125.455C98.5181 127.93 100.502 129.937 102.949 129.937Z"
464 fill="#8691AA"/>
465 <g filter="url(#filter0_d_2971_9229)">
466 <path d="M136.999 44.3079L127.437 99.7427C126.738 103.281 123.939 105.64 120.441 105.64H38.3469C34.8486 105.64 32.0499 103.281 31.3502 99.7427L20.6221 44.3079H136.999Z"
467 fill="url(#paint4_linear_2971_9229)"/>
468 </g>
469 <path d="M69.3652 98.0914C70.5313 98.0914 71.6974 97.1478 71.6974 95.7325V54.4512C71.6974 53.2717 70.7645 52.0923 69.3652 52.0923C68.1991 52.0923 67.033 53.0359 67.033 54.4512V95.7325C67.033 97.1478 67.9658 98.0914 69.3652 98.0914Z"
470 fill="#E7EAF4"/>
471 <path d="M81.2596 98.0914C82.4257 98.3272 83.5918 97.3837 83.8251 95.9683L87.7898 54.9229C88.023 53.7435 87.0902 52.564 85.6908 52.3281C84.5247 52.0922 83.3586 53.0358 83.1254 54.4512L79.1606 95.4965C79.1606 96.9119 79.8603 97.8555 81.2596 98.0914Z"
472 fill="#E7EAF4"/>
473 <path d="M93.3871 97.8554C94.5532 98.0913 95.7193 97.1477 95.9525 95.9682L103.416 55.3946C103.649 54.2152 102.716 53.0357 101.55 52.7998C100.384 52.5639 99.2176 53.5075 98.9844 54.687L91.7545 95.2606C91.2881 96.44 92.2209 97.6195 93.3871 97.8554Z"
474 fill="#E7EAF4"/>
475 <path d="M57.2378 98.0914C56.0717 98.3272 54.9056 97.3837 54.6723 95.9683L50.7076 54.9229C50.4744 53.7435 51.4073 52.564 52.8066 52.3281C53.9727 52.0922 55.1388 53.0358 55.372 54.4512L59.3368 95.4965C59.3368 96.9119 58.6371 97.8555 57.2378 98.0914Z"
476 fill="#E7EAF4"/>
477 <path d="M45.1104 97.8554C43.9443 98.0913 42.7782 97.1477 42.5449 95.9682L35.0819 55.3946C34.8487 54.2152 35.7815 53.0357 36.9476 52.7998C38.1137 52.5639 39.2799 53.5075 39.5131 54.687L46.7429 95.2606C47.2094 96.44 46.2765 97.6195 45.1104 97.8554Z"
478 fill="#E7EAF4"/>
479 <path d="M137 44.3069L127.438 99.7417C126.738 103.28 123.94 105.639 120.441 105.639H98.7517C102.716 105.639 105.982 102.808 106.681 99.0341L116.71 44.3069H137Z"
480 fill="#DBDFEC"/>
481 <defs>
482 <filter id="filter0_d_2971_9229" x="0.62207" y="35.3079" width="156.377" height="101.332"
483 filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
484 <feFlood flood-opacity="0" result="BackgroundImageFix"/>
485 <feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"
486 result="hardAlpha"/>
487 <feOffset dy="11"/>
488 <feGaussianBlur stdDeviation="10"/>
489 <feColorMatrix type="matrix"
490 values="0 0 0 0 0.397708 0 0 0 0 0.47749 0 0 0 0 0.575 0 0 0 0.27 0"/>
491 <feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_2971_9229"/>
492 <feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_2971_9229" result="shape"/>
493 </filter>
494 <linearGradient id="paint0_linear_2971_9229" x1="109.238" y1="125.457" x2="127.441" y2="125.457"
495 gradientUnits="userSpaceOnUse">
496 <stop stop-color="#B0BACC"/>
497 <stop offset="1" stop-color="#969EAE"/>
498 </linearGradient>
499 <linearGradient id="paint1_linear_2971_9229" x1="45.1018" y1="125.457" x2="63.3047" y2="125.457"
500 gradientUnits="userSpaceOnUse">
501 <stop stop-color="#B0BACC"/>
502 <stop offset="1" stop-color="#969EAE"/>
503 </linearGradient>
504 <linearGradient id="paint2_linear_2971_9229" x1="29.7097" y1="125.457" x2="47.9126" y2="125.457"
505 gradientUnits="userSpaceOnUse">
506 <stop stop-color="#B0BACC"/>
507 <stop offset="1" stop-color="#969EAE"/>
508 </linearGradient>
509 <linearGradient id="paint3_linear_2971_9229" x1="93.8452" y1="125.457" x2="112.048" y2="125.457"
510 gradientUnits="userSpaceOnUse">
511 <stop stop-color="#B0BACC"/>
512 <stop offset="1" stop-color="#969EAE"/>
513 </linearGradient>
514 <linearGradient id="paint4_linear_2971_9229" x1="78.7728" y1="42.8892" x2="78.7728" y2="106.301"
515 gradientUnits="userSpaceOnUse">
516 <stop stop-color="#FDFEFF"/>
517 <stop offset="0.9964" stop-color="#ECF0F5"/>
518 </linearGradient>
519 </defs>
520 </svg>
521 <?php }
522
523
524 public function renderEmpty($emptyMessage = null, $continueShoppingUrl = null, $continueShoppingLabel = null, $continueShoppingAriaLabel = null)
525 {
526 $emptyMessage ??= __('Your cart is empty.', 'fluent-cart');
527 ?>
528
529 <div
530 class="fluent-cart-cart-empty-content"
531 role="region"
532 aria-label="<?php echo esc_attr($emptyMessage); ?>"
533 >
534
535
536 <?php
537 $this->renderEmptyCartIcon();
538 $this->renderEmptyCart(
539 $emptyMessage,
540 $continueShoppingUrl,
541 $continueShoppingLabel,
542 $continueShoppingAriaLabel
543 ); ?>
544 </div>
545
546 <?php
547
548 }
549
550 public function renderEmptyCart(
551 $emptyMessage = null,
552 $continueShoppingUrl = null,
553 $continueShoppingLabel = null,
554 $continueShoppingAriaLabel = null
555 )
556 {
557 $emptyMessage ??= __('Your cart is empty.', 'fluent-cart');
558 $continueShoppingUrl ??= $this->storeSettings->getShopPage();
559 $continueShoppingLabel ??= __('Continue Shopping', 'fluent-cart');
560 $continueShoppingAriaLabel ??= __('Browse products and continue shopping', 'fluent-cart');
561 ?>
562 <div class="fluent-cart-cart-empty-content-text">
563 <?php echo esc_html($emptyMessage); ?>
564
565 <?php if ($continueShoppingUrl) : ?>
566
567 <a class="continue-shopping-link"
568 href="<?php echo esc_url($continueShoppingUrl); ?>"
569 aria-label="<?php echo esc_attr($continueShoppingAriaLabel); ?>">
570 <?php echo esc_html($continueShoppingLabel); ?>
571 </a>
572
573 <?php endif; ?>
574 </div>
575 <?php }
576
577
578 }
579