| 1 |
<?php namespace TierPricingTable\Addons\GlobalTieredPricing\CPT\Columns; |
| 2 |
|
| 3 |
use TierPricingTable\Addons\GlobalTieredPricing\GlobalPricingRule; |
| 4 |
use TierPricingTable\CalculationLogic; |
| 5 |
|
| 6 |
class Settings { |
| 7 |
|
| 8 |
public function getName(): string { |
| 9 |
return __( 'Priority Settings', 'tier-pricing-table' ); |
| 10 |
} |
| 11 |
|
| 12 |
public function render( GlobalPricingRule $rule ) { |
| 13 |
|
| 14 |
$prioritySlug = $rule->getSettings()->getPriorityType(); |
| 15 |
|
| 16 |
if ( $prioritySlug === 'default' ) { |
| 17 |
$realPriority = CalculationLogic::globalRulesOverrideProductLevelRules() ? 'override' : 'prefer-product'; |
| 18 |
} else { |
| 19 |
$realPriority = $prioritySlug; |
| 20 |
} |
| 21 |
|
| 22 |
$priorities = array( |
| 23 |
'default' => __( 'Global', 'tier-pricing-table' ), |
| 24 |
'prefer-product' => __( 'Prefer Product', 'tier-pricing-table' ), |
| 25 |
'prefer-role-based-product' => __( 'Prefer Product', 'tier-pricing-table' ), |
| 26 |
'override' => __( 'Override', 'tier-pricing-table' ), |
| 27 |
'flexible' => __( 'Flexible', 'tier-pricing-table' ), |
| 28 |
); |
| 29 |
|
| 30 |
|
| 31 |
if ( ! array_key_exists( $prioritySlug, $priorities ) ) { |
| 32 |
return; |
| 33 |
} |
| 34 |
|
| 35 |
?> |
| 36 |
<div> |
| 37 |
<p> |
| 38 |
<?php esc_html_e( 'Priority type', 'tier-pricing-table' ); ?>: |
| 39 |
<b><?php echo esc_html( $priorities[ $realPriority ] ); ?></b> |
| 40 |
|
| 41 |
<?php if ( $prioritySlug === 'flexible' ) : ?> |
| 42 |
<br> |
| 43 |
<br> |
| 44 |
<?php esc_html_e( 'Regular prices priority' ); ?>: |
| 45 |
<br> |
| 46 |
<b> |
| 47 |
<?php echo esc_html( $priorities[ $rule->getSettings()->getRegularPricingPriority() ] ); ?> |
| 48 |
</b> |
| 49 |
<br> |
| 50 |
<br> |
| 51 |
<?php esc_html_e( 'Tiered pricing priority' ); ?>: |
| 52 |
<b> |
| 53 |
<?php echo esc_html( $priorities[ $rule->getSettings()->getTieredPricingPriority() ] ); ?> |
| 54 |
</b> |
| 55 |
<br> |
| 56 |
<br> |
| 57 |
<?php esc_html_e( 'Quantity Limits Priority' ); ?>: |
| 58 |
<b> |
| 59 |
<?php echo esc_html( $priorities[ $rule->getSettings()->getQuantityLimitsPriority() ] ); ?> |
| 60 |
</b> |
| 61 |
<?php endif; ?> |
| 62 |
</p> |
| 63 |
</div> |
| 64 |
|
| 65 |
<?php |
| 66 |
} |
| 67 |
} |
| 68 |
|