PluginProbe
Tiered Pricing Table for WooCommerce / 7.1.4
Tiered Pricing Table for WooCommerce v7.1.4
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 / src / Admin / ProductPage / RoleCustomerPricingTab.php

RoleCustomerPricingTab.php in Tiered Pricing Table for WooCommerce 7.1.4, at src/Admin/ProductPage/RoleCustomerPricingTab.php

93 lines 3.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php namespace TierPricingTable\Admin\ProductPage;
2
3 use TierPricingTable\Core\ServiceContainerTrait;
4 use TierPricingTable\TierPricingTablePlugin;
5
6 class RoleCustomerPricingTab {
7
8 use ServiceContainerTrait;
9
10 public function __construct() {
11 add_filter( 'woocommerce_product_data_tabs', array( $this, 'register' ), 99, 1 );
12 add_action( 'woocommerce_product_data_panels', array( $this, 'render' ) );
13 }
14
15 public function register( $productTabs ): array {
16 if ( ! apply_filters( 'tiered_pricing_table/admin/role_customer_pricing_tab_active', false ) ) {
17 return $productTabs;
18 }
19
20 $productTabs['role-customer-pricing-tab'] = array(
21 'label' => __( 'Role & Customer Prices', 'tier-pricing-table' ),
22 'target' => 'role-customer-pricing-data',
23 'class' => ( function () {
24 $types = array_merge( TierPricingTablePlugin::getSupportedSimpleProductTypes(),
25 TierPricingTablePlugin::getSupportedVariableProductTypes() );
26
27 $classes = array_map( function ( $type ) {
28 return 'show_if_' . $type;
29 }, $types );
30
31 return $classes;
32 } )(),
33 );
34
35 return $productTabs;
36 }
37
38 public function render() {
39 if ( ! apply_filters( 'tiered_pricing_table/admin/role_customer_pricing_tab_active', false ) ) {
40 return;
41 }
42
43 global $post;
44 ?>
45 <div id="role-customer-pricing-data" class="panel woocommerce_options_panel">
46
47 <?php
48 if ( ! tpt_fs()->can_use_premium_code() ) {
49 $this->renderUpgradeNotice();
50 }
51
52 if ( tpt_fs()->can_use_premium_code() && ! tpt_fs()->is_premium() ) {
53 $this->getContainer()->getFileManager()->includeTemplate( 'admin/banners/free-version-used-premium-available.php',
54 array( 'is_product' => true, ) );
55 }
56
57 do_action( 'tiered_pricing_table/admin/role_customer_pricing_tab_begin', $post->ID );
58 ?>
59
60 <div class="options_group">
61 <?php do_action( 'tiered_pricing_table/admin/role_customer_pricing_tab_content', $post->ID ); ?>
62 </div>
63
64 <?php do_action( 'tiered_pricing_table/admin/role_customer_pricing_tab_end', $post->ID ); ?>
65 </div>
66 <?php
67 }
68
69 protected function renderUpgradeNotice() {
70 ?>
71 <div style="display: flex; align-items: center; border-bottom: 1px solid #eee; justify-content: space-between; background: #f5f5f5; padding: 15px 20px; margin: 0 0 15px;">
72 <div style="display: flex; align-items: center;">
73 <span style="animation: pulse-animation 2s infinite; background: var(--wp-admin-theme-color); color: #fff; padding: 4px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; margin-right: 15px; display: inline-flex; align-items: center; gap: 4px;">
74 <svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
75 <polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"></polygon>
76 </svg>
77 <?php esc_html_e( 'Premium', 'tier-pricing-table' ); ?>
78 </span>
79 <span style="color: #3c434a; font-weight: 500;">
80 <?php esc_html_e( 'Unlock Role & Customer pricing rules by upgrading to Premium.', 'tier-pricing-table' ); ?>
81 </span>
82 </div>
83 <div>
84 <a target="_blank" class="" href="<?php echo esc_attr( tpt_fs()->get_upgrade_url() ); ?>">
85 <?php esc_html_e( 'Upgrade Now', 'tier-pricing-table' ); ?>
86 </a>
87 </div>
88 </div>
89 <?php
90 }
91
92 }
93