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

628 lines 25.9 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\AttributeHelper;
10 use FluentCart\App\Helpers\CartCheckoutHelper;
11 use FluentCart\App\Models\Product;
12
13 class CartRenderer
14 {
15 protected $cartItems;
16 protected $storeSettings;
17
18 protected $currentCartItem = [];
19 protected $url = [];
20
21 protected $product = [];
22
23
24 public function __construct($cartItems = [])
25 {
26 $this->storeSettings = new StoreSettings();
27 $this->cartItems = $cartItems;
28 $this->cartItems = Helper::loadBundleChild($this->cartItems, ['*']);
29 }
30
31 public function render()
32 {
33
34 ?>
35
36 <section class="fct-cart-page" aria-labelledby="fct-cart-page-title" role="region">
37 <h2 id="fct-cart-page-title" class="screen-reader-text">
38 <?php esc_html_e('Your Shopping Cart', 'fluent-cart'); ?>
39 </h2>
40
41 <?php $this->renderItems(); ?>
42
43 <?php $this->renderTotal(); ?>
44
45 <div class="fluent-cart-cart-cart-button-wrap" data-fluent-cart-cart-checkout-button-wrap>
46 <?php $this->renderCheckoutButton(); ?>
47 </div>
48
49
50 </section>
51
52 <?php
53 }
54
55
56 public function renderItems()
57 {
58 ?>
59
60 <div class="fct-cart-drawer-content-wrapper" data-fluent-cart-cart-content-wrapper role="presentation">
61 <?php $this->renderList(); ?>
62 </div>
63
64 <?php
65
66 }
67
68 public function renderDummyItems()
69 {
70 $dummy = [
71 [
72 'id' => 0,
73 'post_id' => 0,
74 'fulfillment_type' => '',
75 'other_info' => [
76 'payment_type' => '',
77 ],
78 'quantity' => 0,
79 'price' => 0,
80 'unit_price' => 0,
81 'line_total' => 0,
82 'subtotal' => 0,
83 'line_total_formatted' => '&#36;0',
84 'object_id' => 0,
85 'title' => '',
86 'post_title' => '',
87 'coupon_discount' => 0,
88 'cost' => 0,
89 'featured_media' => '',
90 'view_url' => '',
91 'variation_type' => '',
92 'shipping_charge' => 0,
93 'itemwise_shipping_charge' => 0,
94 ]
95 ];
96
97 $this->renderList($dummy);
98 }
99
100 public function renderList($items = [])
101 {
102 $items = empty($items) ? $this->cartItems : $items;
103
104
105 ?>
106 <div class="fct-cart-drawer-list" data-fluent-cart-cart-list>
107 <?php if (!empty($items)) { ?>
108 <ul class="fct-cart-drawer-list-content" data-fluent-cart-items-wrapper role="list">
109 <?php
110 foreach ($items as $cartItem) {
111 $this->currentCartItem = $cartItem;
112 $this->url = Arr::get($cartItem, 'view_url', '');
113 $this->renderItem();
114 }
115 ?>
116 </ul>
117 <?php } else { ?>
118 <?php $this->renderEmpty(); ?>
119 <?php } ?>
120 </div>
121 <?php
122
123 }
124
125 public function renderItem()
126 {
127 $title = Arr::get($this->currentCartItem, 'title', '');
128
129 ?>
130 <li data-cart-items class="fct-cart-item" role="listitem"
131 aria-label="<?php echo esc_attr($title); ?>">
132 <div class="fct-cart-item-info">
133 <?php $this->renderImage(); ?>
134 <?php $this->renderDetails(); ?>
135 </div>
136 <?php $this->renderSummary(); ?>
137 </li>
138
139 <?php
140 }
141
142 public function renderImage()
143 {
144 $image = Arr::get($this->currentCartItem, 'featured_media');
145 $title = Arr::get($this->currentCartItem, 'title', __('Product Image', 'fluent-cart'));
146
147 if (!$image) {
148 $image = Vite::getAssetUrl('images/placeholder.svg');
149 }
150
151 ?>
152
153 <div class="fct-cart-item-image">
154 <a href="<?php echo esc_url($this->url); ?>">
155 <img src="<?php echo esc_url($image); ?>"
156 data-fluent-cart-cart-list-item-image
157 alt="<?php echo esc_attr($title); ?>"
158 loading="lazy"
159 />
160 </a>
161
162 </div>
163
164 <?php
165 }
166
167 protected function getEventInfo()
168 {
169 return [
170 'item' => $this->currentCartItem,
171 'cart' => null,
172 'product' => $this->product,
173 'variant' => null,
174 ];
175 }
176
177 public function renderDetails()
178 {
179 ?>
180
181 <div class="fct-cart-item-details" role="group"
182 aria-label="<?php esc_attr_e('Product Details', 'fluent-cart'); ?>">
183 <?php
184 $this->renderTitles();
185 $this->renderItemPrice();
186 $this->renderQuantity();
187 (new CartItemRenderer($this->currentCartItem))->renderChildVariants();
188 do_action('fluent_cart/cart/line_item/line_meta', $this->getEventInfo());
189 ?>
190
191 </div>
192
193 <?php
194 }
195
196
197
198 public function renderTitles()
199 {
200 $postTitle = Arr::get($this->currentCartItem, 'post_title', '');
201 $variationTitle = Arr::get($this->currentCartItem, 'title', '');
202 $variationType = Arr::get($this->currentCartItem, 'variation_type', 'simple');
203
204 // Prefer the labeled attribute combination when the item has a snapshot.
205 $itemAttributes = (array) Arr::get($this->currentCartItem, 'other_info.item_attributes', []);
206 if ($itemAttributes) {
207 $attributesText = AttributeHelper::getDisplayAttributesString($itemAttributes, $this->currentCartItem, 'cart');
208 if ($attributesText !== '') {
209 $variationTitle = $attributesText;
210 }
211 }
212
213 $aria_label = sprintf(
214 /* translators: 1: Post or product title */
215 esc_attr__('View %1$s', 'fluent-cart'),
216 esc_attr($postTitle)
217 );
218
219
220 ?>
221
222 <h3 class="fct-cart-item-title" data-fluent-cart-cart-list-item-title>
223 <a href="<?php echo esc_url($this->url); ?>"
224 aria-label="<?php echo esc_attr($aria_label); ?>"
225 data-fluent-cart-cart-list-item-title-url>
226 <span data-fluent-cart-cart-list-item-title-element>
227 <?php echo esc_html($postTitle); ?>
228 </span>
229 </a>
230 </h3>
231
232 <p class="fct-cart-item-variant <?php echo $variationType === 'simple' ? 'variant-title-hidden' : ''?>"
233 data-fluent-cart-cart-list-item-variation-title>
234 - <?php echo esc_html($variationTitle); ?>
235 </p>
236
237 <?php
238 }
239
240 public function renderItemPrice()
241 {
242 $price = Helper::toDecimal(Arr::get(
243 $this->currentCartItem,
244 'line_meta.original_unit_price',
245 Arr::get($this->currentCartItem, 'unit_price', 0)
246 ));
247 $quantity = Arr::get($this->currentCartItem, 'quantity', 1);
248
249 ?>
250 <div class="fct-cart-item-price <?php echo $quantity <= 1 ? 'item-price-hidden' : '' ?>">
251 <span><?php esc_html_e('Unit Price:', 'fluent-cart'); ?></span>
252 <span data-fluent-cart-cart-list-item-price aria-live="polite">
253 <?php echo esc_html($price); ?>
254 </span>
255 </div>
256
257 <?php
258 }
259
260 public function renderQuantity()
261 {
262 $quantity = Arr::get($this->currentCartItem, 'quantity', 0);
263
264 $productId = Arr::get($this->currentCartItem, 'post_id');
265 $this->product = Product::query()->with(['detail'])->find($productId);
266 $soldIndividually = false;
267 if ($this->product) {
268 $soldIndividually = $this->product->soldIndividually();
269 }
270
271 if ($soldIndividually) {
272 return;
273 }
274
275 ?>
276
277 <div class="fct-cart-item-quantity"
278 data-fluent-cart-cart-list-item-quantity-wrapper
279 role="group"
280 aria-label="<?php esc_attr_e('Change Quantity', 'fluent-cart'); ?>"
281 >
282
283 <button
284 class="qty-btn decrease-btn"
285 data-item-id="<?php echo esc_attr($this->currentCartItem['object_id']); ?>"
286 data-fluent-cart-cart-list-item-decrease-button
287 title="<?php esc_attr_e('Decrease Quantity', 'fluent-cart'); ?>"
288 aria-label="<?php esc_attr_e('Decrease Quantity', 'fluent-cart'); ?>"
289 >
290 <svg xmlns="http://www.w3.org/2000/svg" width="12" height="2" viewBox="0 0 12 2" fill="none">
291 <path d="M11.3333 1L0.666662 1" stroke="currentColor" stroke-linecap="round"
292 stroke-linejoin="round"/>
293 </svg>
294 </button>
295
296 <input
297 class="qty-value"
298 min="1"
299 data-item-id="<?php echo esc_attr($this->currentCartItem['object_id']); ?>"
300 data-fluent-cart-cart-list-item-quantity-input
301 value="<?php echo esc_attr($quantity); ?>"
302 aria-label="<?php esc_attr_e('Product Quantity', 'fluent-cart'); ?>"
303 aria-live="polite"
304 />
305
306 <button
307 class="qty-btn increase-btn"
308 data-fluent-cart-cart-list-item-increase-button
309 data-item-id="<?php echo esc_attr($this->currentCartItem['object_id']); ?>"
310 title="<?php esc_attr_e('Increase Quantity', 'fluent-cart'); ?>"
311 aria-label="<?php esc_attr_e('Increase Quantity', 'fluent-cart'); ?>"
312 >
313 <svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12" fill="none">
314 <path d="M6 0.666748L6 11.3334M11.3333 6.00008L0.666672 6.00008" stroke="currentColor"
315 stroke-linecap="round" stroke-linejoin="round"></path>
316 </svg>
317 </button>
318 </div>
319
320 <?php
321 }
322
323
324 public function renderSummary()
325 {
326 ?>
327 <div class="fct-cart-item-summary" role="group"
328 aria-label="<?php esc_attr_e('Cart Item Summary', 'fluent-cart'); ?>">
329 <?php $this->renderItemTotal(); ?>
330 <?php $this->renderRemove(); ?>
331 </div>
332
333 <?php
334 }
335
336 public function renderItemTotal()
337 {
338 $quantity = Arr::get($this->currentCartItem, 'quantity', 0);
339 $displayUnitPrice = Arr::get(
340 $this->currentCartItem,
341 'line_meta.original_unit_price',
342 Arr::get($this->currentCartItem, 'unit_price', 0)
343 );
344 $totalPrice = $displayUnitPrice * $quantity;
345
346 if (Arr::get($this->currentCartItem, 'other_info.payment_type', 'onetime') == 'subscription') {
347 if (Arr::get($this->currentCartItem, 'other_info.manage_setup_fee') == 'yes') {
348 $signupFee = Arr::get($this->currentCartItem, 'other_info.signup_fee', 0);
349
350 if (Arr::get($this->currentCartItem, 'other_info.setup_fee_per_item', 'no') == 'yes') {
351 $signupFee = Arr::get($this->currentCartItem, 'other_info.signup_fee', 0) * $quantity;
352 }
353
354 $totalPrice += $signupFee;
355 }
356 }
357
358 $totalPrice = Helper::toDecimal($totalPrice);
359 $aria_label = sprintf(
360 /* translators: 1: Total price */
361 __('Total price for this item: %1$s', 'fluent-cart'),
362 $totalPrice
363 );
364
365 ?>
366 <div class="fct-cart-item-total">
367 <span
368 data-fluent-cart-cart-list-item-total-price
369 aria-live="polite"
370 aria-label="<?php echo esc_attr($aria_label); ?>"
371 >
372 <?php echo esc_html($totalPrice); ?>
373 </span>
374 </div>
375
376 <?php
377 }
378
379 public function renderTotal()
380 {
381 $cartItems = CartCheckoutHelper::make()->getItems();
382 $grossTotal = 0;
383 foreach ($cartItems as $item) {
384 $paymentType = Arr::get($item, 'other_info.payment_type', '');
385 $qty = max(1, (int) Arr::get($item, 'quantity', 1));
386 $displayUnitPrice = (int) Arr::get(
387 $item,
388 'line_meta.original_unit_price',
389 Arr::get($item, 'unit_price', 0)
390 );
391 if ($paymentType === 'subscription') {
392 if ((int) Arr::get($item, 'other_info.trial_days', 0) > 0) {
393 $grossTotal += (int) Arr::get($item, 'other_info.signup_fee', 0);
394 } else {
395 $grossTotal += $displayUnitPrice * $qty + (int) Arr::get($item, 'other_info.signup_fee', 0);
396 }
397 } else {
398 $grossTotal += $displayUnitPrice * $qty;
399 }
400 }
401 $subtotal = Helper::toDecimal($grossTotal);
402 $aria_label = sprintf(
403 /* translators: 1: Total price */
404 __('Total cart price: %1$s', 'fluent-cart'),
405 esc_attr($subtotal)
406 );
407 ?>
408
409 <div
410 data-fluent-cart-cart-total-wrapper
411 class="fct-cart-total-wrapper"
412 role="region"
413 aria-label="<?php esc_attr_e('Cart Total', 'fluent-cart'); ?>"
414 >
415 <span><?php echo esc_html__('Total', 'fluent-cart'); ?>:</span>
416 <span
417 data-fluent-cart-cart-total-price
418 aria-live="polite"
419 aria-label="<?php echo esc_attr($aria_label); ?>"
420 >
421 <?php echo esc_html($subtotal); ?>
422 </span>
423 </div>
424
425 <?php
426
427 }
428
429 public function renderRemove()
430 {
431
432 ?>
433 <div class="fct-cart-item-remove">
434 <button
435 type="button"
436 class="fct-cart-item-delete-button"
437 data-fluent-cart-cart-list-item-delete-button
438 data-item-id="<?php echo esc_attr($this->currentCartItem['object_id']); ?>"
439 aria-label="<?php esc_attr_e('Remove this item from cart', 'fluent-cart'); ?>"
440 title="<?php esc_attr_e('Remove From Cart', 'fluent-cart'); ?>"
441 >
442 <svg xmlns="http://www.w3.org/2000/svg" width="14" height="16" viewBox="0 0 14 16" fill="none">
443 <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"
444 stroke="currentColor" stroke-linecap="round"></path>
445 <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"
446 stroke="currentColor" stroke-linecap="round"></path>
447 <path d="M5.33334 11L5.33334 7" stroke="currentColor" stroke-linecap="round"></path>
448 <path d="M8.66666 11L8.66666 7" stroke="currentColor" stroke-linecap="round"></path>
449 </svg>
450 </button>
451 </div>
452
453 <?php
454 }
455
456 public function renderCheckoutButton()
457 {
458 ?>
459
460 <a class="checkout-button"
461 href="<?php echo esc_attr($this->storeSettings->getCheckoutPage()); ?>"
462 role="button"
463 aria-label="<?php esc_attr_e('Go to checkout page', 'fluent-cart'); ?>">
464 <?php esc_html_e('Go to Checkout', 'fluent-cart'); ?>
465 </a>
466
467 <?php
468
469 }
470
471 public function renderViewCartButton()
472 {
473 return;
474 ?>
475
476 <a class="view-cart-button"
477 href="<?php echo esc_attr($this->storeSettings->getCartPage()); ?>"
478 role="button"
479 aria-label="<?php esc_attr_e('View your shopping cart', 'fluent-cart'); ?>">
480 <?php esc_html_e('View Cart', 'fluent-cart'); ?>
481 </a>
482
483 <?php
484
485 }
486
487 public function renderEmptyCartIcon()
488 { ?>
489 <svg xmlns="http://www.w3.org/2000/svg" width="157" height="137" viewBox="0 0 157 137" fill="none">
490 <path d="M21.5017 135H134.91" stroke="#D6DCE8" stroke-width="2" stroke-miterlimit="10"
491 stroke-linejoin="round"/>
492 <path d="M8.60278 135H18.2925" stroke="#D6DCE8" stroke-width="2" stroke-miterlimit="10"
493 stroke-linejoin="round"/>
494 <path d="M23.1192 26.0612L18.0879 27.0789L21.8382 46.0468L26.8695 45.0291L23.1192 26.0612Z"
495 fill="#D5DDEA"/>
496 <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"
497 fill="#D5DDEA"/>
498 <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"
499 fill="url(#paint0_linear_2971_9229)"/>
500 <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"
501 fill="url(#paint1_linear_2971_9229)"/>
502 <path d="M53.4147 103.68L48.3865 104.713L52.6584 125.981L57.6867 124.948L53.4147 103.68Z"
503 fill="#D5DDEA"/>
504 <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"
505 fill="#D5DDEA"/>
506 <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"
507 fill="url(#paint2_linear_2971_9229)"/>
508 <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"
509 fill="#8691AA"/>
510 <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"
511 fill="url(#paint3_linear_2971_9229)"/>
512 <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"
513 fill="#8691AA"/>
514 <g filter="url(#filter0_d_2971_9229)">
515 <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"
516 fill="url(#paint4_linear_2971_9229)"/>
517 </g>
518 <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"
519 fill="#E7EAF4"/>
520 <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"
521 fill="#E7EAF4"/>
522 <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"
523 fill="#E7EAF4"/>
524 <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"
525 fill="#E7EAF4"/>
526 <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"
527 fill="#E7EAF4"/>
528 <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"
529 fill="#DBDFEC"/>
530 <defs>
531 <filter id="filter0_d_2971_9229" x="0.62207" y="35.3079" width="156.377" height="101.332"
532 filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
533 <feFlood flood-opacity="0" result="BackgroundImageFix"/>
534 <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"
535 result="hardAlpha"/>
536 <feOffset dy="11"/>
537 <feGaussianBlur stdDeviation="10"/>
538 <feColorMatrix type="matrix"
539 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"/>
540 <feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_2971_9229"/>
541 <feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_2971_9229" result="shape"/>
542 </filter>
543 <linearGradient id="paint0_linear_2971_9229" x1="109.238" y1="125.457" x2="127.441" y2="125.457"
544 gradientUnits="userSpaceOnUse">
545 <stop stop-color="#B0BACC"/>
546 <stop offset="1" stop-color="#969EAE"/>
547 </linearGradient>
548 <linearGradient id="paint1_linear_2971_9229" x1="45.1018" y1="125.457" x2="63.3047" y2="125.457"
549 gradientUnits="userSpaceOnUse">
550 <stop stop-color="#B0BACC"/>
551 <stop offset="1" stop-color="#969EAE"/>
552 </linearGradient>
553 <linearGradient id="paint2_linear_2971_9229" x1="29.7097" y1="125.457" x2="47.9126" y2="125.457"
554 gradientUnits="userSpaceOnUse">
555 <stop stop-color="#B0BACC"/>
556 <stop offset="1" stop-color="#969EAE"/>
557 </linearGradient>
558 <linearGradient id="paint3_linear_2971_9229" x1="93.8452" y1="125.457" x2="112.048" y2="125.457"
559 gradientUnits="userSpaceOnUse">
560 <stop stop-color="#B0BACC"/>
561 <stop offset="1" stop-color="#969EAE"/>
562 </linearGradient>
563 <linearGradient id="paint4_linear_2971_9229" x1="78.7728" y1="42.8892" x2="78.7728" y2="106.301"
564 gradientUnits="userSpaceOnUse">
565 <stop stop-color="#FDFEFF"/>
566 <stop offset="0.9964" stop-color="#ECF0F5"/>
567 </linearGradient>
568 </defs>
569 </svg>
570 <?php }
571
572
573 public function renderEmpty($emptyMessage = null, $continueShoppingUrl = null, $continueShoppingLabel = null, $continueShoppingAriaLabel = null)
574 {
575 $emptyMessage ??= __('Your cart is empty.', 'fluent-cart');
576 ?>
577
578 <div
579 class="fluent-cart-cart-empty-content"
580 role="region"
581 aria-label="<?php echo esc_attr($emptyMessage); ?>"
582 >
583
584
585 <?php
586 $this->renderEmptyCartIcon();
587 $this->renderEmptyCart(
588 $emptyMessage,
589 $continueShoppingUrl,
590 $continueShoppingLabel,
591 $continueShoppingAriaLabel
592 ); ?>
593 </div>
594
595 <?php
596
597 }
598
599 public function renderEmptyCart(
600 $emptyMessage = null,
601 $continueShoppingUrl = null,
602 $continueShoppingLabel = null,
603 $continueShoppingAriaLabel = null
604 )
605 {
606 $emptyMessage ??= __('Your cart is empty.', 'fluent-cart');
607 $continueShoppingUrl ??= $this->storeSettings->getShopPage();
608 $continueShoppingLabel ??= __('Continue Shopping', 'fluent-cart');
609 $continueShoppingAriaLabel ??= __('Browse products and continue shopping', 'fluent-cart');
610 ?>
611 <div class="fluent-cart-cart-empty-content-text">
612 <?php echo esc_html($emptyMessage); ?>
613
614 <?php if ($continueShoppingUrl) : ?>
615
616 <a class="continue-shopping-link"
617 href="<?php echo esc_url($continueShoppingUrl); ?>"
618 aria-label="<?php echo esc_attr($continueShoppingAriaLabel); ?>">
619 <?php echo esc_html($continueShoppingLabel); ?>
620 </a>
621
622 <?php endif; ?>
623 </div>
624 <?php }
625
626
627 }
628