| 1 |
<?php namespace TierPricingTable\Addons\GlobalTieredPricing\CPT\Form\Tabs; |
| 2 |
|
| 3 |
use TierPricingTable\Addons\GlobalTieredPricing\CPT\Form\FormTab; |
| 4 |
use TierPricingTable\Addons\GlobalTieredPricing\GlobalPricingRule; |
| 5 |
use TierPricingTable\Forms\RegularPricingForm; |
| 6 |
use TierPricingTable\Forms\TieredPricingRulesForm; |
| 7 |
|
| 8 |
class Pricing extends FormTab { |
| 9 |
|
| 10 |
public function getId(): string { |
| 11 |
return 'pricing'; |
| 12 |
} |
| 13 |
|
| 14 |
public function getTitle(): string { |
| 15 |
return __( 'Pricing', 'tier-pricing-table' ); |
| 16 |
} |
| 17 |
|
| 18 |
public function getDescription(): string { |
| 19 |
return __( 'Configure regular and tiered pricing rules', 'tier-pricing-table' ); |
| 20 |
} |
| 21 |
|
| 22 |
public function render( GlobalPricingRule $pricingRule ) { |
| 23 |
?> |
| 24 |
<div> |
| 25 |
<?php |
| 26 |
$this->renderSectionTitle( __( 'Base Pricing', 'tier-pricing-table' ), array( |
| 27 |
'description' => __( 'Override the default regular product prices.', |
| 28 |
'tier-pricing-table' ), |
| 29 |
'only_for_premium' => true, |
| 30 |
) ); |
| 31 |
|
| 32 |
RegularPricingForm::render( null, null, $pricingRule->getRegularPrice(), $pricingRule->getSalePrice(), |
| 33 |
$pricingRule->getPricingType(), $pricingRule->getDiscount(), $pricingRule->getDiscountType() ); |
| 34 |
?> |
| 35 |
</div> |
| 36 |
|
| 37 |
<div> |
| 38 |
<?php |
| 39 |
$this->renderSectionTitle( __( 'Tiered Pricing', 'tier-pricing-table' ) ); |
| 40 |
|
| 41 |
$this->renderHint( __( '<b>Mix & Match:</b> Combines the quantities of different products to reach tiered pricing thresholds, allowing discounts when products are purchased together. <br /><br /> |
| 42 |
<b>Individually:</b> Treats each product’s quantity separately in pricing calculations, ensuring that each product follows its own pricing tier independently without being combined with others.', |
| 43 |
'tier-pricing-table' ), array( 'show_icon' => false, 'only_for_new_rules' => true ) ); |
| 44 |
|
| 45 |
$this->renderRadioOptions( array( |
| 46 |
'id' => 'tpt_applying_type', |
| 47 |
'title' => __( 'Calculation type', 'tier-pricing-table' ), |
| 48 |
'options' => array( |
| 49 |
'individual' => __( 'Individual', 'tier-pricing-table' ), |
| 50 |
'cross' => __( 'Mix and Match', 'tier-pricing-table' ), |
| 51 |
), |
| 52 |
'value' => $pricingRule->getApplyingType(), |
| 53 |
), true ); |
| 54 |
|
| 55 |
global $post; |
| 56 |
|
| 57 |
TieredPricingRulesForm::render( $post->ID, null, null, $pricingRule->getTieredPricingType(), |
| 58 |
$pricingRule->getPercentageTieredPricingRules(), $pricingRule->getFixedTieredPricingRules() ); |
| 59 |
?> |
| 60 |
</div> |
| 61 |
<?php |
| 62 |
} |
| 63 |
|
| 64 |
public function getIcon(): string { |
| 65 |
return '$'; |
| 66 |
} |
| 67 |
} |