PluginProbe
Tiered Pricing Table for WooCommerce / 2.2.1
Tiered Pricing Table for WooCommerce v2.2.1
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 2.3.4 All 90 releases
tier-pricing-table / views / frontend / price-table-fixed.php

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

194 lines 4.4 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_fixed_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 htmlspecialchars( 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 <th><span class="nobr"><?php
56 echo sanitize_text_field( $settings['head_price_text'] ) ;
57 ?></span>
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 ?>
67 </tr>
68 </thead>
69 <?php
70 }
71
72 ?>
73
74 <tbody>
75 <tr data-price-rules-amount="1"
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>
81 <td>
82 <?php
83
84 if ( 1 === array_keys( $price_rules )[0] - 1 ) {
85 ?>
86 <span>1</span>
87 <?php
88 } else {
89 ?>
90 <span>1 - <?php
91 echo array_keys( $price_rules )[0] - 1 ;
92 ?></span>
93 <?php
94 }
95
96 ?>
97 </td>
98 <td>
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>
104 </td>
105 </tr>
106
107 <?php
108 $iterator = new ArrayIterator( $price_rules );
109 ?>
110
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>
137 <td>
138 <span><?php
139 echo $quantity ;
140 ?></span>
141 </td>
142 <td>
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>
148 </td>
149 </tr>
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
165 </tbody>
166 </table>
167
168 <?php
169 do_action( 'after_fixed_tier_pricing_table' );
170 ?>
171
172 </div>
173
174 <style>
175 <?php
176 if ( $settings['clickable_table_rows'] === "yes" ) {
177 }
178 ?>
179
180 .price-rule-active td {
181 background-color: <?php
182 echo $settings['selected_quantity_color'] ;
183 ?> !important;
184 }
185
186 .price-rules-table-wrapper {
187 <?php
188 echo ( $settings['display_type'] === 'tooltip' ? 'display: none; ' : '' ) ;
189 ?>
190 }
191 </style>
192 <?php
193 }
194