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 / role-based-pricing / simple / role-based-block.php

role-based-block.php in Tiered Pricing Table for WooCommerce 6.1.0, at views/addons/role-based-pricing/simple/role-based-block.php

79 lines 3.4 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 TierPricingTable\Core\FileManager;
4 use TierPricingTable\Addons\RoleBasedPricing\RoleBasedPriceManager;
5 use TierPricingTable\Addons\RoleBasedPricing\RoleBasedPricingAddon;
6
7 /**
8 * Available variables
9 *
10 * @var FileManager $fileManager
11 * @var int $product_id
12 */
13 ?>
14 <div class="form-field tpt-role-based-block" id="tpt-role-based-block-<?php echo esc_attr( $product_id ); ?>"
15 data-product-type="simple"
16 data-add-action="<?php echo esc_attr( RoleBasedPricingAddon::GET_ROLE_ROW_HTML__ACTION ); ?>"
17 data-add-action-nonce="<?php echo esc_attr( wp_create_nonce( RoleBasedPricingAddon::GET_ROLE_ROW_HTML__ACTION ) ); ?>"
18 data-product-id="<?php echo esc_attr( $product_id ); ?>"
19 data-loop="1">
20 <label class="tpt-role-based-block__name"><?php esc_attr_e( 'Role based pricing', 'tier-pricing-table' ); ?></label>
21 <div class="tpt-role-based-block__content">
22
23 <div class="tpt-role-based-roles">
24
25 <?php
26
27 $presentRoles = array();
28
29 foreach ( wp_roles()->roles as $WPRole => $role_data ) {
30
31 if ( RoleBasedPriceManager::roleHasRules( $WPRole, $product_id, 'edit' ) ) {
32
33 $fileManager->includeTemplate( 'addons/role-based-pricing/simple/role.php', array(
34 'fileManager' => $fileManager,
35 'minimum_amount' => RoleBasedPriceManager::getProductQtyMin( $product_id, $WPRole, 'edit' ),
36 'price_rules_fixed' => RoleBasedPriceManager::getFixedPriceRules( $product_id, $WPRole, 'edit' ),
37 'price_rules_percentage' => RoleBasedPriceManager::getPercentagePriceRules( $product_id, $WPRole, 'edit' ),
38 'type' => RoleBasedPriceManager::getPricingType( $product_id, $WPRole, 'fixed', 'edit' ),
39 'regular_price' => RoleBasedPriceManager::getProductRegularRolePrice( $product_id, $WPRole, 'edit' ),
40 'sale_price' => RoleBasedPriceManager::getProductSaleRolePrice( $product_id, $WPRole, 'edit' ),
41 'role' => $WPRole
42 ) );
43
44 $presentRoles[] = $WPRole;
45 }
46 }
47 ?>
48 </div>
49
50 <div class="tpt-role-based-no-roles"
51 style="<?php echo esc_attr( ! empty( $presentRoles ) ? 'display: none;' : '' ); ?>">
52 <span><?php esc_attr_e( 'Set up separate rules for different roles of customers. Choose a role and click the "Setup for role" button.', 'tier-pricing-table' ); ?></span>
53 <p class="description"
54 style="display: block; margin: 0"><?php esc_attr_e( 'If you do not use this feature, you can disable this functionality at the settings to not complicate the interface. ', 'tier-pricing-table' ); ?></p>
55 </div>
56
57 <div class="tpt-role-based-adding-form">
58 <select name="" id="" class="tpt-role-based-adding-form__role-selector">
59 <?php foreach ( wp_roles()->roles as $key => $WPRole ) : ?>
60 <?php if ( ! in_array( $key, $presentRoles ) ) : ?>
61 <option value="<?php echo esc_attr( $key ); ?>"><?php echo esc_attr( $WPRole['name'] ); ?></option>
62 <?php endif; ?>
63 <?php endforeach; ?>
64 </select>
65
66 <button class="button tpt-role-based-adding-form__add-button"> <?php esc_attr_e( 'Setup for role', 'tier-pricing-table' ); ?></button>
67
68 <div class="clear"></div>
69 </div>
70
71 <select name="tiered_price_rules_roles_to_delete[]" class="tiered_price_rules_roles_to_delete" multiple
72 style="display:none;">
73 <?php foreach ( wp_roles()->roles as $key => $WPRole ) : ?>
74 <option value="<?php echo esc_attr( $key ); ?>"><?php echo esc_attr( $WPRole['name'] ); ?></option>
75 <?php endforeach; ?>
76 </select>
77 </div>
78 </div>
79