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 +142 -52 6.5.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' => __( 'Pricing 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,59 +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 - 'style-4' => __( 'Style #4', 'tier-pricing-table' ),
57 - ),
81 + 'options' => GeneralSection::getStyleOptions()['options'],
58 82 'desc_tip' => true,
59 83 'default' => 'default',
60 84 ),
61 85 array(
62 - 'title' => __( 'Pricing table style', 'tier-pricing-table' ),
86 + 'title' => __( 'Table design style', 'tier-pricing-table' ),
63 87 'id' => Settings::SETTINGS_PREFIX . 'pricing_table_style',
64 88 'type' => TPTDisplayType::FIELD_TYPE,
65 - 'options' => array(
66 - 'default' => __( 'Default', 'tier-pricing-table' ),
67 - 'style-1' => __( 'Style #1', 'tier-pricing-table' ),
68 - 'style-2' => __( 'Style #2', 'tier-pricing-table' ),
69 - 'style-3' => __( 'Style #3', 'tier-pricing-table' ),
70 - 'style-4' => __( 'Style #4', 'tier-pricing-table' ),
71 - ),
89 + 'options' => GeneralSection::getStyleOptions()['table'],
72 90 'desc_tip' => true,
73 91 'default' => 'default',
74 92 ),
75 93 array(
76 - 'title' => __( 'Pricing blocks style', 'tier-pricing-table' ),
94 + 'title' => __( 'Blocks design style', 'tier-pricing-table' ),
77 95 'id' => Settings::SETTINGS_PREFIX . 'pricing_blocks_style',
78 96 'type' => TPTDisplayType::FIELD_TYPE,
79 - 'options' => array(
80 - 'default' => __( 'Default', 'tier-pricing-table' ),
81 - 'style-1' => __( 'Style #1', 'tier-pricing-table' ),
82 - 'style-2' => __( 'Style #2', 'tier-pricing-table' ),
83 - 'style-3' => __( 'Style #3', 'tier-pricing-table' ),
84 - 'style-4' => __( 'Style #4', 'tier-pricing-table' ),
85 - 'style-5' => __( 'Style #5', 'tier-pricing-table' ),
86 - ),
97 + 'options' => GeneralSection::getStyleOptions()['blocks'],
87 98 'desc_tip' => true,
88 99 'default' => 'default',
89 100 ),
90 101 array(
91 - 'title' => __( 'Compact layout', 'tier-pricing-table' ),
102 + 'title' => __( 'Dropdown design style', 'tier-pricing-table' ),
103 + 'id' => Settings::SETTINGS_PREFIX . 'pricing_dropdown_style',
104 + 'type' => TPTDisplayType::FIELD_TYPE,
105 + 'options' => GeneralSection::getStyleOptions()['dropdown'],
106 + 'default' => 'default',
107 + ),
108 + array(
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' ),
92 117 'id' => Settings::SETTINGS_PREFIX . 'compact_layout',
93 118 'type' => TPTSwitchOption::FIELD_TYPE,
94 119 'default' => 'no',
95 - 'desc' => __( 'Apply a compact layout to the tiered pricing.', 'tier-pricing-table' ),
120 + 'desc' => __( 'Apply a space-saving compact design for the selected layout.', 'tier-pricing-table' ),
96 121 ),
97 122 array(
98 - 'title' => __( 'Pricing title', 'tier-pricing-table' ),
123 + 'title' => __( 'Layout title', 'tier-pricing-table' ),
99 124 'id' => Settings::SETTINGS_PREFIX . 'table_title',
100 125 'type' => 'text',
101 126 'default' => '',
102 127 'desc_tip' => true,
@@ -101,9 +126,9 @@
101 126 'default' => '',
102 127 'desc_tip' => true,
103 128 ),
104 129 array(
105 - 'title' => __( 'Position on the product page', 'tier-pricing-table' ),
130 + 'title' => __( 'Layout position', 'tier-pricing-table' ),
106 131 'id' => Settings::SETTINGS_PREFIX . 'position_hook',
107 132 'type' => 'select',
108 133 'options' => array(
109 134 'woocommerce_before_add_to_cart_button' => __( 'Above add to cart button', 'tier-pricing-table' ),
@@ -120,9 +145,9 @@
120 145 'tier-pricing-table' ),
121 146 'desc_tip' => true,
122 147 ),
123 148 array(
124 - 'title' => __( 'Quantity display type', 'tier-pricing-table' ),
149 + 'title' => __( 'Quantity format', 'tier-pricing-table' ),
125 150 'id' => Settings::SETTINGS_PREFIX . 'quantity_type',
126 151 'type' => TPTDisplayType::FIELD_TYPE,
127 152 'options' => array(
128 153 'range' => __( 'Range', 'tier-pricing-table' ),
@@ -133,8 +158,40 @@
133 158 'desc_tip' => false,
134 159 'default' => 'range',
135 160 ),
136 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(
137 194 'title' => __( 'Active pricing tier color', 'tier-pricing-table' ),
138 195 'id' => Settings::SETTINGS_PREFIX . 'selected_quantity_color',
139 196 'type' => 'color',
140 197 'css' => 'width:6em;',
@@ -140,8 +197,23 @@
140 197 'css' => 'width:6em;',
141 198 'default' => '#3858e9',
142 199 ),
143 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(
144 216 'title' => __( 'Tooltip icon color', 'tier-pricing-table' ),
145 217 'id' => Settings::SETTINGS_PREFIX . 'tooltip_color',
146 218 'type' => 'color',
147 219 'default' => '#3858e9',
@@ -164,9 +236,9 @@
164 236 'type' => TPTSwitchOption::FIELD_TYPE,
165 237 'default' => 'yes',
166 238 ),
167 239 array(
168 - 'title' => __( 'Unit label', 'tier-pricing-table' ),
240 + 'title' => __( 'Quantity unit label', 'tier-pricing-table' ),
169 241 'id' => Settings::SETTINGS_PREFIX . 'table_quantity_measurement',
170 242 'type' => TPTQuantityMeasurementField::FIELD_TYPE,
171 243 'default' => array(
172 244 'singular' => '',
@@ -175,9 +247,9 @@
175 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.',
176 248 'tier-pricing-table' ),
177 249 ),
178 250 array(
179 - 'title' => __( 'Unit label', 'tier-pricing-table' ),
251 + 'title' => __( 'Quantity unit label', 'tier-pricing-table' ),
180 252 'id' => Settings::SETTINGS_PREFIX . 'blocks_quantity_measurement',
181 253 'type' => TPTQuantityMeasurementField::FIELD_TYPE,
182 254 'default' => array(
183 255 'singular' => _n( 'piece', 'pieces', 1, 'tier-pricing-table' ),
@@ -186,9 +258,9 @@
186 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.',
187 259 'tier-pricing-table' ),
188 260 ),
189 261 array(
190 - 'title' => __( 'Columns titles', 'tier-pricing-table' ),
262 + 'title' => __( 'Table column headers', 'tier-pricing-table' ),
191 263 'id' => Settings::SETTINGS_PREFIX . 'table_columns_titles',
192 264 'options' => array(
193 265 array(
194 266 'label' => __( 'Quantity', 'tier-pricing-table' ),
@@ -205,38 +277,56 @@
205 277 'id' => Settings::SETTINGS_PREFIX . 'head_price_text',
206 278 'default' => __( 'Price', 'tier-pricing-table' ),
207 279 ),
208 280 ),
209 - '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' ),
210 282 'type' => TPTTableColumnsField::FIELD_TYPE,
211 283 ),
212 284 array(
213 - 'title' => __( 'Show percentage discount', 'tier-pricing-table' ),
285 + 'title' => __( 'Show discount', 'tier-pricing-table' ),
214 286 'id' => Settings::SETTINGS_PREFIX . 'show_discount_column',
215 287 'type' => TPTSwitchOption::FIELD_TYPE,
216 288 'default' => 'yes',
217 - 'desc' => __( 'Show the percentage discount in pricing blocks that offer a discount.',
289 + 'desc' => __( 'Show the discount in pricing blocks that offer a discount.',
218 290 'tier-pricing-table' ),
219 291 ),
220 292 array(
221 - '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' ),
222 312 'id' => Settings::SETTINGS_PREFIX . 'options_show_original_product_price',
223 313 'type' => TPTSwitchOption::FIELD_TYPE,
224 314 'default' => 'yes',
225 - '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.',
226 316 'tier-pricing-table' ),
227 317 ),
228 318
229 319 array(
230 - 'title' => __( 'Show totals in a selected option', 'tier-pricing-table' ),
320 + 'title' => __( 'Show total calculated price for selected option', 'tier-pricing-table' ),
231 321 'id' => Settings::SETTINGS_PREFIX . 'options_show_total',
232 322 'type' => TPTSwitchOption::FIELD_TYPE,
233 323 'default' => 'yes',
234 - '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' ),
235 325 'custom_attributes' => [ 'data-tiered-pricing-premium-option' => true ],
236 326 ),
237 327 array(
238 - 'title' => __( 'Pricing option template', 'tier-pricing-table' ),
328 + 'title' => __( 'Pricing option text template', 'tier-pricing-table' ),
239 329 'id' => Settings::SETTINGS_PREFIX . 'options_option_text',
240 330 'default' => __( '<strong>Buy {tp_quantity} pieces and save {tp_rounded_discount}%</strong>',
241 331 'tier-pricing-table' ),
242 332 'placeholders' => array(
@@ -249,17 +339,17 @@
249 339 'desc' => __( 'Use the variables above to build the template for the pricing option.',
250 340 'tier-pricing-table' ),
251 341 ),
252 342 array(
253 - 'title' => __( 'Show first tier pricing option', 'tier-pricing-table' ),
343 + 'title' => __( 'Show base price (no discount) option', 'tier-pricing-table' ),
254 344 'id' => Settings::SETTINGS_PREFIX . 'options_show_default_option',
255 345 'type' => TPTSwitchOption::FIELD_TYPE,
256 346 'default' => 'yes',
257 - '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.',
258 348 'tier-pricing-table' ),
259 349 ),
260 350 array(
261 - 'title' => __( 'First tier pricing option template', 'tier-pricing-table' ),
351 + 'title' => __( 'Base price option template', 'tier-pricing-table' ),
262 352 'id' => Settings::SETTINGS_PREFIX . 'options_default_option_text',
263 353 'default' => __( '<strong>Buy {tp_quantity} pieces</strong>', 'tier-pricing-table' ),
264 354 'placeholders' => array(
265 355 'tp_quantity',
@@ -265,9 +355,9 @@
265 355 'tp_quantity',
266 356 'tp_base_unit_name',
267 357 ),
268 358 'type' => TPTTextTemplate::FIELD_TYPE,
269 - 'desc' => __( 'Set up the first pricing tier template where a discount is not offered.',
359 + 'desc' => __( 'Customize the template for the base price option.',
270 360 'tier-pricing-table' ),
271 361 ),
272 362 array(
273 363 'title' => __( 'Pricing string template', 'tier-pricing-table' ),
@@ -308,13 +398,13 @@
308 398 'desc' => __( 'Set up the first pricing tier template where a discount is not offered.',
309 399 'tier-pricing-table' ),
310 400 ),
311 401 array(
312 - 'title' => __( 'Clickable tiered pricing', 'tier-pricing-table' ),
402 + 'title' => __( 'Make pricing tiers clickable', 'tier-pricing-table' ),
313 403 'id' => Settings::SETTINGS_PREFIX . 'clickable_table_rows',
314 404 'type' => TPTSwitchOption::FIELD_TYPE,
315 405 'default' => 'yes',
316 - '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.',
317 407 'tier-pricing-table' ),
318 408 'custom_attributes' => [ 'data-tiered-pricing-premium-option' => true ],
319 409 ),
320 410 );