PluginProbe
Tiered Pricing Table for WooCommerce / 6.1.0
Tiered Pricing Table for WooCommerce v6.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 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 6.1.0, at views/frontend/price-table-fixed.php

170 lines 5.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php if ( ! defined( 'WPINC' ) ) {
2 die;
3 }
4 /**
5 * Fixed Price Table
6 *
7 * @var array $price_rules
8 * @var string $real_price
9 * @var string $product_name
10 * @var int $product_id
11 * @var int $minimum
12 * @var array $settings
13 */
14 ?>
15
16 <?php if ( ! empty( $price_rules ) ) : ?>
17 <div class="clear"></div>
18 <div class="price-rules-table-wrapper">
19 <?php if ( ! empty( $settings['table_title'] ) ) : ?>
20 <h3 style="clear:both; margin: 20px 0;"><?php echo esc_attr( $settings['table_title'] ); ?></h3>
21 <?php endif; ?>
22
23 <?php do_action( 'before_fixed_tier_pricing_table' ); ?>
24
25 <table class="shop_table price-rules-table <?php echo esc_attr( $settings['table_css_class'] ); ?>"
26 data-price-rules-table
27 data-product-id="<?php echo esc_attr( $product_id ); ?>"
28 data-price-rules="<?php echo esc_attr( htmlspecialchars( json_encode( $price_rules ) ) ); ?>"
29 data-minimum="<?php echo esc_attr( $minimum ); ?>"
30 data-product-name="<?php echo esc_attr( $product_name ); ?>">
31
32 <?php if ( '' != $settings['head_quantity_text'] && '' != $settings['head_price_text'] ) : ?>
33 <thead>
34 <tr>
35 <th>
36 <span class="nobr"><?php echo esc_attr( sanitize_text_field( $settings['head_quantity_text'] ) ); ?></span>
37 </th>
38 <th>
39 <span class="nobr"><?php echo esc_attr( sanitize_text_field( $settings['head_price_text'] ) ); ?></span>
40 </th>
41 <?php
42 do_action( 'tier_pricing_table_fixed_header_columns', $price_rules, $real_price,
43 $product_id );
44 ?>
45 </tr>
46 </thead>
47 <?php endif; ?>
48
49 <tbody>
50 <tr data-price-rules-amount="<?php echo esc_attr( $minimum ); ?>"
51 data-price-rules-price="
52 <?php
53 echo esc_attr( wc_get_price_to_display( wc_get_product( $product_id ), array(
54 'price' => $real_price,
55 ) ) );
56 ?>
57 "
58 data-price-rules-price-exclude-taxes="
59 <?php
60 echo esc_attr( wc_get_price_excluding_tax( wc_get_product( $product_id ), array(
61 'price' => $real_price,
62 ) ) );
63 ?>
64 "
65 data-price-rules-row>
66 <td>
67 <?php if ( 1 >= array_keys( $price_rules )[0] - $minimum || $settings['quantity_type'] === "static" ) : ?>
68 <span><?php echo esc_attr( number_format_i18n( $minimum ) ); ?></span>
69 <?php else : ?>
70 <span><?php echo esc_attr( number_format_i18n( $minimum ) ); ?> - <?php echo esc_attr( number_format_i18n( array_keys( $price_rules )[0] - 1 ) ); ?></span>
71 <?php endif; ?>
72 </td>
73 <td>
74 <span data-price-rules-formated-price>
75 <?php
76 echo wp_kses_post( wc_price( wc_get_price_to_display( wc_get_product( $product_id ),
77 array(
78 'price' => $real_price,
79 ) ) ) );
80 ?>
81 </span>
82 </td>
83 </tr>
84
85 <?php $iterator = new ArrayIterator( $price_rules ); ?>
86
87 <?php while ( $iterator->valid() ) : ?>
88 <?php
89 $current_price = $iterator->current();
90 $current_quantity = $iterator->key();
91
92 $iterator->next();
93
94 if ( $iterator->valid() ) {
95 $quantity = $current_quantity;
96
97 if ( intval( $iterator->key() - 1 != $current_quantity ) ) {
98
99 $quantity = number_format_i18n( $quantity );
100
101 if ( $settings['quantity_type'] === "range" ) {
102 $quantity .= ' - ' . number_format_i18n( intval( $iterator->key() - 1 ) );
103 }
104 }
105 } else {
106 $quantity = number_format_i18n( $current_quantity ) . '+';
107 }
108 ?>
109 <tr data-price-rules-amount="<?php echo esc_attr( $current_quantity ); ?>"
110 data-price-rules-price="
111 <?php
112 echo esc_attr( wc_get_price_to_display( wc_get_product( $product_id ),
113 array(
114 'price' => $current_price,
115 ) ) );
116 ?>"
117 data-price-rules-price-exclude-taxes="
118 <?php
119 echo esc_attr( wc_get_price_excluding_tax( wc_get_product( $product_id ),
120 array(
121 'price' => $current_price,
122 ) ) );
123 ?>"
124 data-price-rules-row>
125 <td>
126 <span><?php echo esc_attr( $quantity ); ?></span>
127 </td>
128 <td>
129 <span data-price-rules-formated-price>
130 <?php
131 echo wp_kses_post( wc_price( wc_get_price_to_display( wc_get_product( $product_id ),
132 array(
133 'price' => $current_price,
134 ) ) ) );
135 ?>
136 </span>
137 </td>
138 </tr>
139
140 <?php
141 do_action( 'tier_pricing_table_fixed_body_columns', $iterator, $price_rules, $real_price, $product_id );
142
143 ?>
144
145 <?php endwhile; ?>
146
147 </tbody>
148 </table>
149
150 <?php do_action( 'after_fixed_tier_pricing_table' ); ?>
151
152 </div>
153
154 <style>
155 <?php
156 if ( 'yes' === $settings['clickable_table_rows'] && tpt_fs()->is_premium() ) {
157 echo '.price-rules-table-wrapper table tr {cursor: pointer; }';
158 }
159 ?>
160
161 .price-rule-active td {
162 background-color: <?php echo esc_attr($settings['selected_quantity_color']); ?> !important;
163 }
164
165 .price-rules-table-wrapper {
166 <?php echo ( 'tooltip' === $settings['display_type'] || 'yes' !== $settings['display'] ) ? 'display: none; ' : ''; ?>
167 }
168 </style>
169 <?php endif; ?>
170