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
tier-pricing-table / src / Addons / GlobalTieredPricing / CPT / Columns / Settings.php

Settings.php in Tiered Pricing Table for WooCommerce 8.1.0, at src/Addons/GlobalTieredPricing/CPT/Columns/Settings.php

50 lines 2.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php namespace TierPricingTable\Addons\GlobalTieredPricing\CPT\Columns;
2
3 use TierPricingTable\Addons\GlobalTieredPricing\GlobalPricingRule;
4
5 /**
6 * Settings that differ from the defaults: how the rule meets product-level pricing, and whatever
7 * add-ons append (tax settings, for instance) through the after_tab_render action.
8 */
9 class Settings {
10
11 public function getName(): string {
12 return __( 'Settings', 'tier-pricing-table' );
13 }
14
15 public function render( GlobalPricingRule $rule ) {
16 $settings = $rule->getSettings();
17 $labels = array(
18 'prefer-product' => __( 'prefer product', 'tier-pricing-table' ),
19 'prefer-role-based-product' => __( 'prefer product role prices', 'tier-pricing-table' ),
20 'override' => __( 'override product', 'tier-pricing-table' ),
21 );
22
23 switch ( $settings->getPriorityType() ) {
24 case 'prefer-product':
25 $this->renderTag( __( 'Prefers product pricing', 'tier-pricing-table' ) );
26 break;
27 case 'override':
28 $this->renderTag( __( 'Overrides product pricing', 'tier-pricing-table' ) );
29 break;
30 case 'flexible':
31 $this->renderTag( __( 'Custom priorities', 'tier-pricing-table' ), sprintf(
32 /* translators: 1, 2, 3: the three priority choices */
33 __( 'Base prices: %1$s. Tiers: %2$s. Quantity limits: %3$s.', 'tier-pricing-table' ),
34 $labels[ $settings->getRegularPricingPriority() ] ?? $settings->getRegularPricingPriority(),
35 $labels[ $settings->getTieredPricingPriority() ] ?? $settings->getTieredPricingPriority(),
36 $labels[ $settings->getQuantityLimitsPriority() ] ?? $settings->getQuantityLimitsPriority()
37 ) );
38 break;
39 default:
40 echo '<span class="tpt-rules-list__muted">' . esc_html__( 'Default', 'tier-pricing-table' ) . '</span>';
41 }
42 }
43
44 public static function renderTag( string $text, string $title = '' ) {
45 ?>
46 <span class="tpt-rules-list__tag" <?php echo $title ? 'title="' . esc_attr( $title ) . '"' : ''; ?>><?php echo esc_html( $text ); ?></span>
47 <?php
48 }
49 }
50