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

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