PluginProbe
Tiered Pricing Table for WooCommerce / 6.1.0
Tiered Pricing Table for WooCommerce v6.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 2.3.3 All 91 releases
tier-pricing-table / views / addons / global-rules / role-specific-pricing / pricing.php

pricing.php in Tiered Pricing Table for WooCommerce 6.1.0, at views/addons/global-rules/role-specific-pricing/pricing.php

167 lines 6.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php defined( 'ABSPATH' ) || die;
2
3 use MeowCrew\RoleAndCustomerBasedPricing\Core\FileManager;
4 use TierPricingTable\Addons\GlobalTieredPricing\GlobalPricingRule;
5
6 /**
7 * Available variables
8 *
9 * @var FileManager $fileManager
10 * @var GlobalPricingRule $priceRule
11 */
12 ?>
13
14 <?php
15
16 $minimumInputAttrs = array(
17 'min' => 1,
18 'step' => 1
19 );
20
21 $desc = __( 'Set if you sell the product only from a specific quantity that is more than 1', 'tier-pricing-table' );
22 $tip = true;
23 $premiumNotice = '';
24
25 if ( ! tpt_fs()->is_premium() ) {
26 $minimumInputAttrs['disabled'] = true;
27 }
28
29 ?>
30 <div class="tpt-global-pricing-title">
31 <hr>
32 <h4><?php esc_attr_e( 'Pricing', 'tier-pricing-table' ); ?>
33 <?php if ( ! tpt_fs()->is_premium() ): ?>
34 <span class="tpt_premium_subsection_label"
35 style="font-size: .8em">
36 <?php esc_html_e( 'Only in premium version', 'tier-pricing-table' ); ?>
37 </span>
38 <a target="_blank" style="margin-left: 10px" href="<?php echo esc_attr( tpt_fs()->get_upgrade_url() ) ?>" class="button-small">
39 <?php esc_html_e( 'Upgrade your plan', 'tier-pricing-table' ); ?>
40 </a>
41 <?php endif; ?>
42 </h4>
43 </div>
44
45 <p class="form-field tiered_pricing_pricing_type_field">
46 <label for="tpt_pricing_type"><?php esc_attr_e( 'Pricing type', 'tier-pricing-table' ); ?> </label>
47
48 <select name="tpt_pricing_type" id="tpt_pricing_type" data-tiered-price-pricing-type-select>
49 <option value="flat" <?php selected( $priceRule->getPricingType(), 'flat' ); ?>><?php esc_attr_e( 'Flat prices', 'tier-pricing-table' ); ?></option>
50 <option value="percentage" <?php selected( $priceRule->getPricingType(), 'percentage' ); ?>><?php esc_attr_e( 'Percentage discount', 'tier-pricing-table' ); ?></option>
51 </select>
52 </p>
53
54 <p class="form-field tiered_pricing_discount_field <?php echo $priceRule->getPricingType() === 'flat' ? 'hidden' : ''; ?>"
55 data-tiered-price-pricing-type
56 data-tiered-price-pricing-type-percentage>
57 <label for="tpt_discount"><?php esc_attr_e( 'Discount (%)', 'tier-pricing-table' ); ?> </label>
58
59 <input <?php echo ! tpt_fs()->is_premium() ? 'disabled' : ''; ?>
60 type="number"
61 min="0"
62 max="100"
63 step="any"
64 value="<?php echo esc_attr( $priceRule->getDiscount() ); ?>"
65 placeholder="<?php esc_attr_e( 'Leave empty to don\'t apply any', 'tier-pricing-table' );
66 echo esc_attr( $premiumNotice ); ?>"
67 name="tpt_discount" id="tpt_discount">
68 </p>
69
70 <p class="form-field tiered_pricing_regular_price_field <?php echo $priceRule->getPricingType() === 'percentage' ? 'hidden' : ''; ?>"
71 data-tiered-price-pricing-type
72 data-tiered-price-pricing-type-flat>
73 <label for="tpt_regular_price"><?php echo esc_attr( __( 'Regular price', 'tier-pricing-table' ) . ' (' . get_woocommerce_currency_symbol() . ')' ); ?> </label>
74
75 <input <?php echo ! tpt_fs()->is_premium() ? 'disabled' : ''; ?>
76 type="text"
77 value="<?php echo esc_attr( wc_format_localized_price( $priceRule->getRegularPrice() ) ); ?>"
78 placeholder="<?php esc_attr_e( 'Leave empty to don\'t change it', 'tier-pricing-table' );
79 echo esc_attr( $premiumNotice ); ?>"
80 class="wc_input_price"
81 name="tpt_regular_price">
82 </p>
83
84 <p class="form-field tiered_pricing_sale_price_field <?php echo $priceRule->getPricingType() === 'percentage' ? 'hidden' : ''; ?>"
85 data-tiered-price-pricing-type
86 data-tiered-price-pricing-type-flat>
87 <label for="tpt_sale_price"><?php echo esc_attr( __( 'Sale price', 'tier-pricing-table' ) . ' (' . get_woocommerce_currency_symbol() . ')' ); ?></label>
88
89 <input <?php echo ! tpt_fs()->is_premium() ? 'disabled' : ''; ?>
90 type="text"
91 value="<?php echo esc_attr( wc_format_localized_price( $priceRule->getSalePrice() ) ); ?>"
92 placeholder="<?php esc_attr_e( 'Leave empty to don\'t change it', 'tier-pricing-table' );
93 echo esc_attr( $premiumNotice ); ?>"
94 class="wc_input_price"
95 name="tpt_sale_price">
96 </p>
97
98 <div class="tpt-global-pricing-title">
99 <hr>
100 <h4><?php esc_attr_e( 'Tiered Pricing', 'tier-pricing-table' ); ?></h4>
101 </div>
102
103 <p class="form-field">
104 <label for="tpt_applying_type"><?php esc_html_e( 'Applying pricing as', 'tier-pricing-table' ); ?></label>
105
106 <select name="tpt_applying_type" id="tpt_applying_type" style="width: 50%;">
107 <option value="cross" <?php selected( $priceRule->getApplyingType(), 'cross' ); ?>>
108 <?php esc_html_e( 'Cross the products (calculate discounts based on
109 quantity of any product in this rule)', 'tier-pricing-table' ); ?>
110 </option>
111 <option value="individual" <?php selected( $priceRule->getApplyingType(), 'individual' ); ?>>
112 <?php esc_html_e( 'Per individual product (calculate discounts based on quantity of a particular product)', 'tier-pricing-table' ); ?>
113 </option>
114 </select>
115 </p>
116
117 <div>
118 <?php
119
120 $fileManager->includeTemplate( 'admin/add-price-rules.php', array(
121 'price_rules_fixed' => $priceRule->getFixedTieredPricingRules(),
122 'price_rules_percentage' => $priceRule->getPercentageTieredPricingRules(),
123 'type' => $priceRule->getTieredPricingType(),
124 'prefix' => 'global',
125 'isFree' => ! tpt_fs()->is_premium()
126 ) );
127
128 ?>
129 </div>
130
131 <div class="tpt-global-pricing-title">
132 <hr>
133 <h4><?php esc_attr_e( 'Minimum Order Quantity', 'tier-pricing-table' ); ?>
134 <?php if ( ! tpt_fs()->is_premium() ): ?>
135 <span class="tpt_premium_subsection_label"
136 style="font-size: .8em">
137 <?php esc_html_e( 'Only in premium version', 'tier-pricing-table' ); ?>
138 </span>
139 <a target="_blank" style="margin-left: 10px" href="<?php echo esc_attr( tpt_fs()->get_upgrade_url() ) ?>" class="button-small">
140 <?php esc_html_e( 'Upgrade your plan', 'tier-pricing-table' ); ?>
141 </a>
142 <?php endif; ?>
143 </h4>
144 </div>
145
146 <?php
147 woocommerce_wp_text_input( array(
148 'id' => 'tpt_minimum',
149 'type' => 'number',
150 'custom_attributes' => $minimumInputAttrs,
151 'value' => $priceRule->getMinimum(),
152 'label' => __( 'Minimum quantity', 'tier-pricing-table' ),
153 'description' => $desc,
154 'default' => 1,
155 'desc_tip' => $tip
156 ) );
157 ?>
158
159 <script>
160 jQuery(document).ready(function ($) {
161 $('[data-tiered-price-pricing-type-select]').on('change', function () {
162 $('[data-tiered-price-pricing-type]').css('display', 'none');
163 $('[data-tiered-price-pricing-type-' + this.value + ']').css('display', 'block');
164 });
165 });
166 </script>
167