PluginProbe
Tiered Pricing Table for WooCommerce / 2.3.2
Tiered Pricing Table for WooCommerce v2.3.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
tier-pricing-table / views / frontend / price-table-percentage.php

price-table-percentage.php in Tiered Pricing Table for WooCommerce 2.3.2, at views/frontend/price-table-percentage.php

222 lines 5.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 use TierPricingTable\PriceManager ;
4 if ( !defined( 'WPINC' ) ) {
5 die;
6 }
7 /**
8 * @var array $price_rules
9 * @var string $real_price
10 * @var int $product_id ;
11 */
12 ?>
13
14 <?php
15
16 if ( !empty($price_rules) ) {
17 ?>
18
19 <div class="price-rules-table-wrapper">
20 <?php
21
22 if ( !empty($settings['table_title']) ) {
23 ?>
24 <h3 style="clear:both;"><?php
25 echo $settings['table_title'] ;
26 ?></h3>
27 <?php
28 }
29
30 ?>
31
32 <?php
33 do_action( 'before_percentage_tier_pricing_table' );
34 ?>
35
36 <table class="shop_table price-rules-table <?php
37 echo $settings['table_css_class'] ;
38 ?>" data-price-rules-table
39 data-product-id="<?php
40 echo $product_id ;
41 ?>"
42 data-price-rules="<?php
43 echo esc_attr( json_encode( $price_rules ) ) ;
44 ?>">
45
46 <?php
47
48 if ( $settings['head_quantity_text'] != '' && $settings['head_price_text'] != '' ) {
49 ?>
50 <thead>
51 <tr>
52 <th><span class="nobr"><?php
53 echo sanitize_text_field( $settings['head_quantity_text'] ) ;
54 ?></span>
55 </th>
56 <?php
57
58 if ( $settings['show_discount_column'] === 'yes' ) {
59 ?>
60 <th>
61 <span class="nobr"><?php
62 echo sanitize_text_field( $settings['head_discount_text'] ) ;
63 ?></span>
64 </th>
65 <?php
66 }
67
68 ?>
69 <th><span class="nobr"><?php
70 echo sanitize_text_field( $settings['head_price_text'] ) ;
71 ?></span>
72 </th>
73 <?php
74 do_action(
75 'tier_pricing_table_percentage_header_columns',
76 $price_rules,
77 $real_price,
78 $product_id
79 );
80 ?>
81 </tr>
82 </thead>
83 <?php
84 }
85
86 ?>
87
88
89 <tbody>
90 <tr data-price-rules-amount="1" data-price-rules-price="<?php
91 echo $real_price ;
92 ?>" data-price-rules-row>
93 <td>
94 <?php
95
96 if ( 1 === array_keys( $price_rules )[0] - 1 ) {
97 ?>
98 <span>1</span>
99 <?php
100 } else {
101 ?>
102 <span>1 - <?php
103 echo array_keys( $price_rules )[0] - 1 ;
104 ?></span>
105 <?php
106 }
107
108 ?>
109 </td>
110 <?php
111 if ( $settings['show_discount_column'] === 'yes' ) {
112 ?>
113 <td>
114 —
115 </td>
116 <?php
117 }
118 ?>
119 <td>
120 <span data-price-rules-formated-price><?php
121 echo wc_price( $real_price ) ;
122 ?></span>
123 </td>
124 </tr>
125
126 <?php
127 $iterator = new ArrayIterator( $price_rules );
128 ?>
129
130 <?php
131 while ( $iterator->valid() ) {
132 ?>
133 <?php
134 $percentageDiscount = $iterator->current();
135 $current_quantity = $iterator->key();
136 $iterator->next();
137
138 if ( $iterator->valid() ) {
139 $quantity = $current_quantity;
140 if ( intval( $iterator->key() - 1 != $current_quantity ) ) {
141 $quantity = $quantity . ' - ' . intval( $iterator->key() - 1 );
142 }
143 } else {
144 $quantity = $current_quantity . '+';
145 }
146
147 ?>
148 <tr data-price-rules-amount="<?php
149 echo $current_quantity ;
150 ?>"
151 data-price-rules-price="<?php
152 echo PriceManager::getPriceByPercentDiscount( $real_price, $percentageDiscount ) ;
153 ?>" data-price-rules-row>
154 <td>
155 <span><?php
156 echo $quantity ;
157 ?></span>
158 </td>
159 <?php
160
161 if ( $settings['show_discount_column'] === 'yes' ) {
162 ?>
163 <td>
164 <span><?php
165 echo $percentageDiscount ;
166 ?> %</span>
167 </td>
168 <?php
169 }
170
171 ?>
172 <td>
173 <span data-price-rules-formated-price><?php
174 echo wc_price( PriceManager::getPriceByPercentDiscount( $real_price, $percentageDiscount ) ) ;
175 ?></span>
176 </td>
177 </tr>
178
179 <?php
180 do_action(
181 'tier_pricing_table_percentage_body_columns',
182 $iterator,
183 $price_rules,
184 $real_price,
185 $product_id
186 );
187 ?>
188
189 <?php
190 }
191 ?>
192
193 </tbody>
194 </table>
195
196 <?php
197 do_action( 'after_percentage_tier_pricing_table' );
198 ?>
199
200 </div>
201
202 <style>
203 <?php
204 if ( $settings['clickable_table_rows'] === "yes" ) {
205 }
206 ?>
207
208 .price-rule-active td {
209 background-color: <?php
210 echo $settings['selected_quantity_color'] ;
211 ?> !important;
212 }
213
214 .price-rules-table-wrapper {
215 <?php
216 echo ( $settings['display_type'] === 'tooltip' ? 'display: none; ' : '' ) ;
217 ?>
218 }
219 </style>
220 <?php
221 }
222