PluginProbe
King Addons for Elementor – 100+ Elementor Widgets, 4 000+ Elementor Templates, WooCommerce Builder, Mega Menu, Popup Builder / 51.1.87
King Addons for Elementor – 100+ Elementor Widgets, 4 000+ Elementor Templates, WooCommerce Builder, Mega Menu, Popup Builder v51.1.87
51.1.87 51.1.86 51.1.84 51.1.85 51.1.83 51.1.82 51.1.81 51.1.79 51.1.78 51.1.77 51.1.76 51.1.74 51.1.75 51.1.65 51.1.64 51.1.63 trunk 51.1.14 51.1.2 51.1.35 51.1.36 51.1.37 51.1.38 51.1.39 51.1.44 All 41 releases
← All changes | includes/widgets/Woo_Checkout_Steps/Woo_Checkout_Steps.php +44 -11 51.1.44 → 51.1.87 View file →
@@ -58,9 +58,9 @@
58 58 * @return string
59 59 */
60 60 public function get_icon(): string
61 61 {
62 - return 'eicon-editor-list-ol';
62 + return 'king-addons-icon king-addons-woo-checkout-steps';
63 63 }
64 64
65 65 /**
66 66 * Widget categories.
@@ -96,8 +96,13 @@
96 96 * Register controls.
97 97 *
98 98 * @return void
99 99 */
100 + public function get_custom_help_url()
101 + {
102 + return 'mailto:[email protected]?subject=Bug Report - King Addons&body=Please describe the issue';
103 + }
104 +
100 105 protected function register_controls(): void
101 106 {
102 107 $this->start_controls_section(
103 108 'section_content',
@@ -166,8 +171,9 @@
166 171 'prev_text',
167 172 [
168 173 'label' => esc_html__('Previous text', 'king-addons'),
169 174 'type' => Controls_Manager::TEXT,
175 + 'dynamic' => ['active' => true],
170 176 'default' => esc_html__('Previous', 'king-addons'),
171 177 'condition' => [
172 178 'show_nav' => 'yes',
173 179 ],
@@ -178,8 +184,9 @@
178 184 'next_text',
179 185 [
180 186 'label' => esc_html__('Next text', 'king-addons'),
181 187 'type' => Controls_Manager::TEXT,
188 + 'dynamic' => ['active' => true],
182 189 'default' => esc_html__('Next', 'king-addons'),
183 190 'condition' => [
184 191 'show_nav' => 'yes',
185 192 ],
@@ -201,12 +208,20 @@
201 208 {
202 209 if (!Woo_Context::maybe_render_context_notice('checkout')) {
203 210 return;
204 211 }
212 +
213 + $in_builder = class_exists('King_Addons\\Woo_Builder\\Context') && Woo_Context::is_editing_template_type('checkout');
214 + if (!function_exists('is_checkout') || (!is_checkout() && !$in_builder) || (function_exists('is_order_received_page') && is_order_received_page())) {
215 + return;
216 + }
217 +
205 218 if (!king_addons_can_use_pro()) {
206 - echo '<div class="king-addons-woo-builder-notice">';
207 - echo esc_html__('Multi-step checkout is available in Pro.', 'king-addons');
208 - echo '</div>';
219 + if (Woo_Context::is_editor()) {
220 + echo '<div class="king-addons-woo-builder-notice">';
221 + echo esc_html__('Multi-step checkout is available in Pro.', 'king-addons');
222 + echo '</div>';
223 + }
209 224 return;
210 225 }
211 226
212 227 $settings = $this->get_settings_for_display();
@@ -211,8 +226,13 @@
211 226
212 227 $settings = $this->get_settings_for_display();
213 228 $steps = $settings['steps'] ?? [];
214 229 if (empty($steps)) {
230 + if (\Elementor\Plugin::$instance->editor->is_edit_mode()) {
231 + echo '<div class="king-addons-woo-builder-notice">'
232 + . esc_html__('Add at least one step, each pointing at a section of the checkout.', 'king-addons')
233 + . '</div>';
234 + }
215 235 return;
216 236 }
217 237
218 238 $scroll = (!empty($settings['scroll_to_section']) && 'yes' === $settings['scroll_to_section']) ? 'yes' : 'no';
@@ -217,20 +237,34 @@
217 237
218 238 $scroll = (!empty($settings['scroll_to_section']) && 'yes' === $settings['scroll_to_section']) ? 'yes' : 'no';
219 239 $auto_scroll = (!empty($settings['auto_scroll']) && 'yes' === $settings['auto_scroll']) ? 'yes' : 'no';
220 240 $show_nav = (!empty($settings['show_nav']) && 'yes' === $settings['show_nav']);
221 - $prev_text = $settings['prev_text'] ?? esc_html__('Previous', 'king-addons');
222 - $next_text = $settings['next_text'] ?? esc_html__('Next', 'king-addons');
241 + // ?: not ??: a cleared field is '' rather than null, which left the
242 + // navigation buttons unlabelled. The values are escaped at output, so
243 + // the fallbacks must not be pre-escaped.
244 + $prev_text = ($settings['prev_text'] ?? null) ?: __('Previous', 'king-addons');
245 + $next_text = ($settings['next_text'] ?? null) ?: __('Next', 'king-addons');
223 246
224 247 echo '<div class="ka-woo-checkout-steps-wrapper" data-enable-nav="' . ($show_nav ? 'true' : 'false') . '" data-auto-scroll="' . esc_attr($auto_scroll) . '">';
225 248 echo '<ol class="ka-woo-checkout-steps ka-woo-checkout-steps--pro" role="list" data-scroll-top="' . esc_attr($scroll) . '" data-prev-text="' . esc_attr($prev_text) . '" data-next-text="' . esc_attr($next_text) . '">';
226 - foreach ($steps as $index => $step) {
249 + $fallback_targets = [
250 + '.woocommerce-billing-fields',
251 + '.woocommerce-shipping-fields',
252 + '#payment',
253 + '.woocommerce-checkout-review-order-table',
254 + ];
255 + $step_i = 0;
256 + foreach ($steps as $step) {
227 257 $label = $step['label'] ?? '';
228 - $target = $step['target'] ?? '';
229 - echo '<li class="ka-woo-checkout-step" data-step="' . esc_attr((string) ($index + 1)) . '" data-target="' . esc_attr($target) . '">';
230 - echo '<span class="ka-woo-checkout-step__number">' . esc_html((string) ($index + 1)) . '</span>';
258 + $target = trim((string) ($step['target'] ?? ''));
259 + if ($target === '') {
260 + $target = $fallback_targets[$step_i] ?? '';
261 + }
262 + echo '<li class="ka-woo-checkout-step" data-step="' . esc_attr((string) ($step_i + 1)) . '" data-target="' . esc_attr($target) . '">';
263 + echo '<span class="ka-woo-checkout-step__number">' . esc_html((string) ($step_i + 1)) . '</span>';
231 264 echo '<span class="ka-woo-checkout-step__label">' . esc_html($label) . '</span>';
232 265 echo '</li>';
266 + $step_i++;
233 267 }
234 268 echo '</ol>';
235 269 if ($show_nav) {
236 270 echo '<div class="ka-woo-checkout-steps__nav">';
@@ -240,9 +274,8 @@
240 274 }
241 275 echo '</div>';
242 276 }
243 277 }
244 -
245 278
246 279
247 280
248 281