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 +156 -44 6.1.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 __( 'Template options', '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 __( 'Choose a tiered pricing template and customize its look and behavior.', '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,65 +33,102 @@
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' => __( 'Show 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 template', '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 - 'desc' => __( 'Default tiered pricing template. Template can be customized individually per product.',
72 + 'desc' => __( 'Choose the default visual layout. You can also customize this individually per product.',
43 73 'tier-pricing-table' ),
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 blocks style', 'tier-pricing-table' ),
86 + 'title' => __( 'Table design style', 'tier-pricing-table' ),
87 + 'id' => Settings::SETTINGS_PREFIX . 'pricing_table_style',
88 + 'type' => TPTDisplayType::FIELD_TYPE,
89 + 'options' => GeneralSection::getStyleOptions()['table'],
90 + 'desc_tip' => true,
91 + 'default' => 'default',
92 + ),
93 + array(
94 + 'title' => __( 'Blocks design style', 'tier-pricing-table' ),
62 95 'id' => Settings::SETTINGS_PREFIX . 'pricing_blocks_style',
63 96 '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 - ),
97 + 'options' => GeneralSection::getStyleOptions()['blocks'],
71 98 'desc_tip' => true,
72 99 'default' => 'default',
73 100 ),
74 101 array(
75 - 'title' => __( 'Pricing title', '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' ),
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' ),
76 124 'id' => Settings::SETTINGS_PREFIX . 'table_title',
77 125 'type' => 'text',
78 126 'default' => '',
79 - 'desc' => __( 'The title is shown above the tiered pricing.', 'tier-pricing-table' ),
80 127 'desc_tip' => true,
81 128 ),
82 129 array(
83 - 'title' => __( 'Position on the product page', 'tier-pricing-table' ),
130 + 'title' => __( 'Layout position', 'tier-pricing-table' ),
84 131 'id' => Settings::SETTINGS_PREFIX . 'position_hook',
85 132 'type' => 'select',
86 133 'options' => array(
87 134 'woocommerce_before_add_to_cart_button' => __( 'Above add to cart button', 'tier-pricing-table' ),
@@ -98,9 +145,9 @@
98 145 'tier-pricing-table' ),
99 146 'desc_tip' => true,
100 147 ),
101 148 array(
102 - 'title' => __( 'Quantity display type', 'tier-pricing-table' ),
149 + 'title' => __( 'Quantity format', 'tier-pricing-table' ),
103 150 'id' => Settings::SETTINGS_PREFIX . 'quantity_type',
104 151 'type' => TPTDisplayType::FIELD_TYPE,
105 152 'options' => array(
106 153 'range' => __( 'Range', 'tier-pricing-table' ),
@@ -111,19 +158,66 @@
111 158 'desc_tip' => false,
112 159 'default' => 'range',
113 160 ),
114 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(
115 194 'title' => __( 'Active pricing tier color', 'tier-pricing-table' ),
116 195 'id' => Settings::SETTINGS_PREFIX . 'selected_quantity_color',
117 196 'type' => 'color',
118 197 'css' => 'width:6em;',
119 - 'default' => '#96598A',
198 + 'default' => '#3858e9',
120 199 ),
121 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(
122 216 'title' => __( 'Tooltip icon color', 'tier-pricing-table' ),
123 217 'id' => Settings::SETTINGS_PREFIX . 'tooltip_color',
124 218 'type' => 'color',
125 - 'default' => '#96598A',
219 + 'default' => '#3858e9',
126 220 'css' => 'width:6em;',
127 221 'desc' => __( 'Color of the icon.', 'tier-pricing-table' ),
128 222 'desc_tip' => true,
129 223 ),
@@ -142,9 +236,9 @@
142 236 'type' => TPTSwitchOption::FIELD_TYPE,
143 237 'default' => 'yes',
144 238 ),
145 239 array(
146 - 'title' => __( 'Unit label', 'tier-pricing-table' ),
240 + 'title' => __( 'Quantity unit label', 'tier-pricing-table' ),
147 241 'id' => Settings::SETTINGS_PREFIX . 'table_quantity_measurement',
148 242 'type' => TPTQuantityMeasurementField::FIELD_TYPE,
149 243 'default' => array(
150 244 'singular' => '',
@@ -153,9 +247,9 @@
153 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.',
154 248 'tier-pricing-table' ),
155 249 ),
156 250 array(
157 - 'title' => __( 'Unit label', 'tier-pricing-table' ),
251 + 'title' => __( 'Quantity unit label', 'tier-pricing-table' ),
158 252 'id' => Settings::SETTINGS_PREFIX . 'blocks_quantity_measurement',
159 253 'type' => TPTQuantityMeasurementField::FIELD_TYPE,
160 254 'default' => array(
161 255 'singular' => _n( 'piece', 'pieces', 1, 'tier-pricing-table' ),
@@ -164,9 +258,9 @@
164 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.',
165 259 'tier-pricing-table' ),
166 260 ),
167 261 array(
168 - 'title' => __( 'Columns titles', 'tier-pricing-table' ),
262 + 'title' => __( 'Table column headers', 'tier-pricing-table' ),
169 263 'id' => Settings::SETTINGS_PREFIX . 'table_columns_titles',
170 264 'options' => array(
171 265 array(
172 266 'label' => __( 'Quantity', 'tier-pricing-table' ),
@@ -183,38 +277,56 @@
183 277 'id' => Settings::SETTINGS_PREFIX . 'head_price_text',
184 278 'default' => __( 'Price', 'tier-pricing-table' ),
185 279 ),
186 280 ),
187 - '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' ),
188 282 'type' => TPTTableColumnsField::FIELD_TYPE,
189 283 ),
190 284 array(
191 - 'title' => __( 'Show percentage discount', 'tier-pricing-table' ),
285 + 'title' => __( 'Show discount', 'tier-pricing-table' ),
192 286 'id' => Settings::SETTINGS_PREFIX . 'show_discount_column',
193 287 'type' => TPTSwitchOption::FIELD_TYPE,
194 288 'default' => 'yes',
195 - 'desc' => __( 'Show the percentage discount in pricing blocks that offer a discount.',
289 + 'desc' => __( 'Show the discount in pricing blocks that offer a discount.',
196 290 'tier-pricing-table' ),
197 291 ),
198 292 array(
199 - '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' ),
200 312 'id' => Settings::SETTINGS_PREFIX . 'options_show_original_product_price',
201 313 'type' => TPTSwitchOption::FIELD_TYPE,
202 314 'default' => 'yes',
203 - '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.',
204 316 'tier-pricing-table' ),
205 317 ),
206 318
207 319 array(
208 - 'title' => __( 'Show totals in a selected option', 'tier-pricing-table' ),
320 + 'title' => __( 'Show total calculated price for selected option', 'tier-pricing-table' ),
209 321 'id' => Settings::SETTINGS_PREFIX . 'options_show_total',
210 322 'type' => TPTSwitchOption::FIELD_TYPE,
211 323 'default' => 'yes',
212 - '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' ),
213 325 'custom_attributes' => [ 'data-tiered-pricing-premium-option' => true ],
214 326 ),
215 327 array(
216 - 'title' => __( 'Pricing option template', 'tier-pricing-table' ),
328 + 'title' => __( 'Pricing option text template', 'tier-pricing-table' ),
217 329 'id' => Settings::SETTINGS_PREFIX . 'options_option_text',
218 330 'default' => __( '<strong>Buy {tp_quantity} pieces and save {tp_rounded_discount}%</strong>',
219 331 'tier-pricing-table' ),
220 332 'placeholders' => array(
@@ -227,17 +339,17 @@
227 339 'desc' => __( 'Use the variables above to build the template for the pricing option.',
228 340 'tier-pricing-table' ),
229 341 ),
230 342 array(
231 - 'title' => __( 'Show first tier pricing option', 'tier-pricing-table' ),
343 + 'title' => __( 'Show base price (no discount) option', 'tier-pricing-table' ),
232 344 'id' => Settings::SETTINGS_PREFIX . 'options_show_default_option',
233 345 'type' => TPTSwitchOption::FIELD_TYPE,
234 346 'default' => 'yes',
235 - '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.',
236 348 'tier-pricing-table' ),
237 349 ),
238 350 array(
239 - 'title' => __( 'First tier pricing option template', 'tier-pricing-table' ),
351 + 'title' => __( 'Base price option template', 'tier-pricing-table' ),
240 352 'id' => Settings::SETTINGS_PREFIX . 'options_default_option_text',
241 353 'default' => __( '<strong>Buy {tp_quantity} pieces</strong>', 'tier-pricing-table' ),
242 354 'placeholders' => array(
243 355 'tp_quantity',
@@ -243,9 +355,9 @@
243 355 'tp_quantity',
244 356 'tp_base_unit_name',
245 357 ),
246 358 'type' => TPTTextTemplate::FIELD_TYPE,
247 - 'desc' => __( 'Set up the first pricing tier template where a discount is not offered.',
359 + 'desc' => __( 'Customize the template for the base price option.',
248 360 'tier-pricing-table' ),
249 361 ),
250 362 array(
251 363 'title' => __( 'Pricing string template', 'tier-pricing-table' ),
@@ -286,13 +398,13 @@
286 398 'desc' => __( 'Set up the first pricing tier template where a discount is not offered.',
287 399 'tier-pricing-table' ),
288 400 ),
289 401 array(
290 - 'title' => __( 'Clickable tiered pricing', 'tier-pricing-table' ),
402 + 'title' => __( 'Make pricing tiers clickable', 'tier-pricing-table' ),
291 403 'id' => Settings::SETTINGS_PREFIX . 'clickable_table_rows',
292 404 'type' => TPTSwitchOption::FIELD_TYPE,
293 405 'default' => 'yes',
294 - '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.',
295 407 'tier-pricing-table' ),
296 408 'custom_attributes' => [ 'data-tiered-pricing-premium-option' => true ],
297 409 ),
298 410 );