PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / 1.7.1
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler v1.7.1
1.7.1 1.7.0 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 All 51 releases
← All changes | app/Services/Renderer/Receipt/ThankYouRender.php +98 -34 1.5.3 → 1.7.1 View file →
@@ -4,8 +4,9 @@
4 4
5 5 use FluentCart\Api\StoreSettings;
6 6 use FluentCart\App\App;
7 7 use FluentCart\App\Helpers\Helper;
8 +use FluentCart\App\Helpers\Status;
8 9 use FluentCart\App\Modules\Tax\TaxModule;
9 10 use FluentCart\App\Modules\Templating\AssetLoader;
10 11 use FluentCart\App\Vite;
11 12 use FluentCart\Framework\Support\Arr;
@@ -105,47 +106,79 @@
105 106 ]);
106 107 }
107 108 }
108 109
110 + protected function getHeaderState()
111 + {
112 + $order = Arr::get($this->config, 'order', null);
113 + $status = $order ? $order->payment_status : '';
114 +
115 + if ($status === Status::PAYMENT_REFUNDED) {
116 + return 'refunded';
117 + }
118 + if ($status === Status::PAYMENT_FAILED) {
119 + return 'failed';
120 + }
121 + if (in_array($status, [Status::PAYMENT_PAID, Status::PAYMENT_PARTIALLY_REFUNDED], true)) {
122 + return 'success';
123 + }
124 +
125 + return 'pending';
126 + }
127 +
109 128 public function renderHeader()
110 129 {
111 - $bgColor = '#d4edda';
112 - $titleColor = '#155724';
113 - $iconBg = '#155724bd';
130 + $state = $this->getHeaderState();
114 131
115 - $order = Arr::get($this->config, 'order', null);
132 + $styles = [
133 + 'success' => ['bg' => '#d4edda', 'title' => '#155724', 'iconBg' => '#155724bd'],
134 + 'pending' => ['bg' => '#fff3cd', 'title' => '#856404', 'iconBg' => '#856404bd'],
135 + 'failed' => ['bg' => '#f8d7da', 'title' => '#721c24', 'iconBg' => '#721c24bd'],
136 + 'refunded' => ['bg' => '#e2e3e5', 'title' => '#383d41', 'iconBg' => '#383d41bd'],
137 + ];
116 138
117 - if ($order->payment_status !== 'paid') {
118 - $bgColor = '#fff3cd';
119 - $titleColor = '#856404';
120 - $iconBg = '#856404bd';
121 - }
139 + $titles = [
140 + 'success' => __('Purchase Successful!', 'fluent-cart'),
141 + 'pending' => __('Payment Pending!', 'fluent-cart'),
142 + 'failed' => __('Payment Failed', 'fluent-cart'),
143 + 'refunded' => __('Order Refunded', 'fluent-cart'),
144 + ];
145 +
146 + $bgColor = $styles[$state]['bg'];
147 + $titleColor = $styles[$state]['title'];
148 + $iconBg = $styles[$state]['iconBg'];
122 149 ?>
123 150 <div class="fct-thank-you-page-header" style="background: <?php echo esc_attr($bgColor); ?>;">
124 - <?php if ($order->payment_status !== 'paid') : ?>
125 - <div class="fct-thank-you-page-header-icon" style="background: <?php echo esc_attr($iconBg); ?>;">
151 + <div class="fct-thank-you-page-header-icon" style="background: <?php echo esc_attr($iconBg); ?>;">
152 + <?php if ($state === 'success') : ?>
153 + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor"
154 + stroke-width="3" stroke-linecap="round" stroke-linejoin="round">
155 + <polyline points="20,6 9,17 4,12"></polyline>
156 + </svg>
157 + <?php elseif ($state === 'failed') : ?>
158 + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor"
159 + stroke-width="3" stroke-linecap="round" stroke-linejoin="round">
160 + <line x1="18" y1="6" x2="6" y2="18"></line>
161 + <line x1="6" y1="6" x2="18" y2="18"></line>
162 + </svg>
163 + <?php elseif ($state === 'refunded') : ?>
164 + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor"
165 + stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
166 + <polyline points="9,14 4,9 9,4"></polyline>
167 + <path d="M4 9h10a6 6 0 0 1 0 12h-3"></path>
168 + </svg>
169 + <?php else : ?>
126 170 <svg class="w-64 h-64" xmlns="http://www.w3.org/2000/svg"
127 171 viewBox="0 0 1024 1024" fill="currentColor">
128 172 <path
129 173 d="M480 674V192c0-18 14-32 32-32s32 14 32 32v482h-64zm0 63h64v60h-64v-60zM0 512C0 229 229 0 512 0s512 229 512 512-229 512-512 512S0 795 0 512zm961 0c0-247-202-448-449-448S64 265 64 512s201 448 448 448 449-201 449-448z"></path>
130 174 </svg>
131 - </div>
132 - <h1 class="fct-thank-you-page-header-title" style="color:<?php echo esc_attr($titleColor); ?>">
133 - <?php echo esc_html__('Payment Pending!', 'fluent-cart'); ?>
134 - </h1>
175 + <?php endif; ?>
176 + </div>
177 + <h1 class="fct-thank-you-page-header-title" style="color:<?php echo esc_attr($titleColor); ?>;">
178 + <?php echo esc_html($titles[$state]); ?>
179 + </h1>
135 180
136 - <?php else: ?>
137 - <div class="fct-thank-you-page-header-icon" style="background: <?php echo esc_attr($iconBg); ?>;">
138 - <svg viewBox="0 0 24 24" fill="none" stroke="currentColor"
139 - stroke-width="3" stroke-linecap="round" stroke-linejoin="round">
140 - <polyline points="20,6 9,17 4,12"></polyline>
141 - </svg>
142 - </div>
143 - <h1 class="fct-thank-you-page-header-title" style="color:<?php echo esc_attr($titleColor); ?>;">
144 - <?php echo esc_html__('Purchase Successful!', 'fluent-cart'); ?>
145 - </h1>
146 - <?php endif; ?>
147 -
148 181 <?php do_action('fluent_cart/receipt/thank_you/after_header_title', $this->config); ?>
149 182
150 183 </div>
151 184
@@ -206,9 +239,10 @@
206 239 esc_html($order->customer->full_name)
207 240 );
208 241 ?>
209 242 </div>
210 - <?php if ($order->payment_status === 'paid') : ?>
243 + <?php $state = $this->getHeaderState(); ?>
244 + <?php if ($state === 'success') : ?>
211 245 <p>
212 246 <?php
213 247 printf(
214 248 '%s<strong style="color: #007bff;"><a href="%s">#%s</a></strong>%s',
@@ -218,8 +252,34 @@
218 252 esc_html__(' has been placed successfully.', 'fluent-cart')
219 253 );
220 254 ?>
221 255 </p>
256 + <?php elseif ($state === 'refunded') : ?>
257 + <p>
258 + <?php
259 + printf(
260 + '%s<strong style="color: #007bff;"><a href="%s">#%s</a></strong>%s',
261 + esc_html__('Your order ', 'fluent-cart'),
262 + esc_url($profilePage . 'order/' . $order->uuid),
263 + esc_html($order->invoice_no),
264 + esc_html__(' has been refunded.', 'fluent-cart')
265 + );
266 + ?>
267 + </p>
268 + <?php elseif ($state === 'failed') : ?>
269 + <p>
270 + <?php
271 + printf(
272 + '%s<strong style="color: #007bff;"><a href="%s">#%s</a></strong>%s <a style="color: #007bff;" target="_blank" href="%s">%s</a>.',
273 + esc_html__('The payment for your order ', 'fluent-cart'),
274 + esc_url($profilePage . 'order/' . $order->uuid),
275 + esc_html($order->invoice_no),
276 + esc_html__(' could not be completed. You can try again from', 'fluent-cart'),
277 + esc_url(\FluentCart\App\Services\Payments\PaymentHelper::getCustomPaymentLink($order->uuid)),
278 + esc_html__('here', 'fluent-cart')
279 + );
280 + ?>
281 + </p>
222 282 <?php else: ?>
223 283 <p>
224 284
225 285 <?php
@@ -380,9 +440,9 @@
380 440
381 441 if (!empty($thankYouPageInstructions)) : ?>
382 442
383 443 <div style="max-width: 620px; margin: 15px auto 0; font-family: Arial, Helvetica, sans-serif;">
384 - <div style="font-size: 14px; color: #2F3448; padding: 12px 0; border-top: 1px solid #e7eaee;">
444 + <div style="font-size: 14px; color: var(--fct-primary-text-color, currentColor); padding: 12px 0; border-top: 1px solid var(--fct-divider-color, #e7eaee);">
385 445 <?php echo wp_kses_post($thankYouPageInstructions); ?>
386 446 </div>
387 447 </div>
388 448 <?php endif;
@@ -449,12 +509,12 @@
449 509 </div>
450 510 </div>
451 511 <?php if ($prorateCredit > 0 && $upgradeDiscount > 0): ?>
452 512 <div class="fct-meta-line" style="padding-left:12px;">
453 - <div class="fct-meta-line-label" style="font-size:12px;color:rgb(107,114,128);">
513 + <div class="fct-meta-line-label" style="font-size:12px;color:var(--fct-secondary-text-color, rgb(107,114,128));">
454 514 <?php echo esc_html__('Upgrade Discount', 'fluent-cart'); ?>
455 515 </div>
456 - <div class="fct-meta-line-value" style="font-size:12px;color:rgb(107,114,128);">
516 + <div class="fct-meta-line-value" style="font-size:12px;color:var(--fct-secondary-text-color, rgb(107,114,128));">
457 517 <?php echo esc_html(Helper::toDecimal($upgradeDiscount)); ?>
458 518 </div>
459 519 </div>
460 520 <?php endif; ?>
@@ -459,12 +519,12 @@
459 519 </div>
460 520 <?php endif; ?>
461 521 <?php if ($prorateCredit > 0 && !$onlyProrateCredit): ?>
462 522 <div class="fct-meta-line" style="padding-left:12px;">
463 - <div class="fct-meta-line-label" style="font-size:12px;color:rgb(107,114,128);">
523 + <div class="fct-meta-line-label" style="font-size:12px;color:var(--fct-secondary-text-color, rgb(107,114,128));">
464 524 <?php echo esc_html__('Prorate Credit', 'fluent-cart'); ?>
465 525 </div>
466 - <div class="fct-meta-line-value" style="font-size:12px;color:rgb(107,114,128);">
526 + <div class="fct-meta-line-value" style="font-size:12px;color:var(--fct-secondary-text-color, rgb(107,114,128));">
467 527 <?php echo esc_html(Helper::toDecimal($prorateCredit)); ?>
468 528 </div>
469 529 </div>
470 530 <?php endif; ?>
@@ -489,12 +549,16 @@
489 549 if ($rcAdj > 0) {
490 550 $displayShipping = max(0, $displayShipping - $rcAdj);
491 551 }
492 552 }
553 + $shippingMethodTitle = (string) Arr::get($order->config, 'shipping_method_title', '');
493 554 ?>
494 555 <div class="fct-meta-line fct-thank-you-page-order-items-total-shipping">
495 556 <div class="fct-meta-line-label fct-thank-you-page-order-items-total-label">
496 557 <?php echo esc_html__('Shipping', 'fluent-cart'); ?>
558 + <?php if ($shippingMethodTitle): ?>
559 + <span class="fct-shipping-method-name"><?php echo esc_html($shippingMethodTitle); ?></span>
560 + <?php endif; ?>
497 561 </div>
498 562 <div class="fct-meta-line-value fct-thank-you-page-order-items-total-value"><?php echo esc_html(Helper::toDecimal($displayShipping)); ?></div>
499 563 </div>
500 564 <?php
@@ -617,9 +681,9 @@
617 681 echo sprintf(
618 682 /* translators: 1: Next billing date */
619 683 esc_html__('- Auto renews on %1$s', 'fluent-cart'),
620 684 esc_html(
621 - \FluentCart\App\Services\DateTime\DateTime::gmtToTimezone($subs->next_billing_date)->format('M d, Y h:i A')
685 + \FluentCart\App\Services\DateTime\DateFormatter::format($subs->next_billing_date, true, $order)
622 686 )
623 687 );
624 688 ?>
625 689 </p>