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-fixed.php

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

175 lines 4.0 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 </tr>
60 </thead>
61 <?php
62 }
63
64 ?>
65
66 <tbody>
67 <tr data-price-rules-amount="1"
68 data-price-rules-price="<?php
69 echo wc_get_price_to_display( wc_get_product( $product_id ), [
70 'price' => $real_price,
71 ] ) ;
72 ?>" data-price-rules-row>
73 <td>
74 <?php
75
76 if ( 1 === array_keys( $price_rules )[0] - 1 ) {
77 ?>
78 <span>1</span>
79 <?php
80 } else {
81 ?>
82 <span>1 - <?php
83 echo array_keys( $price_rules )[0] - 1 ;
84 ?></span>
85 <?php
86 }
87
88 ?>
89 </td>
90 <td>
91 <span data-price-rules-formated-price><?php
92 echo wc_price( wc_get_price_to_display( wc_get_product( $product_id ), [
93 'price' => $real_price,
94 ] ) ) ;
95 ?></span>
96 </td>
97 </tr>
98
99 <?php
100 $iterator = new ArrayIterator( $price_rules );
101 ?>
102
103 <?php
104 while ( $iterator->valid() ) {
105 ?>
106 <?php
107 $current_price = $iterator->current();
108 $current_quantity = $iterator->key();
109 $iterator->next();
110
111 if ( $iterator->valid() ) {
112 $quantity = $current_quantity;
113 if ( intval( $iterator->key() - 1 != $current_quantity ) ) {
114 $quantity = $quantity . ' - ' . intval( $iterator->key() - 1 );
115 }
116 } else {
117 $quantity = $current_quantity . '+';
118 }
119
120 ?>
121 <tr data-price-rules-amount="<?php
122 echo $current_quantity ;
123 ?>"
124 data-price-rules-price="<?php
125 echo wc_get_price_to_display( wc_get_product( $product_id ), [
126 'price' => $current_price,
127 ] ) ;
128 ?>" data-price-rules-row>
129 <td>
130 <span><?php
131 echo $quantity ;
132 ?></span>
133 </td>
134 <td>
135 <span data-price-rules-formated-price><?php
136 echo wc_price( wc_get_price_to_display( wc_get_product( $product_id ), [
137 'price' => $current_price,
138 ] ) ) ;
139 ?></span>
140 </td>
141 </tr>
142 <?php
143 }
144 ?>
145
146 </tbody>
147 </table>
148
149 <?php
150 do_action( 'after_fixed_tier_pricing_table' );
151 ?>
152
153 </div>
154
155 <style>
156 <?php
157 if ( $settings['clickable_table_rows'] === "yes" ) {
158 }
159 ?>
160
161 .price-rule-active td {
162 background-color: <?php
163 echo $settings['selected_quantity_color'] ;
164 ?> !important;
165 }
166
167 .price-rules-table-wrapper {
168 <?php
169 echo ( $settings['display_type'] === 'tooltip' ? 'display: none; ' : '' ) ;
170 ?>
171 }
172 </style>
173 <?php
174 }
175