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/ShortCodeParser/Parsers/OrderParser.php +44 -21 1.5.2 → 1.6.5 View file →
@@ -9,8 +9,9 @@
9 9 use FluentCart\App\Models\Order;
10 10 use FluentCart\App\Models\Subscription;
11 11 use FluentCart\App\Modules\PaymentMethods\Core\GatewayManager;
12 12 use FluentCart\App\Services\DateTime\DateTime;
13 +use FluentCart\App\Services\DateTime\DateFormatter;
13 14 use FluentCart\App\Services\Payments\PaymentHelper;
14 15 use FluentCart\App\Services\Payments\PaymentReceipt;
15 16 use FluentCart\App\Services\TemplateService;
16 17 use FluentCart\App\Services\Renderer\Receipt\TaxSummaryHelper;
@@ -104,14 +105,12 @@
104 105 if (in_array($accessor, ['updated_at', 'created_at'])) {
105 106 $date = Arr::get($this->data, $this->attributeMap[$accessor]);
106 107 $timestamp = DateTime::anyTimeToGmt($date)->getTimestamp();
107 108
108 - $date = wp_date(
109 - get_option('date_format'),
110 - $timestamp,
111 - new \DateTimeZone($this->orderTz)
112 - );
113 -
109 + // Through DateFormatter so the store's format and timezone settings
110 + // reach this too; orderTz is only consulted on the Browser source.
111 + $date = DateFormatter::format($timestamp, false, $this->orderTz);
112 +
114 113 return Helper::translateNumber($date);
115 114 }
116 115
117 116 // Handle _formatted suffix for cent columns (e.g. total_amount_formatted)
@@ -549,24 +548,14 @@
549 548 $valueStyle = 'text-align:right;';
550 549
551 550 $rows = '';
552 551
553 - if ($summary['isReverseCharge']) {
554 - $rcReversedTotal = isset($summary['reversedTaxTotal']) ? (int) $summary['reversedTaxTotal'] : 0;
555 - $rcReversedValue = $rcReversedTotal > 0
556 - ? esc_html(Helper::toDecimal($rcReversedTotal))
557 - : esc_html__('Charge reversed', 'fluent-cart');
558 - $rows .= '<tr><td colspan="2" style="' . $headingStyle . '">'
559 - . esc_html__('TAX SUMMARY', 'fluent-cart')
560 - . '</td></tr>';
561 - $rows .= '<tr>'
562 - . '<td style="' . $totalStyle . '">' . esc_html__('Tax reversed', 'fluent-cart') . '</td>'
563 - . '<td style="' . $totalStyle . $valueStyle . '">' . $rcReversedValue . '</td>'
564 - . '</tr>';
565 - return $this->wrapTaxBreakdownBox($rows);
566 - }
567 -
568 552 $foldedRateLines = Arr::get($summary, 'foldedRateLines', []);
553 + $isRcOrder = !empty($summary['isReverseCharge']);
554 + $rcReversedTotal = isset($summary['reversedTaxTotal']) ? (int) $summary['reversedTaxTotal'] : 0;
555 + $rcReversedValue = $rcReversedTotal > 0
556 + ? esc_html(Helper::toDecimal($rcReversedTotal))
557 + : esc_html__('Charge reversed', 'fluent-cart');
569 558 $includedInPrices = (int) Arr::get($summary, 'includedInPrices', 0);
570 559 $opFeeRows = Arr::get($summary, 'feeTaxLineRows', []);
571 560 $taxRateLines = Arr::get($summary, 'taxRateLines', []);
572 561 $productTaxRowCount = !empty($taxRateLines)
@@ -578,8 +567,20 @@
578 567 || !empty($shippingTaxLines)
579 568 || $rowCount >= 2
580 569 || ($rowCount === 1 && !($summary['payableTax'] > 0 || $summary['inclusiveTax'] > 0 || (int) Arr::get($summary, 'inclusiveFeeTax', 0) > 0));
581 570
571 + $isSimplifiedMode = ($summary['displayMode'] ?? '') === 'simplified';
572 +
573 + if ($isSimplifiedMode && !empty($summary['simpleLine'])) {
574 + $rows .= '<tr>'
575 + . '<td style="' . $normalStyle . '">' . esc_html((string) $summary['simpleLine']['label']) . '</td>'
576 + . '<td style="' . $normalStyle . $valueStyle . '">' . esc_html((string) $summary['simpleLine']['value']) . '</td>'
577 + . '</tr>';
578 +
579 + // Simplified mode: single tax line only, skip the detailed breakdown below.
580 + return $this->wrapTaxBreakdownBox($rows);
581 + }
582 +
582 583 if (!empty($foldedRateLines)) {
583 584 $colHeadStyle = 'width:58%;padding:3px 8px 3px 0;font-size:10px;font-weight:600;text-transform:uppercase;letter-spacing:0.06em;color:#64748b;vertical-align:top;';
584 585 $colHeadBaseStyle = 'width:24%;padding:3px 8px 3px 0;font-size:10px;font-weight:600;text-transform:uppercase;letter-spacing:0.06em;color:#64748b;text-align:right;white-space:nowrap;vertical-align:top;';
585 586 $colHeadTaxStyle = 'width:18%;padding:3px 0;font-size:10px;font-weight:600;text-transform:uppercase;letter-spacing:0.06em;color:#64748b;text-align:right;white-space:nowrap;vertical-align:top;';
@@ -607,8 +608,19 @@
607 608 $nestedTable .= '</table>';
608 609
609 610 $rows .= '<tr><td colspan="2" style="padding:2px 0 0 0;">' . $nestedTable . '</td></tr>';
610 611
612 + if ($isRcOrder) {
613 + $rcReversedTotalValue = $rcReversedTotal > 0
614 + ? CurrencySettings::getPriceHtml($rcReversedTotal, $currency)
615 + : esc_html__('Charge reversed', 'fluent-cart');
616 + $rows .= '<tr>'
617 + . '<td style="' . $totalStyle . '">' . esc_html__('VAT reversed', 'fluent-cart') . '</td>'
618 + . '<td style="' . $totalStyle . $valueStyle . '">' . $rcReversedTotalValue . '</td>'
619 + . '</tr>';
620 + return $this->wrapTaxBreakdownBox($rows);
621 + }
622 +
611 623 $rows .= '<tr>'
612 624 . '<td style="' . $totalStyle . '">' . esc_html__('Total tax', 'fluent-cart') . '</td>'
613 625 . '<td style="' . $totalStyle . $valueStyle . '">' . CurrencySettings::getPriceHtml((int) $summary['totalOrderTax'], $currency) . '</td>'
614 626 . '</tr>';
@@ -627,8 +639,19 @@
627 639 . '<td style="' . $payableStyle . $valueStyle . '">' . CurrencySettings::getPriceHtml((int) $summary['payableTax'], $currency) . '</td>'
628 640 . '</tr>';
629 641 }
630 642
643 + return $this->wrapTaxBreakdownBox($rows);
644 + }
645 +
646 + if ($isRcOrder) {
647 + $rows .= '<tr><td colspan="2" style="' . $headingStyle . '">'
648 + . esc_html__('TAX SUMMARY', 'fluent-cart')
649 + . '</td></tr>';
650 + $rows .= '<tr>'
651 + . '<td style="' . $totalStyle . '">' . esc_html__('Tax reversed', 'fluent-cart') . '</td>'
652 + . '<td style="' . $totalStyle . $valueStyle . '">' . $rcReversedValue . '</td>'
653 + . '</tr>';
631 654 return $this->wrapTaxBreakdownBox($rows);
632 655 }
633 656
634 657 $rows .= '<tr><td colspan="2" style="' . $headingStyle . '">'