| @@ -23,8 +23,9 @@ | ||
| 23 | 23 | use FluentCart\App\Vite; |
| 24 | 24 | use FluentCart\Framework\Support\Arr; |
| 25 | 25 | use FluentCart\App\Services\Renderer\CheckoutRenderer; |
| 26 | 26 | use FluentCart\App\Services\Renderer\ModalCheckoutRenderer; |
| 27 | +use FluentCart\App\Services\Renderer\OrderReviewRenderer; | |
| 27 | 28 | |
| 28 | 29 | class WebRoutes |
| 29 | 30 | { |
| 30 | 31 | public static function register() |
| @@ -282,9 +283,40 @@ | ||
| 282 | 283 | 'wp_head' => false, |
| 283 | 284 | 'wp_footer' => false, |
| 284 | 285 | ]); |
| 285 | 286 | return true; |
| 286 | - | |
| 287 | + | |
| 288 | + case 'order-review': | |
| 289 | + ob_start(); | |
| 290 | + $orderFound = (new OrderReviewRenderer( | |
| 291 | + sanitize_text_field($request->get('order_hash', '')) | |
| 292 | + ))->render(); | |
| 293 | + $orderReview = ob_get_clean(); | |
| 294 | + | |
| 295 | + // A bad or stale link is a page that does not exist, and | |
| 296 | + // says so to crawlers as well as people. | |
| 297 | + if (!$orderFound) { | |
| 298 | + status_header(404); | |
| 299 | + } | |
| 300 | + | |
| 301 | + // wp_head/wp_footer left on, unlike the receipt: the review | |
| 302 | + // form's script and stylesheet are enqueued during render() | |
| 303 | + // and there is nowhere else for them to print. It also lets | |
| 304 | + // the theme dress a page the customer reaches from an email. | |
| 305 | + // wp_head/wp_footer forced on. This route renders the whole | |
| 306 | + // document, so nothing else prints them — and the view's | |
| 307 | + // is_page() guard would otherwise skip both on a site whose | |
| 308 | + // front page is static, silently dropping every asset the | |
| 309 | + // review form (and Pro's photo fields) enqueued. | |
| 310 | + FrontendView::make( | |
| 311 | + __('Review Your Order', 'fluent-cart'), | |
| 312 | + $orderReview, | |
| 313 | + [ | |
| 314 | + 'wp_head' => true, | |
| 315 | + 'wp_footer' => true, | |
| 316 | + ] | |
| 317 | + ); | |
| 318 | + return true; | |
| 287 | 319 | |
| 288 | 320 | case 'print-invoice': |
| 289 | 321 | return self::handlePrintRoute('invoice'); |
| 290 | 322 | |