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 / Addons / GlobalTieredPricing / CPT / Form / Tabs / Settings.php

Settings.php in Tiered Pricing Table for WooCommerce 6.1.0, at src/Addons/GlobalTieredPricing/CPT/Form/Tabs/Settings.php

145 lines 5.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php namespace TierPricingTable\Addons\GlobalTieredPricing\CPT\Form\Tabs;
2
3 use TierPricingTable\Addons\GlobalTieredPricing\CPT\Form\FormTab;
4 use TierPricingTable\Addons\GlobalTieredPricing\GlobalPricingRule;
5
6 class Settings extends FormTab {
7
8 public function getId(): string {
9 return 'settings';
10 }
11
12 public function getTitle(): string {
13 return __( 'Priority Settings', 'tier-pricing-table' );
14 }
15
16 public function getDescription(): string {
17 return __( 'Handle pricing collisions with product-level prices.', 'tier-pricing-table' );
18 }
19
20 public function render( GlobalPricingRule $pricingRule ) {
21
22 $this->renderSectionTitle( __( 'Priority Settings', 'tier-pricing-table' ) );
23
24 $this->renderHint( __( 'Control how this global pricing rule behaves in case of collisions with product-level rules.',
25 'tier-pricing-table' ) );
26
27 $this->renderRadioOptions( array(
28 'id' => '_tpt_settings_priority_type',
29 'title' => __( 'Pricing rule priority', 'tier-pricing-table' ),
30 'options' => array(
31 'default' => __( 'Use global settings', 'tier-pricing-table' ),
32 'prefer-product' => __( 'Product-level rules take priority over this global rule.',
33 'tier-pricing-table' ),
34 'override' => __( 'This rule takes priority over any product-level pricing rules',
35 'tier-pricing-table' ),
36 'flexible' => __( 'Flexible: set priorities for the pricing rule parts individually.',
37 'tier-pricing-table' ),
38 ),
39 'value' => $pricingRule->getSettings()->getPriorityType(),
40 ) );
41
42 ?>
43
44 <div class="tpt_settings_advanced_priority_settings hidden">
45 <?php
46 $this->renderSectionTitle( __( 'Regular prices priority', 'tier-pricing-table' ) );
47 ?>
48 <div class="tpt_settings_regular_pricing">
49 <?php
50 $this->renderRadioOptions( array(
51 'id' => '_tpt_settings_regular_pricing_priority_type',
52 'title' => __( 'Regular prices priority', 'tier-pricing-table' ),
53 'options' => array(
54 'prefer-role-based-product' => __( 'Prefer role-based product-level regular prices if they exist.',
55 'tier-pricing-table' ),
56 'override' => __( 'Override any product-level regular prices with the prices set in this rule.',
57 'tier-pricing-table' ),
58 ),
59 'value' => $pricingRule->getSettings()->getRegularPricingPriority(),
60 ) );
61
62 $this->renderHint( __( 'If a product has role-based pricing set at the product level, you can prefer those regular prices over the ones set in this global rule.',
63 'tier-pricing-table' ) );
64 ?>
65 </div>
66
67 <?php
68 $this->renderSectionTitle( __( 'Tiered pricing priority', 'tier-pricing-table' ) );
69 ?>
70
71 <div class="tpt_settings_tiered_pricing">
72 <?php
73 $this->renderRadioOptions( array(
74 'id' => '_tpt_settings_tiered_pricing_priority_type',
75 'title' => __( 'Tiered pricing priority', 'tier-pricing-table' ),
76 'options' => array(
77 'prefer-product' => __( 'Prefer any product-level tiered prices if they exist.',
78 'tier-pricing-table' ),
79 'prefer-role-based-product' => __( 'Prefer only role-based product-level tiered pricing if they exist.',
80 'tier-pricing-table' ),
81 'override' => __( 'Override any product-level tiered prices with the prices set in this rule.',
82 'tier-pricing-table' ),
83 ),
84 'value' => $pricingRule->getSettings()->getTieredPricingPriority(),
85 ) );
86
87 $this->renderCheckbox( array(
88 'title' => __( 'Mix and Match', 'tier-pricing-table' ),
89 'id' => '_tpt_settings_tiered_pricing_allow_mix_and_match',
90 'value' => $pricingRule->getSettings()->isAllowTieredPricingMixAndMatch(),
91 'label' => __( 'Allow the "Mix and Match" pricing strategy (if selected) for tiered prices inherited from the product level.',
92 'tier-pricing-table' ),
93 ) );
94
95 $this->renderHint( __( 'If a product has tiered pricing set at the product level, you can prefer those tiered prices over the ones set in this global rule. You can also enable the "Mix and Match" pricing strategy for tiered prices inherited from the product level.',
96 'tier-pricing-table' ) );
97 ?>
98 </div>
99
100 <?php
101 $this->renderSectionTitle( __( 'Quantity limits priority', 'tier-pricing-table' ) );
102 ?>
103
104 <div class="tpt_settings_quantity_limits">
105 <?php
106 $this->renderRadioOptions( array(
107 'id' => '_tpt_settings_quantity_limits_priority_type',
108 'title' => __( 'Quantity limits priority', 'tier-pricing-table' ),
109 'options' => array(
110 'prefer-product' => __( 'Prefer any product-level quantity limits if they exist.',
111 'tier-pricing-table' ),
112 'prefer-role-based-product' => __( 'Prefer only role-based product-level quantity limits if they exist.',
113 'tier-pricing-table' ),
114 'override' => __( 'Override any product-level quantity limits with the limits set in this rule.',
115 'tier-pricing-table' ),
116 ),
117 'value' => $pricingRule->getSettings()->getQuantityLimitsPriority(),
118 ) );
119
120 $this->renderHint( __( 'If a product has quantity limits set at the product level, you can prefer those quantity limits over the ones set in this global rule.',
121 'tier-pricing-table' ) );
122 ?>
123 </div>
124 </div>
125
126 <script>
127 jQuery(document).ready(function (jQuery) {
128 jQuery('[name=_tpt_settings_priority_type]').on('change', function () {
129
130 if (jQuery(this).val() === 'flexible') {
131 jQuery('.tpt_settings_advanced_priority_settings').removeClass('hidden');
132 } else {
133 jQuery('.tpt_settings_advanced_priority_settings').addClass('hidden');
134 }
135 }).filter(':checked').trigger('change');
136 });
137 </script>
138
139 <?php
140 }
141
142 public function getIcon(): string {
143 return 'dashicons-admin-settings';
144 }
145 }