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