PluginProbe
Tiered Pricing Table for WooCommerce / 6.5.0
Tiered Pricing Table for WooCommerce v6.5.0
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
tier-pricing-table / src / Settings / Sections / GeneralSection / Subsections / LayoutSubsection.php

LayoutSubsection.php in Tiered Pricing Table for WooCommerce 6.5.0, at src/Settings/Sections/GeneralSection/Subsections/LayoutSubsection.php

323 lines 13.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php namespace TierPricingTable\Settings\Sections\GeneralSection\Subsections;
2
3 use TierPricingTable\Settings\CustomOptions\TPTDisplayType;
4 use TierPricingTable\Settings\CustomOptions\TPTTableColumnsField;
5 use TierPricingTable\Settings\CustomOptions\TPTQuantityMeasurementField;
6 use TierPricingTable\Settings\CustomOptions\TPTSwitchOption;
7 use TierPricingTable\Settings\CustomOptions\TPTTextTemplate;
8 use TierPricingTable\Settings\Sections\SubsectionAbstract;
9 use TierPricingTable\Settings\Settings;
10 use TierPricingTable\TierPricingTablePlugin;
11
12 class LayoutSubsection extends SubsectionAbstract {
13
14 public function getTitle(): string {
15 return __( 'Pricing Layout Settings', 'tier-pricing-table' );
16 }
17
18 public function getDescription(): string {
19 return __( 'Customize the appearance and behavior of your tiered pricing tables.', 'tier-pricing-table' );
20 }
21
22 public function getSlug(): string {
23 return 'layout';
24 }
25
26 public function getSettings(): array {
27 return array(
28 array(
29 'title' => __( 'Display tiered pricing', 'tier-pricing-table' ),
30 'id' => Settings::SETTINGS_PREFIX . 'display',
31 'type' => TPTSwitchOption::FIELD_TYPE,
32 '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.',
34 'tier-pricing-table' ),
35 'desc_tip' => true,
36 ),
37 array(
38 'title' => __( 'Pricing layout', 'tier-pricing-table' ),
39 'id' => Settings::SETTINGS_PREFIX . 'display_type',
40 'type' => TPTDisplayType::FIELD_TYPE,
41 'options' => TierPricingTablePlugin::getAvailablePricingLayouts(),
42 'desc' => __( 'Choose the default visual layout. You can also customize this individually per product.',
43 'tier-pricing-table' ),
44 'desc_tip' => true,
45 'default' => 'table',
46 ),
47 array(
48 'title' => __( 'Pricing options style', 'tier-pricing-table' ),
49 'id' => Settings::SETTINGS_PREFIX . 'pricing_options_style',
50 '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 ),
58 'desc_tip' => true,
59 'default' => 'default',
60 ),
61 array(
62 'title' => __( 'Pricing table style', 'tier-pricing-table' ),
63 'id' => Settings::SETTINGS_PREFIX . 'pricing_table_style',
64 '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 ),
72 'desc_tip' => true,
73 'default' => 'default',
74 ),
75 array(
76 'title' => __( 'Pricing blocks style', 'tier-pricing-table' ),
77 'id' => Settings::SETTINGS_PREFIX . 'pricing_blocks_style',
78 '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 ),
87 'desc_tip' => true,
88 'default' => 'default',
89 ),
90 array(
91 'title' => __( 'Compact layout', 'tier-pricing-table' ),
92 'id' => Settings::SETTINGS_PREFIX . 'compact_layout',
93 'type' => TPTSwitchOption::FIELD_TYPE,
94 'default' => 'no',
95 'desc' => __( 'Apply a compact layout to the tiered pricing.', 'tier-pricing-table' ),
96 ),
97 array(
98 'title' => __( 'Pricing title', 'tier-pricing-table' ),
99 'id' => Settings::SETTINGS_PREFIX . 'table_title',
100 'type' => 'text',
101 'default' => '',
102 'desc_tip' => true,
103 ),
104 array(
105 'title' => __( 'Position on the product page', 'tier-pricing-table' ),
106 'id' => Settings::SETTINGS_PREFIX . 'position_hook',
107 'type' => 'select',
108 'options' => array(
109 'woocommerce_before_add_to_cart_button' => __( 'Above add to cart button', 'tier-pricing-table' ),
110 'woocommerce_after_add_to_cart_button' => __( 'Below add to cart button', 'tier-pricing-table' ),
111 'woocommerce_before_add_to_cart_form' => __( 'Above add to cart form', 'tier-pricing-table' ),
112 'woocommerce_after_add_to_cart_form' => __( 'Below add to cart form', 'tier-pricing-table' ),
113 'woocommerce_single_product_summary' => __( 'Above product title', 'tier-pricing-table' ),
114 'woocommerce_before_single_product_summary' => __( 'Before product summary', 'tier-pricing-table' ),
115 'woocommerce_after_single_product_summary' => __( 'After product summary', 'tier-pricing-table' ),
116 '____none____' => __( 'I display tiered pricing via shortcode/gutenberg/elementor',
117 'tier-pricing-table' ),
118 ),
119 'desc' => __( 'Choose where you what tiered pricing be displayed on the product page.',
120 'tier-pricing-table' ),
121 'desc_tip' => true,
122 ),
123 array(
124 'title' => __( 'Quantity display type', 'tier-pricing-table' ),
125 'id' => Settings::SETTINGS_PREFIX . 'quantity_type',
126 'type' => TPTDisplayType::FIELD_TYPE,
127 'options' => array(
128 'range' => __( 'Range', 'tier-pricing-table' ),
129 'static' => __( 'Static values', 'tier-pricing-table' ),
130 ),
131 'desc' => __( '"Range" displays the quantity range a tier applies to. "Static" displays only the minimum quantity required.',
132 'tier-pricing-table' ),
133 'desc_tip' => false,
134 'default' => 'range',
135 ),
136 array(
137 'title' => __( 'Active pricing tier color', 'tier-pricing-table' ),
138 'id' => Settings::SETTINGS_PREFIX . 'selected_quantity_color',
139 'type' => 'color',
140 'css' => 'width:6em;',
141 'default' => '#3858e9',
142 ),
143 array(
144 'title' => __( 'Tooltip icon color', 'tier-pricing-table' ),
145 'id' => Settings::SETTINGS_PREFIX . 'tooltip_color',
146 'type' => 'color',
147 'default' => '#3858e9',
148 'css' => 'width:6em;',
149 'desc' => __( 'Color of the icon.', 'tier-pricing-table' ),
150 'desc_tip' => true,
151 ),
152 array(
153 'title' => __( 'Tooltip icon size (px)', 'tier-pricing-table' ),
154 'id' => Settings::SETTINGS_PREFIX . 'tooltip_size',
155 'type' => 'number',
156 'default' => '15',
157 'css' => 'width:120px;',
158 'desc' => __( 'Size of the icon.', 'tier-pricing-table' ),
159 'desc_tip' => true,
160 ),
161 array(
162 'title' => __( 'Tooltip border', 'tier-pricing-table' ),
163 'id' => Settings::SETTINGS_PREFIX . 'tooltip_border',
164 'type' => TPTSwitchOption::FIELD_TYPE,
165 'default' => 'yes',
166 ),
167 array(
168 'title' => __( 'Unit label', 'tier-pricing-table' ),
169 'id' => Settings::SETTINGS_PREFIX . 'table_quantity_measurement',
170 'type' => TPTQuantityMeasurementField::FIELD_TYPE,
171 'default' => array(
172 'singular' => '',
173 'plural' => '',
174 ),
175 '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 'tier-pricing-table' ),
177 ),
178 array(
179 'title' => __( 'Unit label', 'tier-pricing-table' ),
180 'id' => Settings::SETTINGS_PREFIX . 'blocks_quantity_measurement',
181 'type' => TPTQuantityMeasurementField::FIELD_TYPE,
182 'default' => array(
183 'singular' => _n( 'piece', 'pieces', 1, 'tier-pricing-table' ),
184 'plural' => _n( 'piece', 'pieces', 2, 'tier-pricing-table' ),
185 ),
186 '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 'tier-pricing-table' ),
188 ),
189 array(
190 'title' => __( 'Columns titles', 'tier-pricing-table' ),
191 'id' => Settings::SETTINGS_PREFIX . 'table_columns_titles',
192 'options' => array(
193 array(
194 'label' => __( 'Quantity', 'tier-pricing-table' ),
195 'id' => Settings::SETTINGS_PREFIX . 'head_quantity_text',
196 'default' => __( 'Quantity', 'tier-pricing-table' ),
197 ),
198 array(
199 'label' => __( 'Discount', 'tier-pricing-table' ),
200 'id' => Settings::SETTINGS_PREFIX . 'head_discount_text',
201 'default' => __( 'Discount (%)', 'tier-pricing-table' ),
202 ),
203 array(
204 'label' => __( 'Price', 'tier-pricing-table' ),
205 'id' => Settings::SETTINGS_PREFIX . 'head_price_text',
206 'default' => __( 'Price', 'tier-pricing-table' ),
207 ),
208 ),
209 'desc' => __( 'Leave a column title empty so as not to show that column.', 'tier-pricing-table' ),
210 'type' => TPTTableColumnsField::FIELD_TYPE,
211 ),
212 array(
213 'title' => __( 'Show percentage discount', 'tier-pricing-table' ),
214 'id' => Settings::SETTINGS_PREFIX . 'show_discount_column',
215 'type' => TPTSwitchOption::FIELD_TYPE,
216 'default' => 'yes',
217 'desc' => __( 'Show the percentage discount in pricing blocks that offer a discount.',
218 'tier-pricing-table' ),
219 ),
220 array(
221 'title' => __( 'Show regular product price', 'tier-pricing-table' ),
222 'id' => Settings::SETTINGS_PREFIX . 'options_show_original_product_price',
223 'type' => TPTSwitchOption::FIELD_TYPE,
224 'default' => 'yes',
225 'desc' => __( 'Pricing options will show a crossed-out regular product price near the actual tier price.',
226 'tier-pricing-table' ),
227 ),
228
229 array(
230 'title' => __( 'Show totals in a selected option', 'tier-pricing-table' ),
231 'id' => Settings::SETTINGS_PREFIX . 'options_show_total',
232 'type' => TPTSwitchOption::FIELD_TYPE,
233 'default' => 'yes',
234 'desc' => __( 'The selected pricing option will include totals.', 'tier-pricing-table' ),
235 'custom_attributes' => [ 'data-tiered-pricing-premium-option' => true ],
236 ),
237 array(
238 'title' => __( 'Pricing option template', 'tier-pricing-table' ),
239 'id' => Settings::SETTINGS_PREFIX . 'options_option_text',
240 'default' => __( '<strong>Buy {tp_quantity} pieces and save {tp_rounded_discount}%</strong>',
241 'tier-pricing-table' ),
242 'placeholders' => array(
243 'tp_quantity',
244 'tp_discount',
245 'tp_rounded_discount',
246 'tp_base_unit_name',
247 ),
248 'type' => TPTTextTemplate::FIELD_TYPE,
249 'desc' => __( 'Use the variables above to build the template for the pricing option.',
250 'tier-pricing-table' ),
251 ),
252 array(
253 'title' => __( 'Show first tier pricing option', 'tier-pricing-table' ),
254 'id' => Settings::SETTINGS_PREFIX . 'options_show_default_option',
255 'type' => TPTSwitchOption::FIELD_TYPE,
256 'default' => 'yes',
257 'desc' => __( 'Show the option with a regular product price. This is the first pricing tier where no discount is offered.',
258 'tier-pricing-table' ),
259 ),
260 array(
261 'title' => __( 'First tier pricing option template', 'tier-pricing-table' ),
262 'id' => Settings::SETTINGS_PREFIX . 'options_default_option_text',
263 'default' => __( '<strong>Buy {tp_quantity} pieces</strong>', 'tier-pricing-table' ),
264 'placeholders' => array(
265 'tp_quantity',
266 'tp_base_unit_name',
267 ),
268 'type' => TPTTextTemplate::FIELD_TYPE,
269 'desc' => __( 'Set up the first pricing tier template where a discount is not offered.',
270 'tier-pricing-table' ),
271 ),
272 array(
273 'title' => __( 'Pricing string template', 'tier-pricing-table' ),
274 'id' => Settings::SETTINGS_PREFIX . 'plain_text_template',
275 'default' => __( '<strong>Buy {tp_quantity} pieces for {tp_price} each and save {tp_rounded_discount}%</strong>',
276 'tier-pricing-table' ),
277 'placeholders' => array(
278 'tp_quantity',
279 'tp_discount',
280 'tp_price',
281 'tp_rounded_discount',
282 'tp_base_unit_name',
283 ),
284 'type' => TPTTextTemplate::FIELD_TYPE,
285 'desc' => __( 'Use the variables above to build the template for the pricing string.',
286 'tier-pricing-table' ),
287 ),
288 array(
289 'title' => __( 'Show first tier pricing string', 'tier-pricing-table' ),
290 'id' => Settings::SETTINGS_PREFIX . 'plain_text_show_first_tier',
291 'type' => TPTSwitchOption::FIELD_TYPE,
292 'default' => 'yes',
293 'desc' => __( 'Show the tier with a regular product price. This is the first pricing tier where no discount is offered.',
294 'tier-pricing-table' ),
295 ),
296
297 array(
298 'title' => __( 'First tier pricing string template', 'tier-pricing-table' ),
299 'id' => Settings::SETTINGS_PREFIX . 'plain_text_first_tier_template',
300 'default' => __( '<strong>Buy {tp_quantity} pieces for {tp_price} each</strong>',
301 'tier-pricing-table' ),
302 'placeholders' => array(
303 'tp_quantity',
304 'tp_price',
305 'tp_base_unit_name',
306 ),
307 'type' => TPTTextTemplate::FIELD_TYPE,
308 'desc' => __( 'Set up the first pricing tier template where a discount is not offered.',
309 'tier-pricing-table' ),
310 ),
311 array(
312 'title' => __( 'Clickable tiered pricing', 'tier-pricing-table' ),
313 'id' => Settings::SETTINGS_PREFIX . 'clickable_table_rows',
314 'type' => TPTSwitchOption::FIELD_TYPE,
315 'default' => 'yes',
316 'desc' => __( 'To select the quantity, tiered pricing becomes clickable (table rows, blocks, options).',
317 'tier-pricing-table' ),
318 'custom_attributes' => [ 'data-tiered-pricing-premium-option' => true ],
319 ),
320 );
321 }
322 }
323