| @@ -1,8 +1,9 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | namespace FluentCart\App\CPT; |
| 4 | 4 | |
| 5 | +use FluentCart\Api\ModuleSettings; | |
| 5 | 6 | use FluentCart\Api\StoreSettings; |
| 6 | 7 | use FluentCart\App\Models\DynamicModel; |
| 7 | 8 | use FluentCart\Framework\Support\Arr; |
| 8 | 9 | use FluentCart\Framework\Support\Str; |
| @@ -20,9 +21,9 @@ | ||
| 20 | 21 | } |
| 21 | 22 | |
| 22 | 23 | public function corePages(): array |
| 23 | 24 | { |
| 24 | - return [ | |
| 25 | + $pages = [ | |
| 25 | 26 | 'checkout' => [ |
| 26 | 27 | 'title' => 'Checkout', |
| 27 | 28 | 'content' => '[fluent_cart_checkout]' |
| 28 | 29 | ], |
| @@ -33,8 +34,12 @@ | ||
| 33 | 34 | 'receipt' => [ |
| 34 | 35 | 'title' => 'Receipt', |
| 35 | 36 | 'content' => '[fluent_cart_receipt]' |
| 36 | 37 | ], |
| 38 | + 'order_review' => [ | |
| 39 | + 'title' => 'Review Your Order', | |
| 40 | + 'content' => '[fluent_cart_order_review]' | |
| 41 | + ], | |
| 37 | 42 | 'shop' => [ |
| 38 | 43 | 'title' => 'Shop', |
| 39 | 44 | 'content' => static::getShopPageContent() |
| 40 | 45 | ], |
| @@ -42,8 +47,19 @@ | ||
| 42 | 47 | 'title' => 'Account', |
| 43 | 48 | 'content' => '<!-- wp:fluent-cart/customer-profile /-->' |
| 44 | 49 | ] |
| 45 | 50 | ]; |
| 51 | + | |
| 52 | + // The order review page serves the reviews module. While the module | |
| 53 | + // is off it is not a page the store is missing: the dashboard must | |
| 54 | + // not ask for it, onboarding must not create it, and Pages Setup | |
| 55 | + // does not offer it (StoreSettings::fields()). Read per call, so | |
| 56 | + // switching the module on makes it wanted again at once. | |
| 57 | + if (!ModuleSettings::isActive('reviews')) { | |
| 58 | + unset($pages['order_review']); | |
| 59 | + } | |
| 60 | + | |
| 61 | + return $pages; | |
| 46 | 62 | } |
| 47 | 63 | |
| 48 | 64 | |
| 49 | 65 | public function createPages(array $exclude = []): array |