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

149 lines 4.7 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 */
13 ?>
14
15 <?php if ( ! empty( $price_rules ) ) : ?>
16 <div class="clear"></div>
17 <div class="price-rules-table-wrapper">
18 <?php if ( ! empty( $settings['table_title'] ) ) : ?>
19 <h3 style="clear:both; margin: 20px 0;"><?php echo esc_attr( $settings['table_title'] ); ?></h3>
20 <?php endif; ?>
21
22 <?php do_action( 'before_fixed_tier_pricing_table' ); ?>
23
24 <table class="shop_table price-rules-table <?php echo esc_attr( $settings['table_css_class'] ); ?>"
25 data-price-rules-table
26 data-product-id="<?php echo esc_attr( $product_id ); ?>"
27 data-price-rules="<?php echo esc_attr( htmlspecialchars( json_encode( $price_rules ) ) ); ?>"
28 data-minimum="<?php echo esc_attr( $minimum ); ?>"
29 data-product-name="<?php echo esc_attr( $product_name ); ?>">
30
31 <?php if ( '' != $settings['head_quantity_text'] && '' != $settings['head_price_text'] ) : ?>
32 <thead>
33 <tr>
34 <th>
35 <span class="nobr"><?php echo esc_attr( sanitize_text_field( $settings['head_quantity_text'] ) ); ?></span>
36 </th>
37 <th>
38 <span class="nobr"><?php echo esc_attr( sanitize_text_field( $settings['head_price_text'] ) ); ?></span>
39 </th>
40 <?php
41 do_action( 'tier_pricing_table_fixed_header_columns', $price_rules, $real_price,
42 $product_id );
43 ?>
44 </tr>
45 </thead>
46 <?php endif; ?>
47
48 <tbody>
49 <tr data-price-rules-amount="<?php echo esc_attr( $minimum ); ?>"
50 data-price-rules-price="
51 <?php
52 echo esc_attr( wc_get_price_to_display( wc_get_product( $product_id ), array(
53 'price' => $real_price,
54 ) ) );
55 ?>
56 " data-price-rules-row>
57 <td>
58 <?php if ( 1 >= array_keys( $price_rules )[0] - $minimum ) : ?>
59 <span><?php echo esc_attr( $minimum ); ?></span>
60 <?php else : ?>
61 <span><?php echo esc_attr( $minimum ); ?> - <?php echo esc_attr( array_keys( $price_rules )[0] - 1 ); ?></span>
62 <?php endif; ?>
63 </td>
64 <td>
65 <span data-price-rules-formated-price>
66 <?php
67 echo wp_kses_post( wc_price( wc_get_price_to_display( wc_get_product( $product_id ),
68 array(
69 'price' => $real_price,
70 ) ) ) );
71 ?>
72 </span>
73 </td>
74 </tr>
75
76 <?php $iterator = new ArrayIterator( $price_rules ); ?>
77
78 <?php while ( $iterator->valid() ) : ?>
79 <?php
80 $current_price = $iterator->current();
81 $current_quantity = $iterator->key();
82
83 $iterator->next();
84
85 if ( $iterator->valid() ) {
86 $quantity = $current_quantity;
87
88 if ( intval( $iterator->key() - 1 != $current_quantity ) ) {
89 $quantity = $quantity . ' - ' . intval( $iterator->key() - 1 );
90 }
91 } else {
92 $quantity = $current_quantity . '+';
93 }
94 ?>
95 <tr data-price-rules-amount="<?php echo esc_attr( $current_quantity ); ?>"
96 data-price-rules-price="
97 <?php
98 echo esc_attr( wc_get_price_to_display( wc_get_product( $product_id ),
99 array(
100 'price' => $current_price,
101 ) ) );
102 ?>
103 " data-price-rules-row>
104 <td>
105 <span><?php echo esc_attr( $quantity ); ?></span>
106 </td>
107 <td>
108 <span data-price-rules-formated-price>
109 <?php
110 echo wp_kses_post( wc_price( wc_get_price_to_display( wc_get_product( $product_id ),
111 array(
112 'price' => $current_price,
113 ) ) ) );
114 ?>
115 </span>
116 </td>
117 </tr>
118
119 <?php
120 do_action( 'tier_pricing_table_fixed_body_columns', $iterator, $price_rules, $real_price,
121 $product_id );
122 ?>
123
124 <?php endwhile; ?>
125
126 </tbody>
127 </table>
128
129 <?php do_action( 'after_fixed_tier_pricing_table' ); ?>
130
131 </div>
132
133 <style>
134 <?php
135 if ( 'yes' === $settings['clickable_table_rows'] && tpt_fs()->is_premium() ) {
136 echo '.price-rules-table-wrapper table tr {cursor: pointer; }';
137 }
138 ?>
139
140 .price-rule-active td {
141 background-color: <?php echo esc_attr($settings['selected_quantity_color']); ?> !important;
142 }
143
144 .price-rules-table-wrapper {
145 <?php echo ( 'tooltip' === $settings['display_type'] || 'yes' !== $settings['display'] ) ? 'display: none; ' : ''; ?>
146 }
147 </style>
148 <?php endif; ?>
149