| @@ -54,23 +54,24 @@ | ||
| 54 | 54 | private static function buildReceiptBlocks(): array |
| 55 | 55 | { |
| 56 | 56 | $blocks = []; |
| 57 | 57 | |
| 58 | - $blocks[] = self::header('RECEIPT'); | |
| 58 | + $blocks[] = self::header(__('RECEIPT', 'fluent-cart')); | |
| 59 | 59 | $blocks[] = self::addressColumns(); |
| 60 | 60 | $blocks[] = self::metaTable([ |
| 61 | - 'Order Number' => '{{order.invoice_no}}', | |
| 62 | - 'Order Date' => '{{order.created_at}}', | |
| 63 | - 'Payment Method' => '{{order.payment_method_title}}', | |
| 64 | - 'Payment Status' => '{{order.payment_status}}', | |
| 61 | + __('Order Number', 'fluent-cart') => '{{order.invoice_no}}', | |
| 62 | + __('Order Date', 'fluent-cart') => '{{order.created_at}}', | |
| 63 | + __('Payment Method', 'fluent-cart') => '{{order.payment_method_title}}', | |
| 64 | + __('Payment Status', 'fluent-cart') => '{{order.payment_status}}', | |
| 65 | 65 | ]); |
| 66 | 66 | $blocks[] = self::itemsTable(); |
| 67 | 67 | $blocks[] = self::summaryTable([ |
| 68 | - 'Subtotal' => '{{order.subtotal_formatted}}', | |
| 69 | - 'Discount' => '{{order.discount_total_formatted}}', | |
| 70 | - 'Tax' => '{{order.tax_total_formatted}}', | |
| 71 | - 'Shipping' => '{{order.shipping_total_formatted}}', | |
| 72 | - ], 'Total', '{{order.total_amount_formatted}}'); | |
| 68 | + __('Subtotal', 'fluent-cart') => '{{order.subtotal_formatted}}', | |
| 69 | + __('Discount', 'fluent-cart') => '{{order.discount_total_formatted}}', | |
| 70 | + __('Fees', 'fluent-cart') => '{{order.fee_lines}}', | |
| 71 | + __('Tax', 'fluent-cart') => '{{order.tax_breakdown}}', | |
| 72 | + __('Shipping', 'fluent-cart') => '{{order.shipping_total_formatted}}', | |
| 73 | + ], __('Total', 'fluent-cart'), '{{order.total_amount_formatted}}'); | |
| 73 | 74 | $blocks[] = self::footer(__('Thank you for your purchase!', 'fluent-cart')); |
| 74 | 75 | |
| 75 | 76 | return $blocks; |
| 76 | 77 | } |
| @@ -93,22 +94,23 @@ | ||
| 93 | 94 | private static function buildRenewalReceiptBlocks(): array |
| 94 | 95 | { |
| 95 | 96 | $blocks = []; |
| 96 | 97 | |
| 97 | - $blocks[] = self::header('RENEWAL RECEIPT'); | |
| 98 | + $blocks[] = self::header(__('RENEWAL RECEIPT', 'fluent-cart')); | |
| 98 | 99 | $blocks[] = self::addressColumns(); |
| 99 | 100 | $blocks[] = self::metaTable([ |
| 100 | - 'Order Number' => '{{order.invoice_no}}', | |
| 101 | - 'Renewal Date' => '{{order.created_at}}', | |
| 102 | - 'Payment Method' => '{{order.payment_method_title}}', | |
| 103 | - 'Payment Status' => '{{order.payment_status}}', | |
| 101 | + __('Order Number', 'fluent-cart') => '{{order.invoice_no}}', | |
| 102 | + __('Renewal Date', 'fluent-cart') => '{{order.created_at}}', | |
| 103 | + __('Payment Method', 'fluent-cart') => '{{order.payment_method_title}}', | |
| 104 | + __('Payment Status', 'fluent-cart') => '{{order.payment_status}}', | |
| 104 | 105 | ]); |
| 105 | 106 | $blocks[] = self::itemsTable(); |
| 106 | 107 | $blocks[] = self::summaryTable([ |
| 107 | - 'Subtotal' => '{{order.subtotal_formatted}}', | |
| 108 | - 'Discount' => '{{order.discount_total_formatted}}', | |
| 109 | - 'Tax' => '{{order.tax_total_formatted}}', | |
| 110 | - ], 'Total', '{{order.total_amount_formatted}}'); | |
| 108 | + __('Subtotal', 'fluent-cart') => '{{order.subtotal_formatted}}', | |
| 109 | + __('Discount', 'fluent-cart') => '{{order.discount_total_formatted}}', | |
| 110 | + __('Fees', 'fluent-cart') => '{{order.fee_lines}}', | |
| 111 | + __('Tax', 'fluent-cart') => '{{order.tax_breakdown}}', | |
| 112 | + ], __('Total', 'fluent-cart'), '{{order.total_amount_formatted}}'); | |
| 111 | 113 | $blocks[] = self::footer(__('Thank you for your continued subscription!', 'fluent-cart')); |
| 112 | 114 | |
| 113 | 115 | return $blocks; |
| 114 | 116 | } |
| @@ -133,19 +135,19 @@ | ||
| 133 | 135 | private static function buildRefundNoticeBlocks(): array |
| 134 | 136 | { |
| 135 | 137 | $blocks = []; |
| 136 | 138 | |
| 137 | - $blocks[] = self::header('REFUND NOTICE'); | |
| 138 | - $blocks[] = self::addressColumns('REFUND TO'); | |
| 139 | + $blocks[] = self::header(__('REFUND NOTICE', 'fluent-cart')); | |
| 140 | + $blocks[] = self::addressColumns(__('REFUND TO', 'fluent-cart')); | |
| 139 | 141 | $blocks[] = self::metaTable([ |
| 140 | - 'Order Number' => '{{order.invoice_no}}', | |
| 141 | - 'Order Date' => '{{order.created_at}}', | |
| 142 | - 'Payment Method' => '{{order.payment_method_title}}', | |
| 142 | + __('Order Number', 'fluent-cart') => '{{order.invoice_no}}', | |
| 143 | + __('Order Date', 'fluent-cart') => '{{order.created_at}}', | |
| 144 | + __('Payment Method', 'fluent-cart') => '{{order.payment_method_title}}', | |
| 143 | 145 | ]); |
| 144 | 146 | $blocks[] = self::itemsTable(); |
| 145 | 147 | $blocks[] = self::summaryTable([ |
| 146 | - 'Original Total' => '{{order.total_amount_formatted}}', | |
| 147 | - ], 'Refund Amount', '{{order.total_refund}}'); | |
| 148 | + __('Original Total', 'fluent-cart') => '{{order.total_amount_formatted}}', | |
| 149 | + ], __('Refund Amount', 'fluent-cart'), '{{order.total_refund}}'); | |
| 148 | 150 | $blocks[] = self::footer(__('Your refund has been processed. Please allow a few business days for the amount to appear in your account.', 'fluent-cart')); |
| 149 | 151 | |
| 150 | 152 | return $blocks; |
| 151 | 153 | } |
| @@ -171,23 +173,24 @@ | ||
| 171 | 173 | private static function buildProformaInvoiceBlocks(): array |
| 172 | 174 | { |
| 173 | 175 | $blocks = []; |
| 174 | 176 | |
| 175 | - $blocks[] = self::header('INVOICE'); | |
| 177 | + $blocks[] = self::header(__('INVOICE', 'fluent-cart')); | |
| 176 | 178 | $blocks[] = self::addressColumns(); |
| 177 | 179 | $blocks[] = self::metaTable([ |
| 178 | - 'Invoice Number' => '{{order.invoice_no}}', | |
| 179 | - 'Invoice Date' => '{{order.created_at}}', | |
| 180 | - 'Payment Method' => '{{order.payment_method_title}}', | |
| 181 | - 'Payment Status' => '{{order.payment_status}}', | |
| 180 | + __('Invoice Number', 'fluent-cart') => '{{order.invoice_no}}', | |
| 181 | + __('Invoice Date', 'fluent-cart') => '{{order.created_at}}', | |
| 182 | + __('Payment Method', 'fluent-cart') => '{{order.payment_method_title}}', | |
| 183 | + __('Payment Status', 'fluent-cart') => '{{order.payment_status}}', | |
| 182 | 184 | ]); |
| 183 | 185 | $blocks[] = self::itemsTable(); |
| 184 | 186 | $blocks[] = self::summaryTable([ |
| 185 | - 'Subtotal' => '{{order.subtotal_formatted}}', | |
| 186 | - 'Discount' => '{{order.discount_total_formatted}}', | |
| 187 | - 'Tax' => '{{order.tax_total_formatted}}', | |
| 188 | - 'Shipping' => '{{order.shipping_total_formatted}}', | |
| 189 | - ], 'Amount Due', '{{order.total_amount_formatted}}'); | |
| 187 | + __('Subtotal', 'fluent-cart') => '{{order.subtotal_formatted}}', | |
| 188 | + __('Discount', 'fluent-cart') => '{{order.discount_total_formatted}}', | |
| 189 | + __('Fees', 'fluent-cart') => '{{order.fee_lines}}', | |
| 190 | + __('Tax', 'fluent-cart') => '{{order.tax_breakdown}}', | |
| 191 | + __('Shipping', 'fluent-cart') => '{{order.shipping_total_formatted}}', | |
| 192 | + ], __('Amount Due', 'fluent-cart'), '{{order.total_amount_formatted}}'); | |
| 190 | 193 | $blocks[] = self::footer(__('Thank you for your order. Please complete the payment to process your order.', 'fluent-cart')); |
| 191 | 194 | |
| 192 | 195 | return $blocks; |
| 193 | 196 | } |
| @@ -204,10 +207,14 @@ | ||
| 204 | 207 | |
| 205 | 208 | /** |
| 206 | 209 | * Two-column FROM / BILL TO address block. |
| 207 | 210 | */ |
| 208 | - private static function addressColumns(string $billingLabel = 'BILL TO'): array | |
| 211 | + private static function addressColumns(?string $billingLabel = null): array | |
| 209 | 212 | { |
| 213 | + if ($billingLabel === null) { | |
| 214 | + $billingLabel = __('BILL TO', 'fluent-cart'); | |
| 215 | + } | |
| 216 | + | |
| 210 | 217 | return self::block('fluent-cart/receipt-addresses', ['billingLabel' => $billingLabel]); |
| 211 | 218 | } |
| 212 | 219 | |
| 213 | 220 | /** |
| @@ -229,8 +236,17 @@ | ||
| 229 | 236 | * Line-items table (delegated to the order variable). |
| 230 | 237 | */ |
| 231 | 238 | private static function itemsTable(): array |
| 232 | 239 | { |
| 240 | + // No inner content. The block is dynamic — it registers with | |
| 241 | + // `save: () => null` and renders through | |
| 242 | + // ReceiptItemTableBlockEditor::render(), which ignores $content and emits | |
| 243 | + // its own {{order.pdf_items_table}} placeholder built from these | |
| 244 | + // attributes. Passing content here made blocksToContent() serialise an | |
| 245 | + // open/close pair with `{{order.items_table}}` inside it, and the editor | |
| 246 | + // then failed to validate the saved markup against a save() that produces | |
| 247 | + // nothing. Every other receipt block already passes null and serialises | |
| 248 | + // self-closing. | |
| 233 | 249 | return self::block('fluent-cart/receipt-item-table', [ |
| 234 | 250 | 'headerBg' => self::WHITE, |
| 235 | 251 | 'headerColor' => self::TEXT, |
| 236 | 252 | 'bodyColor' => self::TEXT, |
| @@ -235,9 +251,9 @@ | ||
| 235 | 251 | 'headerColor' => self::TEXT, |
| 236 | 252 | 'bodyColor' => self::TEXT, |
| 237 | 253 | 'borderColor' => self::BORDER, |
| 238 | 254 | 'fontSize' => 11, |
| 239 | - ], '{{order.items_table}}'); | |
| 255 | + ]); | |
| 240 | 256 | } |
| 241 | 257 | |
| 242 | 258 | /** |
| 243 | 259 | * Payment summary with optional sub-rows and a bold total row. |