PluginProbe
Tiered Pricing Table for WooCommerce / 6.4.0
Tiered Pricing Table for WooCommerce v6.4.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.4.0, at src/Settings/Sections/GeneralSection/Subsections/LayoutSubsection.php

322 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' => __( 'Default 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 ),
57 'desc_tip' => true,
58 'default' => 'default',
59 ),
60 array(
61 'title' => __( 'Pricing table style', 'tier-pricing-table' ),
62 'id' => Settings::SETTINGS_PREFIX . 'pricing_table_style',
63 '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 ),
71 'desc_tip' => true,
72 'default' => 'default',
73 ),
74 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' ),
80 ),
81 array(
82 'title' => __( 'Pricing blocks style', 'tier-pricing-table' ),
83 'id' => Settings::SETTINGS_PREFIX . 'pricing_blocks_style',
84 '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,
94 'default' => 'default',
95 ),
96 array(
97 'title' => __( 'Pricing title', 'tier-pricing-table' ),
98 'id' => Settings::SETTINGS_PREFIX . 'table_title',
99 'type' => 'text',
100 'default' => '',
101 'desc_tip' => true,
102 ),
103 array(
104 'title' => __( 'Position on the product page', 'tier-pricing-table' ),
105 'id' => Settings::SETTINGS_PREFIX . 'position_hook',
106 'type' => 'select',
107 'options' => array(
108 'woocommerce_before_add_to_cart_button' => __( 'Above add to cart button', 'tier-pricing-table' ),
109 'woocommerce_after_add_to_cart_button' => __( 'Below add to cart button', 'tier-pricing-table' ),
110 'woocommerce_before_add_to_cart_form' => __( 'Above add to cart form', 'tier-pricing-table' ),
111 'woocommerce_after_add_to_cart_form' => __( 'Below add to cart form', 'tier-pricing-table' ),
112 'woocommerce_single_product_summary' => __( 'Above product title', 'tier-pricing-table' ),
113 'woocommerce_before_single_product_summary' => __( 'Before product summary', 'tier-pricing-table' ),
114 'woocommerce_after_single_product_summary' => __( 'After product summary', 'tier-pricing-table' ),
115 '____none____' => __( 'I display tiered pricing via shortcode/gutenberg/elementor',
116 'tier-pricing-table' ),
117 ),
118 'desc' => __( 'Choose where you what tiered pricing be displayed on the product page.',
119 'tier-pricing-table' ),
120 'desc_tip' => true,
121 ),
122 array(
123 'title' => __( 'Quantity display type', 'tier-pricing-table' ),
124 'id' => Settings::SETTINGS_PREFIX . 'quantity_type',
125 'type' => TPTDisplayType::FIELD_TYPE,
126 'options' => array(
127 'range' => __( 'Range', 'tier-pricing-table' ),
128 'static' => __( 'Static values', 'tier-pricing-table' ),
129 ),
130 'desc' => __( '"Range" displays the quantity range a tier applies to. "Static" displays only the minimum quantity required.',
131 'tier-pricing-table' ),
132 'desc_tip' => false,
133 'default' => 'range',
134 ),
135 array(
136 'title' => __( 'Active pricing tier color', 'tier-pricing-table' ),
137 'id' => Settings::SETTINGS_PREFIX . 'selected_quantity_color',
138 'type' => 'color',
139 'css' => 'width:6em;',
140 'default' => '#3858e9',
141 ),
142 array(
143 'title' => __( 'Tooltip icon color', 'tier-pricing-table' ),
144 'id' => Settings::SETTINGS_PREFIX . 'tooltip_color',
145 'type' => 'color',
146 'default' => '#3858e9',
147 'css' => 'width:6em;',
148 'desc' => __( 'Color of the icon.', 'tier-pricing-table' ),
149 'desc_tip' => true,
150 ),
151 array(
152 'title' => __( 'Tooltip icon size (px)', 'tier-pricing-table' ),
153 'id' => Settings::SETTINGS_PREFIX . 'tooltip_size',
154 'type' => 'number',
155 'default' => '15',
156 'css' => 'width:120px;',
157 'desc' => __( 'Size of the icon.', 'tier-pricing-table' ),
158 'desc_tip' => true,
159 ),
160 array(
161 'title' => __( 'Tooltip border', 'tier-pricing-table' ),
162 'id' => Settings::SETTINGS_PREFIX . 'tooltip_border',
163 'type' => TPTSwitchOption::FIELD_TYPE,
164 'default' => 'yes',
165 ),
166 array(
167 'title' => __( 'Unit label', 'tier-pricing-table' ),
168 'id' => Settings::SETTINGS_PREFIX . 'table_quantity_measurement',
169 'type' => TPTQuantityMeasurementField::FIELD_TYPE,
170 'default' => array(
171 'singular' => '',
172 'plural' => '',
173 ),
174 '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 'tier-pricing-table' ),
176 ),
177 array(
178 'title' => __( 'Unit label', 'tier-pricing-table' ),
179 'id' => Settings::SETTINGS_PREFIX . 'blocks_quantity_measurement',
180 'type' => TPTQuantityMeasurementField::FIELD_TYPE,
181 'default' => array(
182 'singular' => _n( 'piece', 'pieces', 1, 'tier-pricing-table' ),
183 'plural' => _n( 'piece', 'pieces', 2, 'tier-pricing-table' ),
184 ),
185 '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 'tier-pricing-table' ),
187 ),
188 array(
189 'title' => __( 'Columns titles', 'tier-pricing-table' ),
190 'id' => Settings::SETTINGS_PREFIX . 'table_columns_titles',
191 'options' => array(
192 array(
193 'label' => __( 'Quantity', 'tier-pricing-table' ),
194 'id' => Settings::SETTINGS_PREFIX . 'head_quantity_text',
195 'default' => __( 'Quantity', 'tier-pricing-table' ),
196 ),
197 array(
198 'label' => __( 'Discount', 'tier-pricing-table' ),
199 'id' => Settings::SETTINGS_PREFIX . 'head_discount_text',
200 'default' => __( 'Discount (%)', 'tier-pricing-table' ),
201 ),
202 array(
203 'label' => __( 'Price', 'tier-pricing-table' ),
204 'id' => Settings::SETTINGS_PREFIX . 'head_price_text',
205 'default' => __( 'Price', 'tier-pricing-table' ),
206 ),
207 ),
208 'desc' => __( 'Leave a column title empty so as not to show that column.', 'tier-pricing-table' ),
209 'type' => TPTTableColumnsField::FIELD_TYPE,
210 ),
211 array(
212 'title' => __( 'Show percentage discount', 'tier-pricing-table' ),
213 'id' => Settings::SETTINGS_PREFIX . 'show_discount_column',
214 'type' => TPTSwitchOption::FIELD_TYPE,
215 'default' => 'yes',
216 'desc' => __( 'Show the percentage discount in pricing blocks that offer a discount.',
217 'tier-pricing-table' ),
218 ),
219 array(
220 'title' => __( 'Show regular product price', 'tier-pricing-table' ),
221 'id' => Settings::SETTINGS_PREFIX . 'options_show_original_product_price',
222 'type' => TPTSwitchOption::FIELD_TYPE,
223 'default' => 'yes',
224 'desc' => __( 'Pricing options will show a crossed-out regular product price near the actual tier price.',
225 'tier-pricing-table' ),
226 ),
227
228 array(
229 'title' => __( 'Show totals in a selected option', 'tier-pricing-table' ),
230 'id' => Settings::SETTINGS_PREFIX . 'options_show_total',
231 'type' => TPTSwitchOption::FIELD_TYPE,
232 'default' => 'yes',
233 'desc' => __( 'The selected pricing option will include totals.', 'tier-pricing-table' ),
234 'custom_attributes' => [ 'data-tiered-pricing-premium-option' => true ],
235 ),
236 array(
237 'title' => __( 'Pricing option template', 'tier-pricing-table' ),
238 'id' => Settings::SETTINGS_PREFIX . 'options_option_text',
239 'default' => __( '<strong>Buy {tp_quantity} pieces and save {tp_rounded_discount}%</strong>',
240 'tier-pricing-table' ),
241 'placeholders' => array(
242 'tp_quantity',
243 'tp_discount',
244 'tp_rounded_discount',
245 'tp_base_unit_name',
246 ),
247 'type' => TPTTextTemplate::FIELD_TYPE,
248 'desc' => __( 'Use the variables above to build the template for the pricing option.',
249 'tier-pricing-table' ),
250 ),
251 array(
252 'title' => __( 'Show first tier pricing option', 'tier-pricing-table' ),
253 'id' => Settings::SETTINGS_PREFIX . 'options_show_default_option',
254 'type' => TPTSwitchOption::FIELD_TYPE,
255 'default' => 'yes',
256 'desc' => __( 'Show the option with a regular product price. This is the first pricing tier where no discount is offered.',
257 'tier-pricing-table' ),
258 ),
259 array(
260 'title' => __( 'First tier pricing option template', 'tier-pricing-table' ),
261 'id' => Settings::SETTINGS_PREFIX . 'options_default_option_text',
262 'default' => __( '<strong>Buy {tp_quantity} pieces</strong>', 'tier-pricing-table' ),
263 'placeholders' => array(
264 'tp_quantity',
265 'tp_base_unit_name',
266 ),
267 'type' => TPTTextTemplate::FIELD_TYPE,
268 'desc' => __( 'Set up the first pricing tier template where a discount is not offered.',
269 'tier-pricing-table' ),
270 ),
271 array(
272 'title' => __( 'Pricing string template', 'tier-pricing-table' ),
273 'id' => Settings::SETTINGS_PREFIX . 'plain_text_template',
274 'default' => __( '<strong>Buy {tp_quantity} pieces for {tp_price} each and save {tp_rounded_discount}%</strong>',
275 'tier-pricing-table' ),
276 'placeholders' => array(
277 'tp_quantity',
278 'tp_discount',
279 'tp_price',
280 'tp_rounded_discount',
281 'tp_base_unit_name',
282 ),
283 'type' => TPTTextTemplate::FIELD_TYPE,
284 'desc' => __( 'Use the variables above to build the template for the pricing string.',
285 'tier-pricing-table' ),
286 ),
287 array(
288 'title' => __( 'Show first tier pricing string', 'tier-pricing-table' ),
289 'id' => Settings::SETTINGS_PREFIX . 'plain_text_show_first_tier',
290 'type' => TPTSwitchOption::FIELD_TYPE,
291 'default' => 'yes',
292 'desc' => __( 'Show the tier with a regular product price. This is the first pricing tier where no discount is offered.',
293 'tier-pricing-table' ),
294 ),
295
296 array(
297 'title' => __( 'First tier pricing string template', 'tier-pricing-table' ),
298 'id' => Settings::SETTINGS_PREFIX . 'plain_text_first_tier_template',
299 'default' => __( '<strong>Buy {tp_quantity} pieces for {tp_price} each</strong>',
300 'tier-pricing-table' ),
301 'placeholders' => array(
302 'tp_quantity',
303 'tp_price',
304 'tp_base_unit_name',
305 ),
306 'type' => TPTTextTemplate::FIELD_TYPE,
307 'desc' => __( 'Set up the first pricing tier template where a discount is not offered.',
308 'tier-pricing-table' ),
309 ),
310 array(
311 'title' => __( 'Clickable tiered pricing', 'tier-pricing-table' ),
312 'id' => Settings::SETTINGS_PREFIX . 'clickable_table_rows',
313 'type' => TPTSwitchOption::FIELD_TYPE,
314 'default' => 'yes',
315 'desc' => __( 'To select the quantity, tiered pricing becomes clickable (table rows, blocks, options).',
316 'tier-pricing-table' ),
317 'custom_attributes' => [ 'data-tiered-pricing-premium-option' => true ],
318 ),
319 );
320 }
321 }
322