PluginProbe
Tiered Pricing Table for WooCommerce / 2.2.0
Tiered Pricing Table for WooCommerce v2.2.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 / views / frontend / price-table-percentage.php

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

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