PluginProbe
King Addons for Elementor – 80+ Elementor Widgets, 4 000+ Elementor Templates, WooCommerce, Mega Menu, Popup Builder / 51.1.83
King Addons for Elementor – 80+ Elementor Widgets, 4 000+ Elementor Templates, WooCommerce, Mega Menu, Popup Builder v51.1.83
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 51.1.45 51.1.46 51.1.47 51.1.49 All 37 releases
king-addons / includes / extensions / Sticky_Add_To_Cart / templates / admin-page.php

admin-page.php in King Addons for Elementor – 80+ Elementor Widgets, 4 000+ Elementor Templates, WooCommerce, Mega Menu, Popup Builder 51.1.83, at includes/extensions/Sticky_Add_To_Cart/templates/admin-page.php

148 lines 6.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Sticky Add To Cart settings screen.
4 *
5 * @package King_Addons
6 *
7 * @var array<string, mixed> $s Current settings.
8 * @var bool $is_pro Whether the paid tier is active.
9 */
10
11 if (!defined('ABSPATH')) {
12 exit;
13 }
14
15 require_once KING_ADDONS_PATH . 'includes/admin/shared/page-shell.php';
16
17 $ka_notices = [];
18
19 if (!$is_pro) {
20 $ka_notices[] = [
21 'type' => 'info',
22 'text' => sprintf(
23 '<strong>%1$s</strong> %2$s <a href="%3$s" target="_blank" rel="noopener">%4$s</a>',
24 esc_html__('This module is part of King Addons Pro.', 'king-addons'),
25 esc_html__('You can set it up now; the bar starts showing on your product pages once Pro is active.', 'king-addons'),
26 esc_url('https://kingaddons.com/pricing/?utm_source=kng-sticky-add-to-cart&utm_medium=plugin&utm_campaign=kng'),
27 esc_html__('See plans', 'king-addons')
28 ),
29 ];
30 }
31
32 if (!class_exists('WooCommerce')) {
33 $ka_notices[] = [
34 'type' => 'warning',
35 'text' => esc_html__('WooCommerce is not active, so there are no product pages to add this bar to.', 'king-addons'),
36 ];
37 }
38
39 $ka_position = $s['position'] ?? 'bottom';
40
41 ka_admin_page_open([
42 'title' => esc_html__('Sticky Add To Cart', 'king-addons'),
43 'subtitle' => esc_html__('Keeps the price and buy button in reach once the visitor scrolls past the product form.', 'king-addons'),
44 'icon' => 'dashicons-cart',
45 'icon_color' => 'orange',
46 'saved' => isset($_GET['ka-saved']), // phpcs:ignore WordPress.Security.NonceVerification.Recommended
47 'notices' => $ka_notices,
48 ]);
49 ?>
50
51 <form method="post" action="<?php echo esc_url(admin_url('admin-post.php')); ?>">
52 <input type="hidden" name="action" value="king_addons_satc_save">
53 <?php wp_nonce_field('king_addons_satc_save'); ?>
54
55 <?php ka_admin_card_open(esc_html__('Behaviour', 'king-addons'), 'dashicons-visibility'); ?>
56
57 <?php ka_admin_row_open(esc_html__('Enable', 'king-addons')); ?>
58 <label class="ka-check">
59 <input type="checkbox" name="ka_satc[enabled]" value="1" <?php checked(!empty($s['enabled'])); ?>>
60 <span><?php esc_html_e('Show the sticky bar on single product pages', 'king-addons'); ?></span>
61 </label>
62 <?php ka_admin_row_close(); ?>
63
64 <?php ka_admin_row_open(esc_html__('Position', 'king-addons')); ?>
65 <div class="ka-radio-group">
66 <label class="ka-radio-item">
67 <input type="radio" name="ka_satc[position]" value="bottom" <?php checked($ka_position, 'bottom'); ?>>
68 <span><?php esc_html_e('Bottom of the screen', 'king-addons'); ?></span>
69 </label>
70 <label class="ka-radio-item">
71 <input type="radio" name="ka_satc[position]" value="top" <?php checked($ka_position, 'top'); ?>>
72 <span><?php esc_html_e('Top of the screen', 'king-addons'); ?></span>
73 </label>
74 </div>
75 <?php ka_admin_row_close(); ?>
76
77 <?php ka_admin_row_open(esc_html__('What to show', 'king-addons')); ?>
78 <div class="ka-check-group">
79 <label class="ka-check">
80 <input type="checkbox" name="ka_satc[show_thumbnail]" value="1" <?php checked(!empty($s['show_thumbnail'])); ?>>
81 <span><?php esc_html_e('Product thumbnail', 'king-addons'); ?></span>
82 </label>
83 <label class="ka-check">
84 <input type="checkbox" name="ka_satc[show_price]" value="1" <?php checked(!empty($s['show_price'])); ?>>
85 <span><?php esc_html_e('Price', 'king-addons'); ?></span>
86 </label>
87 <label class="ka-check">
88 <input type="checkbox" name="ka_satc[show_on_mobile]" value="1" <?php checked(!empty($s['show_on_mobile'])); ?>>
89 <span><?php esc_html_e('Show on mobile devices', 'king-addons'); ?></span>
90 </label>
91 </div>
92 <?php ka_admin_row_close(); ?>
93
94 <?php ka_admin_row_open(esc_html__('Button label', 'king-addons'), 'ka-satc-label'); ?>
95 <input type="text" id="ka-satc-label" name="ka_satc[button_text]"
96 value="<?php echo esc_attr((string) $s['button_text']); ?>">
97 <?php ka_admin_row_close(); ?>
98
99 <?php ka_admin_row_open(esc_html__('Fallback trigger', 'king-addons'), 'ka-satc-offset'); ?>
100 <p class="ka-inline-field">
101 <input type="number" min="0" max="5000" id="ka-satc-offset" name="ka_satc[trigger_offset]"
102 value="<?php echo esc_attr((string) $s['trigger_offset']); ?>" style="max-width:110px">
103 <span><?php esc_html_e('px', 'king-addons'); ?></span>
104 </p>
105 <?php ka_admin_row_close(esc_html__('The bar normally appears when the real add-to-cart form scrolls out of view. This offset is used only on themes where that form cannot be found.', 'king-addons')); ?>
106
107 <?php ka_admin_card_close(); ?>
108
109 <?php ka_admin_card_open(esc_html__('Appearance', 'king-addons'), 'dashicons-art'); ?>
110
111 <?php ka_admin_row_open(esc_html__('Bar', 'king-addons')); ?>
112 <div class="ka-color-row">
113 <label class="ka-color-wrap">
114 <span><?php esc_html_e('Background', 'king-addons'); ?></span>
115 <input type="color" name="ka_satc[bg_color]" value="<?php echo esc_attr((string) $s['bg_color']); ?>">
116 </label>
117 <label class="ka-color-wrap">
118 <span><?php esc_html_e('Text', 'king-addons'); ?></span>
119 <input type="color" name="ka_satc[text_color]" value="<?php echo esc_attr((string) $s['text_color']); ?>">
120 </label>
121 </div>
122 <?php ka_admin_row_close(); ?>
123
124 <?php ka_admin_row_open(esc_html__('Button', 'king-addons')); ?>
125 <div class="ka-color-row">
126 <label class="ka-color-wrap">
127 <span><?php esc_html_e('Background', 'king-addons'); ?></span>
128 <input type="color" name="ka_satc[button_bg_color]" value="<?php echo esc_attr((string) $s['button_bg_color']); ?>">
129 </label>
130 <label class="ka-color-wrap">
131 <span><?php esc_html_e('Text', 'king-addons'); ?></span>
132 <input type="color" name="ka_satc[button_text_color]" value="<?php echo esc_attr((string) $s['button_text_color']); ?>">
133 </label>
134 </div>
135 <?php ka_admin_row_close(); ?>
136
137 <?php ka_admin_card_close(); ?>
138
139 <p class="ka-submit">
140 <button type="submit" class="ka-btn ka-btn-primary">
141 <span class="dashicons dashicons-yes"></span>
142 <?php esc_html_e('Save Settings', 'king-addons'); ?>
143 </button>
144 </p>
145 </form>
146
147 <?php ka_admin_page_close(); ?>
148