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.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 trunk All 48 releases
← All changes | app/Http/Controllers/DashboardController.php +43 -10 1.6.0 → 1.6.5 View file →
@@ -63,11 +63,25 @@
63 63 $completed++;
64 64 $steps['product_info']['completed'] = true;
65 65 }
66 66
67 - if ($this->isAllPageSetUpDone($settings)) {
67 + $missingPage = $this->getMissingPageSetup($settings);
68 +
69 + if (!$missingPage) {
68 70 $completed++;
69 71 $steps['page_setup']['completed'] = true;
72 + } else {
73 + // Let whichever plugin registered the missing page (via
74 + // fluent_cart/generatable_pages) decide where it should be
75 + // resolved. Core stays agnostic of third-party settings screens.
76 + $steps['page_setup']['url'] = apply_filters(
77 + 'fluent_cart/dashboard/page_setup_redirect_url',
78 + $steps['page_setup']['url'],
79 + [
80 + 'missing_page' => $missingPage,
81 + 'base_url' => $baseUrl,
82 + ]
83 + );
70 84 }
71 85
72 86 if (!$this->isAnyPaymentModuleEnabled()) {
73 87 $steps['setup_payments']['completed'] = false;
@@ -112,13 +126,14 @@
112 126 'title' => __('Install Divi Addon', 'fluent-cart'),
113 127 'text' => __('Design your store pages with FluentCart modules in Divi.', 'fluent-cart'),
114 128 'icon' => 'AppsLine',
115 129 'completed' => false,
116 - 'hash_id' => 'fluent-cart-divi-blocks',
130 + 'hash_id' => 'fluent-cart-divi-modules',
117 131 'url' => $baseUrl . "settings/addons"
118 132 ];
119 133
120 - if (defined('FLUENTCART_DIVI_BLOCKS_VERSION')) {
134 + // FLUENTCART_DIVI_BLOCKS_VERSION covers installs from before the slug rename
135 + if (defined('FLUENTCART_DIVI_MODULES_VERSION') || defined('FLUENTCART_DIVI_BLOCKS_VERSION')) {
121 136 $steps['install_divi_addon']['completed'] = true;
122 137 $completed++;
123 138 }
124 139 }
@@ -147,18 +162,36 @@
147 162 return Product::query()->count() > 0;
148 163 }
149 164
150 165
151 - private function isAllPageSetUpDone(array $settings): bool
166 + private function getMissingPageSetup(array $settings): ?array
152 167 {
153 - $pages = (new Pages())->getGeneratablePage();
154 - foreach ($pages as $pageKey => $page) {
155 - $pageKey = "{$pageKey}_page_id";
156 - if (empty(Arr::get($settings, $pageKey))) {
157 - return false;
168 + $pagesInstance = new Pages();
169 + $pages = $pagesInstance->getGeneratablePage();
170 +
171 + // Core pages must be checked first regardless of the order a
172 + // fluent_cart/generatable_pages listener leaves the filtered array
173 + // in, so an add-on can never take priority over a missing core page.
174 + $orderedKeys = array_unique(array_merge(
175 + array_keys($pagesInstance->corePages()),
176 + array_keys($pages)
177 + ));
178 +
179 + foreach ($orderedKeys as $pageKey) {
180 + if (!isset($pages[$pageKey])) {
181 + continue;
158 182 }
183 +
184 + $settingKey = "{$pageKey}_page_id";
185 + if (empty(Arr::get($settings, $settingKey))) {
186 + return array_merge($pages[$pageKey], [
187 + 'key' => $pageKey,
188 + 'setting_key' => $settingKey,
189 + ]);
190 + }
159 191 }
160 - return true;
192 +
193 + return null;
161 194 }
162 195
163 196 private function isAnyPaymentModuleEnabled(): bool
164 197 {