| 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\MinimumOrderQuantityForm; |
| 6 |
|
| 7 |
class Quantity extends FormTab { |
| 8 |
|
| 9 |
public function getId(): string { |
| 10 |
return 'quantity'; |
| 11 |
} |
| 12 |
|
| 13 |
public function getTitle(): string { |
| 14 |
return __( 'Quantity limits', 'tier-pricing-table' ); |
| 15 |
} |
| 16 |
|
| 17 |
public function getDescription(): string { |
| 18 |
return __( 'Set minimum, maximum, and quantity step limits', 'tier-pricing-table' ); |
| 19 |
} |
| 20 |
|
| 21 |
public function render( GlobalPricingRule $pricingRule ) { |
| 22 |
|
| 23 |
$this->renderSectionTitle( __( 'Quantity Limits', 'tier-pricing-table' ), array( |
| 24 |
'only_for_premium' => true, |
| 25 |
'description' => __( 'Applies to each product individually. If mix & match is enabled, the minimum quantity requirement will be shared across variations of a variable product.', |
| 26 |
'tier-pricing-table' ), |
| 27 |
) ); |
| 28 |
|
| 29 |
MinimumOrderQuantityForm::render( null, null, $pricingRule->getMinimum() ); |
| 30 |
|
| 31 |
do_action( 'tiered_pricing_table/global_pricing/after_minimum_order_quantity_field', $pricingRule->getId(), |
| 32 |
$pricingRule ); |
| 33 |
|
| 34 |
$this->renderSectionTitle( __( 'Variable Product Minimum Quantity', 'tier-pricing-table' ), array( |
| 35 |
'description' => __( 'Determine whether the minimum quantity requirement applies to each variation separately, or to the combined total of all variations in the cart.', 'tier-pricing-table' ), |
| 36 |
) ); |
| 37 |
|
| 38 |
$mixAndMatchValue = $pricingRule->getMixAndMatchMinQuantity(); |
| 39 |
$mixAndMatchString = is_null( $mixAndMatchValue ) ? '' : ( $mixAndMatchValue ? 'yes' : 'no' ); |
| 40 |
|
| 41 |
woocommerce_wp_select( array( |
| 42 |
'id' => 'mix_and_match_minimum', |
| 43 |
'value' => $mixAndMatchString, |
| 44 |
'options' => array( |
| 45 |
'' => __( 'Global Settings', 'tier-pricing-table' ), |
| 46 |
'no' => __( 'Individual variation', 'tier-pricing-table' ), |
| 47 |
'yes' => __( 'Variable product total (Mix & match)', 'tier-pricing-table' ), |
| 48 |
), |
| 49 |
'label' => __( 'Calculate minimum quantity by', 'tier-pricing-table' ), |
| 50 |
) ); |
| 51 |
|
| 52 |
?> |
| 53 |
<style> |
| 54 |
#mix_and_match_minimum { |
| 55 |
width: 75% !important; |
| 56 |
} |
| 57 |
</style> |
| 58 |
<?php |
| 59 |
} |
| 60 |
|
| 61 |
public function getIcon(): string { |
| 62 |
return 'dashicons-database'; |
| 63 |
} |
| 64 |
} |
| 65 |
|