| 1 |
<?php |
| 2 |
|
| 3 |
use TierPricingTable\Addons\UserBasedPricing\UserBasedPricingRule; |
| 4 |
use TierPricingTable\Core\ServiceContainer; |
| 5 |
use TierPricingTable\Forms\MinimumOrderQuantityForm; |
| 6 |
use TierPricingTable\Forms\RegularPricingForm; |
| 7 |
use TierPricingTable\Forms\TieredPricingRulesForm; |
| 8 |
|
| 9 |
if ( ! defined( 'WPINC' ) ) { |
| 10 |
die; |
| 11 |
} |
| 12 |
|
| 13 |
/** |
| 14 |
* Available variables |
| 15 |
* |
| 16 |
* @var WC_Product $product |
| 17 |
* @var UserBasedPricingRule $pricing_rule |
| 18 |
* @var int $loop |
| 19 |
*/ |
| 20 |
|
| 21 |
$fileManager = ServiceContainer::getInstance()->getFileManager(); |
| 22 |
|
| 23 |
$roleKey = 'user_' . $pricing_rule->getUserId(); |
| 24 |
|
| 25 |
?> |
| 26 |
|
| 27 |
<?php if ( ! tpt_fs()->can_use_premium_code() ) : ?> |
| 28 |
<p style="color: red; background: #f6f6f6; |
| 29 |
margin: 0; |
| 30 |
width: 100%; |
| 31 |
padding: 16px;"> |
| 32 |
<?php esc_html_e( 'Premium feature.', 'tier-pricing-table' ); ?> |
| 33 |
<a target="_blank" href="<?php echo esc_attr( tpt_fs_activation_url() ); ?>"> |
| 34 |
<?php esc_html_e( 'Upgrade to premium', 'tier-pricing-table' ); ?> |
| 35 |
</a> |
| 36 |
</p> |
| 37 |
<?php endif; ?> |
| 38 |
|
| 39 |
<?php |
| 40 |
if ( ! $product->is_type( 'variable' ) ) { |
| 41 |
RegularPricingForm::render( $roleKey, $loop, $pricing_rule->getRegularPrice(), |
| 42 |
$pricing_rule->getSalePrice(), $pricing_rule->getPricingType(), $pricing_rule->getDiscount(), |
| 43 |
$pricing_rule->getDiscountType() ); |
| 44 |
?> |
| 45 |
<hr style="border-color: #f5f5f5;border-top: none;"> |
| 46 |
<?php |
| 47 |
} |
| 48 |
|
| 49 |
MinimumOrderQuantityForm::render( $roleKey, $loop, $pricing_rule->getMinimumOrderQuantity() ); |
| 50 |
|
| 51 |
do_action( 'tiered_pricing_table/admin/user_based_rules/after_minimum_order_quantity_field', |
| 52 |
$pricing_rule->getProductId(), $pricing_rule->getUserId(), $loop ); |
| 53 |
|
| 54 |
?> |
| 55 |
<hr style="border-color: #f5f5f5;border-top: none;"> |
| 56 |
<?php |
| 57 |
|
| 58 |
TieredPricingRulesForm::render( $pricing_rule->getProductId(), $roleKey, $loop, |
| 59 |
$pricing_rule->getTieredPricingType(), $pricing_rule->getPercentageTieredPricingRules(), |
| 60 |
$pricing_rule->getFixedTieredPricingRules() ); |
| 61 |
|
| 62 |
do_action( 'tiered_pricing_table/admin/user_based_rules/after_tiered_pricing_rules_field', |
| 63 |
$pricing_rule->getProductId(), $pricing_rule->getUserId(), $loop ); |
| 64 |
?> |
| 65 |
|