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 / rules.php

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

126 lines 5.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 use MeowCrew\RoleAndCustomerBasedPricing\Entity\GlobalPricingRule;
4 use TierPricingTable\Addons\GlobalTieredPricing\LookupService;
5
6 if ( ! defined( 'WPINC' ) ) {
7 die;
8 }
9
10 /**
11 * Available variables
12 *
13 * @var FileManager $fileManager
14 * @var GlobalPricingRule $priceRule
15 */
16
17 ?>
18 <style type="text/css">
19 #edit-slug-box, #minor-publishing-actions {
20 display: none
21 }
22 </style>
23
24 <div class="panel woocommerce_options_panel">
25 <div class="options_group">
26
27 <div class="tpt-global-pricing-title">
28 <hr>
29 <h4><?php esc_attr_e( 'Choose the products and/or categories to apply the pricing rule', 'tier-pricing-table' ); ?></h4>
30 </div>
31
32 <p class="form-field">
33 <label for="tpt_included_categories"><?php esc_html_e( 'Apply for categories', 'tier-pricing-table' ); ?></label>
34
35 <select class="wc-product-search" multiple="multiple" style="width: 50%;" id="tpt_included_categories"
36 name="tpt_included_categories[]"
37 data-placeholder="<?php esc_attr_e( 'Search for a category&hellip;', 'tier-pricing-table' ); ?>"
38 data-action="woocommerce_json_search_tpt_categories">
39
40 <?php foreach ( $priceRule->getIncludedProductCategories() as $categoryId ) : ?>
41 <?php $category = get_term_by( 'id', $categoryId, 'product_cat' ); ?>
42
43 <?php if ( $category ) : ?>
44 <option selected
45 value="<?php echo esc_attr( $categoryId ); ?>"><?php echo esc_attr( LookupService::getCategoryLabel( $category ) ); ?></option>
46 <?php endif; ?>
47
48 <?php endforeach; ?>
49 </select>
50
51 <?php echo wc_help_tip( __( 'Choose the categories for which this pricing rule will apply. The rule applies to all products in the category.', 'tier-pricing-table' ) ); ?>
52 </p>
53
54 <p class="form-field">
55 <label for="tpt_included_products"><?php esc_html_e( 'Apply for specific products', 'tier-pricing-table' ); ?></label>
56
57 <select class="wc-product-search" multiple="multiple" style="width: 50%;" id="tpt_included_products"
58 name="tpt_included_products[]"
59 data-placeholder="<?php esc_attr_e( 'Search for a product&hellip;', 'tier-pricing-table' ); ?>"
60 data-action="woocommerce_json_search_products">
61
62 <?php foreach ( $priceRule->getIncludedProducts() as $productId ) : ?>
63
64 <?php $product = wc_get_product( $productId ); ?>
65
66 <?php if ( $product ) : ?>
67 <option selected
68 value="<?php echo esc_attr( $productId ); ?>"><?php echo esc_attr( $product->get_name() ); ?></option>
69 <?php endif; ?>
70
71 <?php endforeach; ?>
72 </select>
73
74 <?php echo wc_help_tip( __( 'Pick up products for which you want to apply the pricing rule.', 'tier-pricing-table' ) ); ?>
75 </p>
76
77 <div class="tpt-global-pricing-title">
78 <hr>
79 <h4><?php esc_attr_e( 'Choose the user role and/or customers\' accounts to apply the pricing rule', 'tier-pricing-table' ); ?></h4>
80 </div>
81
82 <p class="form-field">
83 <label for="tpt_included_user_roles"><?php esc_html_e( 'Include user roles', 'tier-pricing-table' ); ?></label>
84
85 <select class="tpt-select-woo" multiple="multiple" style="width: 50%;" id="tpt_included_user_roles"
86 name="tpt_included_user_roles[]"
87 data-placeholder="<?php esc_attr_e( 'Select for a customer role&hellip;', 'tier-pricing-table' ); ?>">
88
89 <?php foreach ( wp_roles()->roles as $key => $WPRole ) : ?>
90 <?php if ( ! in_array( $key, array() ) ) : ?>
91 <option
92 <?php selected( in_array( $key, $priceRule->getIncludedUserRoles() ) ); ?>
93 value="<?php echo esc_attr( $key ); ?>">
94 <?php echo esc_attr( $WPRole['name'] ); ?>
95 </option>
96 <?php endif; ?>
97 <?php endforeach; ?>
98 </select>
99
100 <?php echo wc_help_tip( __( 'Choose to what user roles this rule will be relevant. Applies to all users with those roles.', 'tier-pricing-table' ) ); ?>
101 </p>
102
103 <p class="form-field">
104 <label for="tpt_included_users"><?php esc_html_e( 'Include specific customers', 'tier-pricing-table' ); ?></label>
105
106 <select class="rbp-select-woo wc-product-search" multiple="multiple" style="width: 50%;"
107 id="tpt_included_users"
108 name="tpt_included_users[]"
109 data-action="woocommerce_json_search_tpt_customers"
110 data-placeholder="<?php esc_attr_e( 'Select for a customer&hellip;', 'tier-pricing-table' ); ?>">
111
112 <?php foreach ( $priceRule->getIncludedUsers() as $userId ) : ?>
113 <?php $user = get_user_by( 'id', $userId ); ?>
114 <?php if ( $user ) : ?>
115 <option selected
116 value="<?php echo esc_attr( $userId ); ?>"><?php echo esc_attr( $user->first_name . ' ' . $user->last_name . ' (' . $user->user_email . ')' ); ?></option>
117 <?php endif; ?>
118
119 <?php endforeach; ?>
120 </select>
121
122 <?php echo wc_help_tip( __( 'Pick up separate user accounts, which will be affected by this rule. ', 'tier-pricing-table' ) ); ?>
123 </p>
124 </div>
125 </div>
126