PluginProbe
Tiered Pricing Table for WooCommerce / 8.1.0
Tiered Pricing Table for WooCommerce v8.1.0
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/tiered-pricing-table.php +10 -5 7.1.4 → 8.1.0 View file →
@@ -15,8 +15,9 @@
15 15 */
16 16
17 17 use TierPricingTable\CalculationLogic;
18 18 use TierPricingTable\PriceManager;
19 + use TierPricingTable\PricingTable;
19 20 use TierPricingTable\PricingRule;
20 21
21 22 if ( ! defined( 'WPINC' ) ) {
22 23 die;
@@ -59,8 +60,9 @@
59 60 <?php do_action( 'tiered_pricing_table/tiered_pricing/before', $pricing_rule ); ?>
60 61
61 62 <table class="shop_table tiered-pricing-table <?php echo ( isset( $settings['compact_layout'] ) && $settings['compact_layout'] === 'yes' ) ? 'tiered-pricing-table--slim' : ''; ?>"
62 63 id="<?php echo esc_attr( $id ); ?>"
64 + <?php echo \TierPricingTable\PricingTable::layoutStyleAttribute( $settings ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- escaped in the helper ?>
63 65 data-tiered-pricing-table
64 66 data-product-id="<?php echo esc_attr( $product_id ); ?>"
65 67 data-price-rules="<?php echo esc_attr( json_encode( $pricing_rule->getRules() ) ); ?>"
66 68 data-minimum="<?php echo esc_attr( $minimum ); ?>"
@@ -100,8 +102,9 @@
100 102 </tr>
101 103 </thead>
102 104
103 105 <tbody>
106 + <?php $tptTierRows = array(); ob_start(); ?>
104 107 <tr class="tiered-pricing--active"
105 108 data-tiered-quantity="<?php echo esc_attr( $minimum ); ?>"
106 109 data-tiered-price="<?php echo esc_attr( $price ); ?>"
107 110 data-tiered-price-exclude-taxes="<?php echo esc_attr( $price_excl_taxes ); ?>"
@@ -113,9 +116,9 @@
113 116 <span>
114 117 <?php echo esc_attr( number_format_i18n( $minimum ) ); ?>
115 118 </span>
116 119 <span>
117 - <?php echo esc_attr( ' ' . $minimum > 1 ? $settings['quantity_measurement_plural'] : $settings['quantity_measurement_singular'] ); ?>
120 + <?php echo esc_attr( ' ' . ( $minimum > 1 ? $settings['quantity_measurement_plural'] : $settings['quantity_measurement_singular'] ) ); ?>
118 121 </span>
119 122 </span>
120 123 <?php else : ?>
121 124 <span>
@@ -146,9 +149,9 @@
146 149 ?>
147 150
148 151 <td>
149 152 <?php if ( $discountAmount > 0 ) : ?>
150 - <span><?php echo esc_attr( round( $discountAmount, 2 ) ); ?> %</span>
153 + <span><?php echo wp_kses_post( PricingTable::formatDiscount( $discountAmount, $pricing_rule, $product, null, $settings ) ); ?></span>
151 154 <?php else : ?>
152 155 <span>—</span>
153 156 <?php endif; ?>
154 157 </td>
@@ -164,12 +167,13 @@
164 167 <?php endif; ?>
165 168
166 169 <?php do_action( 'tiered_pricing_table/tiered_pricing/row_columns', $pricing_rule, null ); ?>
167 170 </tr>
171 + <?php $tptTierRows[] = ob_get_clean(); ?>
168 172
169 173 <?php $iterator = new ArrayIterator( $pricing_rule->getRules() ); ?>
170 174
171 - <?php while ( $iterator->valid() ) : ?>
175 + <?php while ( $iterator->valid() ) : ob_start(); ?>
172 176 <?php
173 177 $currentPrice = $iterator->current();
174 178 $currentQuantity = $iterator->key();
175 179
@@ -226,9 +230,9 @@
226 230
227 231 <?php if ( $settings['discount_column_title'] ) : ?>
228 232 <td>
229 233 <?php if ( $discountAmount > 0 ) : ?>
230 - <span><?php echo esc_attr( round( $discountAmount, 2 ) ); ?> %</span>
234 + <span><?php echo wp_kses_post( PricingTable::formatDiscount( $discountAmount, $pricing_rule, $product, $currentQuantity, $settings ) ); ?></span>
231 235 <?php else : ?>
232 236 <span>—</span>
233 237 <?php endif; ?>
234 238 </td>
@@ -245,9 +249,10 @@
245 249 <?php
246 250 do_action( 'tiered_pricing_table/tiered_pricing/row_columns', $pricing_rule, $currentQuantity );
247 251 ?>
248 252 </tr>
249 - <?php endwhile; ?>
253 + <?php $tptTierRows[] = ob_get_clean(); endwhile; ?>
254 + <?php echo PricingTable::orderTiers( $tptTierRows, $settings ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- rows escaped when rendered above ?>
250 255 <?php do_action( 'tiered_pricing_table/tiered_pricing/rows', $pricing_rule, $settings, 'tiered-pricing-table' ); ?>
251 256 </tbody>
252 257 <?php do_action( 'tiered_pricing_table/table/tfoot', $pricing_rule, $settings, 'tiered-pricing-table' ); ?>
253 258 </table>