PluginProbe
Tiered Pricing Table for WooCommerce / 8.0.2
Tiered Pricing Table for WooCommerce v8.0.2
8.0.2 7.1.7 7.1.5 7.1.4 7.1.1 6.5.0 6.4.0 6.1.0 trunk 1.0 1.1 2.0 2.0.1 2.0.2 2.1 2.1.1 2.1.2 2.2.0 2.2.1 2.2.2 2.2.3 2.3.0 2.3.1 2.3.2 2.3.3 All 91 releases
← All changes | src/Settings/Sections/GeneralSection/Subsections/LayoutSubsection.php +147 -56 6.4.0 → 8.0.2 View file →
@@ -1,7 +1,10 @@
1 1 <?php namespace TierPricingTable\Settings\Sections\GeneralSection\Subsections;
2 2
3 +use TierPricingTable\Addons\LayoutConfigurator\LayoutConfigurator;
4 +use TierPricingTable\Addons\LayoutConfigurator\LayoutConfiguratorAddon;
3 5 use TierPricingTable\Settings\CustomOptions\TPTDisplayType;
6 +use TierPricingTable\Settings\Sections\GeneralSection\GeneralSection;
4 7 use TierPricingTable\Settings\CustomOptions\TPTTableColumnsField;
5 8 use TierPricingTable\Settings\CustomOptions\TPTQuantityMeasurementField;
6 9 use TierPricingTable\Settings\CustomOptions\TPTSwitchOption;
7 10 use TierPricingTable\Settings\CustomOptions\TPTTextTemplate;
@@ -8,16 +11,23 @@
8 11 use TierPricingTable\Settings\Sections\SubsectionAbstract;
9 12 use TierPricingTable\Settings\Settings;
10 13 use TierPricingTable\TierPricingTablePlugin;
11 14
15 +/**
16 + * Product-page layout settings. With the layout configurator add-on on (the default) the whole
17 + * subsection is one configurator field with a live preview; with it off the classic rows are shown.
18 + */
12 19 class LayoutSubsection extends SubsectionAbstract {
13 20
14 21 public function getTitle(): string {
15 - return __( 'Pricing Layout Settings', 'tier-pricing-table' );
22 + // the configurator prints its own heading, next to the page switch
23 + return LayoutConfiguratorAddon::isActive() ? '' : __( 'Pricing Layout Settings', 'tier-pricing-table' );
16 24 }
17 25
18 26 public function getDescription(): string {
19 - return __( 'Customize the appearance and behavior of your tiered pricing tables.', 'tier-pricing-table' );
27 + return LayoutConfiguratorAddon::isActive()
28 + ? ''
29 + : __( 'Customize the appearance and behavior of your tiered pricing tables.', 'tier-pricing-table' );
20 30 }
21 31
22 32 public function getSlug(): string {
23 33 return 'layout';
@@ -23,20 +33,40 @@
23 33 return 'layout';
24 34 }
25 35
26 36 public function getSettings(): array {
37 + return LayoutConfiguratorAddon::isActive() ? $this->getConfiguratorSettings() : $this->getClassicSettings();
38 + }
39 +
40 + protected function getConfiguratorSettings(): array {
27 41 return array(
28 42 array(
29 - 'title' => __( 'Display tiered pricing', 'tier-pricing-table' ),
43 + 'title' => __( 'Pricing Display', 'tier-pricing-table' ),
44 + 'id' => Settings::SETTINGS_PREFIX . 'display_type',
45 + 'type' => LayoutConfigurator::FIELD_TYPE,
46 + 'desc' => '',
47 + ),
48 + // Options saved from the configurator's hidden inputs; rendered by nothing.
49 + ...LayoutConfigurator::getSavedOnlyFields(),
50 + );
51 + }
52 +
53 + /**
54 + * The classic rows, one option each, shown while the layout configurator add-on is off.
55 + */
56 + protected function getClassicSettings(): array {
57 + return array(
58 + array(
59 + 'title' => __( 'Show tiered pricing automatically', 'tier-pricing-table' ),
30 60 'id' => Settings::SETTINGS_PREFIX . 'display',
31 61 'type' => TPTSwitchOption::FIELD_TYPE,
32 62 'default' => 'yes',
33 - 'desc' => __( 'Automatically display tiered pricing on the product page. Prices remain dynamic even if the tiered pricing is not displayed. You can also display tiered pricing via shortcode, Gutenberg block, or Elementor widget.',
63 + 'desc' => __( 'Automatically insert the pricing layout on the product page. If disabled, pricing remains dynamic but you must insert the layout manually via shortcode, block, or widget.',
34 64 'tier-pricing-table' ),
35 65 'desc_tip' => true,
36 66 ),
37 67 array(
38 - 'title' => __( 'Default layout', 'tier-pricing-table' ),
68 + 'title' => __( 'Default visual layout', 'tier-pricing-table' ),
39 69 'id' => Settings::SETTINGS_PREFIX . 'display_type',
40 70 'type' => TPTDisplayType::FIELD_TYPE,
41 71 'options' => TierPricingTablePlugin::getAvailablePricingLayouts(),
42 72 'desc' => __( 'Choose the default visual layout. You can also customize this individually per product.',
@@ -44,58 +74,54 @@
44 74 'desc_tip' => true,
45 75 'default' => 'table',
46 76 ),
47 77 array(
48 - 'title' => __( 'Pricing options style', 'tier-pricing-table' ),
78 + 'title' => __( 'Options design style', 'tier-pricing-table' ),
49 79 'id' => Settings::SETTINGS_PREFIX . 'pricing_options_style',
50 80 'type' => TPTDisplayType::FIELD_TYPE,
51 - 'options' => array(
52 - 'default' => __( 'Default', 'tier-pricing-table' ),
53 - 'style-1' => __( 'Style #1', 'tier-pricing-table' ),
54 - 'style-2' => __( 'Style #2', 'tier-pricing-table' ),
55 - 'style-3' => __( 'Style #3', 'tier-pricing-table' ),
56 - ),
81 + 'options' => GeneralSection::getStyleOptions()['options'],
57 82 'desc_tip' => true,
58 83 'default' => 'default',
59 84 ),
60 85 array(
61 - 'title' => __( 'Pricing table style', 'tier-pricing-table' ),
86 + 'title' => __( 'Table design style', 'tier-pricing-table' ),
62 87 'id' => Settings::SETTINGS_PREFIX . 'pricing_table_style',
63 88 'type' => TPTDisplayType::FIELD_TYPE,
64 - 'options' => array(
65 - 'default' => __( 'Default', 'tier-pricing-table' ),
66 - 'style-1' => __( 'Style #1', 'tier-pricing-table' ),
67 - 'style-2' => __( 'Style #2', 'tier-pricing-table' ),
68 - 'style-3' => __( 'Style #3', 'tier-pricing-table' ),
69 - 'style-4' => __( 'Style #4', 'tier-pricing-table' ),
70 - ),
89 + 'options' => GeneralSection::getStyleOptions()['table'],
71 90 'desc_tip' => true,
72 91 'default' => 'default',
73 92 ),
74 93 array(
75 - 'title' => __( 'Compact layout', 'tier-pricing-table' ),
76 - 'id' => Settings::SETTINGS_PREFIX . 'slim_design',
77 - 'type' => TPTSwitchOption::FIELD_TYPE,
78 - 'default' => 'no',
79 - 'desc' => __( 'Apply a compact layout to the tiered pricing table or blocks.', 'tier-pricing-table' ),
94 + 'title' => __( 'Blocks design style', 'tier-pricing-table' ),
95 + 'id' => Settings::SETTINGS_PREFIX . 'pricing_blocks_style',
96 + 'type' => TPTDisplayType::FIELD_TYPE,
97 + 'options' => GeneralSection::getStyleOptions()['blocks'],
98 + 'desc_tip' => true,
99 + 'default' => 'default',
80 100 ),
81 101 array(
82 - 'title' => __( 'Pricing blocks style', 'tier-pricing-table' ),
83 - 'id' => Settings::SETTINGS_PREFIX . 'pricing_blocks_style',
102 + 'title' => __( 'Dropdown design style', 'tier-pricing-table' ),
103 + 'id' => Settings::SETTINGS_PREFIX . 'pricing_dropdown_style',
84 104 'type' => TPTDisplayType::FIELD_TYPE,
85 - 'options' => array(
86 - 'default' => __( 'Default', 'tier-pricing-table' ),
87 - 'style-1' => __( 'Style #1', 'tier-pricing-table' ),
88 - 'style-2' => __( 'Style #2', 'tier-pricing-table' ),
89 - 'style-3' => __( 'Style #3', 'tier-pricing-table' ),
90 - 'style-4' => __( 'Style #4', 'tier-pricing-table' ),
91 - 'style-5' => __( 'Style #5', 'tier-pricing-table' ),
92 - ),
93 - 'desc_tip' => true,
105 + 'options' => GeneralSection::getStyleOptions()['dropdown'],
94 106 'default' => 'default',
95 107 ),
96 108 array(
97 - 'title' => __( 'Pricing title', 'tier-pricing-table' ),
109 + 'title' => __( 'Plain text design style', 'tier-pricing-table' ),
110 + 'id' => Settings::SETTINGS_PREFIX . 'pricing_plain_text_style',
111 + 'type' => TPTDisplayType::FIELD_TYPE,
112 + 'options' => GeneralSection::getStyleOptions()['plain-text'],
113 + 'default' => 'default',
114 + ),
115 + array(
116 + 'title' => __( 'Enable compact layout', 'tier-pricing-table' ),
117 + 'id' => Settings::SETTINGS_PREFIX . 'compact_layout',
118 + 'type' => TPTSwitchOption::FIELD_TYPE,
119 + 'default' => 'no',
120 + 'desc' => __( 'Apply a space-saving compact design for the selected layout.', 'tier-pricing-table' ),
121 + ),
122 + array(
123 + 'title' => __( 'Layout title', 'tier-pricing-table' ),
98 124 'id' => Settings::SETTINGS_PREFIX . 'table_title',
99 125 'type' => 'text',
100 126 'default' => '',
101 127 'desc_tip' => true,
@@ -100,9 +126,9 @@
100 126 'default' => '',
101 127 'desc_tip' => true,
102 128 ),
103 129 array(
104 - 'title' => __( 'Position on the product page', 'tier-pricing-table' ),
130 + 'title' => __( 'Layout position', 'tier-pricing-table' ),
105 131 'id' => Settings::SETTINGS_PREFIX . 'position_hook',
106 132 'type' => 'select',
107 133 'options' => array(
108 134 'woocommerce_before_add_to_cart_button' => __( 'Above add to cart button', 'tier-pricing-table' ),
@@ -119,9 +145,9 @@
119 145 'tier-pricing-table' ),
120 146 'desc_tip' => true,
121 147 ),
122 148 array(
123 - 'title' => __( 'Quantity display type', 'tier-pricing-table' ),
149 + 'title' => __( 'Quantity format', 'tier-pricing-table' ),
124 150 'id' => Settings::SETTINGS_PREFIX . 'quantity_type',
125 151 'type' => TPTDisplayType::FIELD_TYPE,
126 152 'options' => array(
127 153 'range' => __( 'Range', 'tier-pricing-table' ),
@@ -132,8 +158,40 @@
132 158 'desc_tip' => false,
133 159 'default' => 'range',
134 160 ),
135 161 array(
162 + 'title' => __( 'Spacing', 'tier-pricing-table' ),
163 + 'id' => Settings::SETTINGS_PREFIX . 'layout_spacing',
164 + 'type' => 'number',
165 + 'default' => '',
166 + 'css' => 'width: 6em;',
167 + 'custom_attributes' => array( 'min' => 0, 'max' => 40, 'step' => 1, 'placeholder' => __( 'Auto', 'tier-pricing-table' ) ),
168 + 'desc' => __( 'Gap between the pricing blocks, options or card rows, in pixels. Leave empty to keep each design style\'s own spacing.', 'tier-pricing-table' ),
169 + ),
170 + array(
171 + 'title' => __( 'Cell padding', 'tier-pricing-table' ),
172 + 'id' => Settings::SETTINGS_PREFIX . 'cell_padding',
173 + 'type' => 'number',
174 + 'default' => '',
175 + 'css' => 'width: 6em;',
176 + 'custom_attributes' => array( 'min' => 0, 'max' => 30, 'step' => 1, 'placeholder' => __( 'Auto', 'tier-pricing-table' ) ),
177 + 'desc' => __( 'Padding inside the cells of the table and horizontal table layouts, in pixels. Leave empty to keep each design style\'s own padding; a value also overrides the theme\'s cell padding.', 'tier-pricing-table' ),
178 + ),
179 + array(
180 + 'title' => __( 'Tier order', 'tier-pricing-table' ),
181 + 'id' => Settings::SETTINGS_PREFIX . 'tiers_order',
182 + 'type' => TPTDisplayType::FIELD_TYPE,
183 + 'options' => array(
184 + 'asc' => __( 'Ascending', 'tier-pricing-table' ),
185 + 'desc' => __( 'Descending', 'tier-pricing-table' ),
186 + ),
187 + 'descriptions' => array(
188 + 'asc' => __( 'Smallest quantity first', 'tier-pricing-table' ),
189 + 'desc' => __( 'Biggest discount first', 'tier-pricing-table' ),
190 + ),
191 + 'default' => 'asc',
192 + ),
193 + array(
136 194 'title' => __( 'Active pricing tier color', 'tier-pricing-table' ),
137 195 'id' => Settings::SETTINGS_PREFIX . 'selected_quantity_color',
138 196 'type' => 'color',
139 197 'css' => 'width:6em;',
@@ -139,8 +197,23 @@
139 197 'css' => 'width:6em;',
140 198 'default' => '#3858e9',
141 199 ),
142 200 array(
201 + 'title' => __( 'Discount badge color', 'tier-pricing-table' ),
202 + 'id' => Settings::SETTINGS_PREFIX . 'discount_badge_color',
203 + 'type' => 'color',
204 + 'css' => 'width:6em;',
205 + 'default' => '',
206 + 'desc' => __( 'The discount badge of table styles #2 to #6. Styles #2 and #6 show a light tint of this color behind text in this color, styles #3 and #4 a solid badge with white text, style #5 colors its savings bar and percentage. Leave empty to keep the style\'s own colors (the active tier color on styles #3 to #5).', 'tier-pricing-table' ),
207 + ),
208 + array(
209 + 'title' => __( 'Active tier left border', 'tier-pricing-table' ),
210 + 'id' => Settings::SETTINGS_PREFIX . 'table_active_border',
211 + 'type' => TPTSwitchOption::FIELD_TYPE,
212 + 'default' => 'yes',
213 + 'desc' => __( 'Table styles #1, #5 and #6 mark the active tier with a left border in the active tier color. Switch it off to keep the row highlight only.', 'tier-pricing-table' ),
214 + ),
215 + array(
143 216 'title' => __( 'Tooltip icon color', 'tier-pricing-table' ),
144 217 'id' => Settings::SETTINGS_PREFIX . 'tooltip_color',
145 218 'type' => 'color',
146 219 'default' => '#3858e9',
@@ -163,9 +236,9 @@
163 236 'type' => TPTSwitchOption::FIELD_TYPE,
164 237 'default' => 'yes',
165 238 ),
166 239 array(
167 - 'title' => __( 'Unit label', 'tier-pricing-table' ),
240 + 'title' => __( 'Quantity unit label', 'tier-pricing-table' ),
168 241 'id' => Settings::SETTINGS_PREFIX . 'table_quantity_measurement',
169 242 'type' => TPTQuantityMeasurementField::FIELD_TYPE,
170 243 'default' => array(
171 244 'singular' => '',
@@ -174,9 +247,9 @@
174 247 'desc' => __( 'For example: pieces, boxes, bottles, packs, etc. This will be shown next to quantity values. Leave blank to skip adding a unit label.',
175 248 'tier-pricing-table' ),
176 249 ),
177 250 array(
178 - 'title' => __( 'Unit label', 'tier-pricing-table' ),
251 + 'title' => __( 'Quantity unit label', 'tier-pricing-table' ),
179 252 'id' => Settings::SETTINGS_PREFIX . 'blocks_quantity_measurement',
180 253 'type' => TPTQuantityMeasurementField::FIELD_TYPE,
181 254 'default' => array(
182 255 'singular' => _n( 'piece', 'pieces', 1, 'tier-pricing-table' ),
@@ -185,9 +258,9 @@
185 258 'desc' => __( 'For example: pieces, boxes, bottles, packs, etc. This will be shown next to quantity values. Leave blank to skip adding a unit label.',
186 259 'tier-pricing-table' ),
187 260 ),
188 261 array(
189 - 'title' => __( 'Columns titles', 'tier-pricing-table' ),
262 + 'title' => __( 'Table column headers', 'tier-pricing-table' ),
190 263 'id' => Settings::SETTINGS_PREFIX . 'table_columns_titles',
191 264 'options' => array(
192 265 array(
193 266 'label' => __( 'Quantity', 'tier-pricing-table' ),
@@ -204,38 +277,56 @@
204 277 'id' => Settings::SETTINGS_PREFIX . 'head_price_text',
205 278 'default' => __( 'Price', 'tier-pricing-table' ),
206 279 ),
207 280 ),
208 - 'desc' => __( 'Leave a column title empty so as not to show that column.', 'tier-pricing-table' ),
281 + 'desc' => __( 'Leave a column title empty to hide that column entirely.', 'tier-pricing-table' ),
209 282 'type' => TPTTableColumnsField::FIELD_TYPE,
210 283 ),
211 284 array(
212 - 'title' => __( 'Show percentage discount', 'tier-pricing-table' ),
285 + 'title' => __( 'Show discount', 'tier-pricing-table' ),
213 286 'id' => Settings::SETTINGS_PREFIX . 'show_discount_column',
214 287 'type' => TPTSwitchOption::FIELD_TYPE,
215 288 'default' => 'yes',
216 - 'desc' => __( 'Show the percentage discount in pricing blocks that offer a discount.',
289 + 'desc' => __( 'Show the discount in pricing blocks that offer a discount.',
217 290 'tier-pricing-table' ),
218 291 ),
219 292 array(
220 - 'title' => __( 'Show regular product price', 'tier-pricing-table' ),
293 + 'title' => __( 'Discount format', 'tier-pricing-table' ),
294 + 'id' => Settings::SETTINGS_PREFIX . 'discount_format',
295 + 'type' => TPTDisplayType::FIELD_TYPE,
296 + 'options' => array(
297 + 'percentage' => __( 'Percentage', 'tier-pricing-table' ),
298 + 'amount' => __( 'Amount saved', 'tier-pricing-table' ),
299 + 'both' => __( 'Both', 'tier-pricing-table' ),
300 + ),
301 + 'descriptions' => array(
302 + 'percentage' => __( 'e.g. 10%', 'tier-pricing-table' ),
303 + 'amount' => __( 'e.g. $4.50', 'tier-pricing-table' ),
304 + 'both' => __( 'e.g. 10% ($4.50)', 'tier-pricing-table' ),
305 + ),
306 + 'desc' => __( 'How the discount column and discount badges show a tier\'s discount.', 'tier-pricing-table' ),
307 + 'desc_tip' => false,
308 + 'default' => 'percentage',
309 + ),
310 + array(
311 + 'title' => __( 'Show original price crossed out', 'tier-pricing-table' ),
221 312 'id' => Settings::SETTINGS_PREFIX . 'options_show_original_product_price',
222 313 'type' => TPTSwitchOption::FIELD_TYPE,
223 314 'default' => 'yes',
224 - 'desc' => __( 'Pricing options will show a crossed-out regular product price near the actual tier price.',
315 + 'desc' => __( 'Pricing options will show a crossed-out regular price next to the discounted tier price.',
225 316 'tier-pricing-table' ),
226 317 ),
227 318
228 319 array(
229 - 'title' => __( 'Show totals in a selected option', 'tier-pricing-table' ),
320 + 'title' => __( 'Show total calculated price for selected option', 'tier-pricing-table' ),
230 321 'id' => Settings::SETTINGS_PREFIX . 'options_show_total',
231 322 'type' => TPTSwitchOption::FIELD_TYPE,
232 323 'default' => 'yes',
233 - 'desc' => __( 'The selected pricing option will include totals.', 'tier-pricing-table' ),
324 + 'desc' => __( 'The selected pricing option will dynamically display the total calculated cost.', 'tier-pricing-table' ),
234 325 'custom_attributes' => [ 'data-tiered-pricing-premium-option' => true ],
235 326 ),
236 327 array(
237 - 'title' => __( 'Pricing option template', 'tier-pricing-table' ),
328 + 'title' => __( 'Pricing option text template', 'tier-pricing-table' ),
238 329 'id' => Settings::SETTINGS_PREFIX . 'options_option_text',
239 330 'default' => __( '<strong>Buy {tp_quantity} pieces and save {tp_rounded_discount}%</strong>',
240 331 'tier-pricing-table' ),
241 332 'placeholders' => array(
@@ -248,17 +339,17 @@
248 339 'desc' => __( 'Use the variables above to build the template for the pricing option.',
249 340 'tier-pricing-table' ),
250 341 ),
251 342 array(
252 - 'title' => __( 'Show first tier pricing option', 'tier-pricing-table' ),
343 + 'title' => __( 'Show base price (no discount) option', 'tier-pricing-table' ),
253 344 'id' => Settings::SETTINGS_PREFIX . 'options_show_default_option',
254 345 'type' => TPTSwitchOption::FIELD_TYPE,
255 346 'default' => 'yes',
256 - 'desc' => __( 'Show the option with a regular product price. This is the first pricing tier where no discount is offered.',
347 + 'desc' => __( 'Display an option for the regular product price (e.g. 1 item) where no tier discount is applied.',
257 348 'tier-pricing-table' ),
258 349 ),
259 350 array(
260 - 'title' => __( 'First tier pricing option template', 'tier-pricing-table' ),
351 + 'title' => __( 'Base price option template', 'tier-pricing-table' ),
261 352 'id' => Settings::SETTINGS_PREFIX . 'options_default_option_text',
262 353 'default' => __( '<strong>Buy {tp_quantity} pieces</strong>', 'tier-pricing-table' ),
263 354 'placeholders' => array(
264 355 'tp_quantity',
@@ -264,9 +355,9 @@
264 355 'tp_quantity',
265 356 'tp_base_unit_name',
266 357 ),
267 358 'type' => TPTTextTemplate::FIELD_TYPE,
268 - 'desc' => __( 'Set up the first pricing tier template where a discount is not offered.',
359 + 'desc' => __( 'Customize the template for the base price option.',
269 360 'tier-pricing-table' ),
270 361 ),
271 362 array(
272 363 'title' => __( 'Pricing string template', 'tier-pricing-table' ),
@@ -307,13 +398,13 @@
307 398 'desc' => __( 'Set up the first pricing tier template where a discount is not offered.',
308 399 'tier-pricing-table' ),
309 400 ),
310 401 array(
311 - 'title' => __( 'Clickable tiered pricing', 'tier-pricing-table' ),
402 + 'title' => __( 'Make pricing tiers clickable', 'tier-pricing-table' ),
312 403 'id' => Settings::SETTINGS_PREFIX . 'clickable_table_rows',
313 404 'type' => TPTSwitchOption::FIELD_TYPE,
314 405 'default' => 'yes',
315 - 'desc' => __( 'To select the quantity, tiered pricing becomes clickable (table rows, blocks, options).',
406 + 'desc' => __( 'Allow customers to click on a pricing tier (table row, block, or option) to automatically select that quantity.',
316 407 'tier-pricing-table' ),
317 408 'custom_attributes' => [ 'data-tiered-pricing-premium-option' => true ],
318 409 ),
319 410 );