PluginProbe
Tiered Pricing Table for WooCommerce / 8.1.0
Tiered Pricing Table for WooCommerce v8.1.0
8.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 All 92 releases
← All changes | src/Addons/RoleBasedPricing/Export/RoleBasedPricingExport.php +18 -10 6.4.0 → 8.1.0 View file →
@@ -19,10 +19,14 @@
19 19 return;
20 20 }
21 21
22 22 $columns = array();
23 + $disabled_roles = apply_filters( 'tiered_pricing_table/role_based_rules/import_export_disabled_roles', array( 'editor', 'author', 'contributor', 'shop_manager' ) );
23 24
24 25 foreach ( wp_roles()->roles as $WPRole => $role_data ) {
26 + if ( in_array( $WPRole, $disabled_roles, true ) ) {
27 + continue;
28 + }
25 29
26 30 $columns[] = array(
27 31 'column_title' => $WPRole . '_tiered_price_pricing_type',
28 32 'export_callback' => function ( $value, WC_Product $product ) use ( $WPRole ) {
@@ -59,9 +63,9 @@
59 63 $str = '';
60 64 $separator = TierPricingTablePlugin::getRulesSeparator();
61 65
62 66 foreach ( $fixedRules as $quantity => $price ) {
63 - $str .= $quantity . ':' . $price . $separator;
67 + $str .= $quantity . TierPricingTablePlugin::getRuleSeparator() . $price . $separator;
64 68 }
65 69
66 70 return mb_strlen( $str ) > 0 ? trim( $str, $separator ) : null;
67 71 },
@@ -75,9 +79,9 @@
75 79 $str = '';
76 80 $separator = TierPricingTablePlugin::getRulesSeparator();
77 81
78 82 foreach ( $fixedRules as $quantity => $discount ) {
79 - $str .= $quantity . ':' . $discount . $separator;
83 + $str .= $quantity . TierPricingTablePlugin::getRuleSeparator() . $discount . $separator;
80 84 }
81 85
82 86 return mb_strlen( $str ) > 0 ? trim( $str, $separator ) : null;
83 87 },
@@ -111,28 +115,32 @@
111 115 */
112 116 public function addExportColumn( array $columns ): array {
113 117
114 118 global $wp_roles;
119 + $disabled_roles = apply_filters( 'tiered_pricing_table/role_based_rules/import_export_disabled_roles', array( 'editor', 'author', 'contributor', 'shop_manager' ) );
115 120
116 121 foreach ( wp_roles()->roles as $WPRole => $role_data ) {
122 + if ( in_array( $WPRole, $disabled_roles, true ) ) {
123 + continue;
124 + }
117 125
118 126 $roleName = isset( $wp_roles->role_names[ $WPRole ] ) ? translate_user_role( $wp_roles->role_names[ $WPRole ] ) : $WPRole;
119 127
120 - $columns[ $WPRole . '_tiered_price_pricing_type' ] = 'Tiered Pricing — ' . ' [' . $roleName . '] ' . __( 'Regular pricing type',
128 + $columns[ $WPRole . '_tiered_price_pricing_type' ] = 'Tiered Pricing — [' . $roleName . '] ' . __( 'Regular pricing type',
121 129 'tier-pricing-table' );
122 - $columns[ $WPRole . '_tiered_price_regular_price' ] = 'Tiered Pricing — ' . ' [' . $roleName . '] ' . __( 'Regular price',
130 + $columns[ $WPRole . '_tiered_price_regular_price' ] = 'Tiered Pricing — [' . $roleName . '] ' . __( 'Regular price',
123 131 'tier-pricing-table' );
124 - $columns[ $WPRole . '_tiered_price_sale_price' ] = 'Tiered Pricing — ' . ' [' . $roleName . '] ' . __( 'Sale price',
132 + $columns[ $WPRole . '_tiered_price_sale_price' ] = 'Tiered Pricing — [' . $roleName . '] ' . __( 'Sale price',
125 133 'tier-pricing-table' );
126 - $columns[ $WPRole . '_tiered_price_discount' ] = 'Tiered Pricing — ' . ' [' . $roleName . '] ' . __( 'Percentage discount',
134 + $columns[ $WPRole . '_tiered_price_discount' ] = 'Tiered Pricing — [' . $roleName . '] ' . __( 'Percentage discount',
127 135 'tier-pricing-table' );
128 - $columns[ $WPRole . '_tiered_price_fixed' ] = 'Tiered Pricing — ' . ' [' . $roleName . '] ' . __( 'Fixed pricing rules',
136 + $columns[ $WPRole . '_tiered_price_fixed' ] = 'Tiered Pricing — [' . $roleName . '] ' . __( 'Fixed pricing rules',
129 137 'tier-pricing-table' );
130 - $columns[ $WPRole . '_tiered_price_percentage' ] = 'Tiered Pricing — ' . ' [' . $roleName . '] ' . __( 'Percentage pricing rules',
138 + $columns[ $WPRole . '_tiered_price_percentage' ] = 'Tiered Pricing — [' . $roleName . '] ' . __( 'Percentage pricing rules',
131 139 'tier-pricing-table' );
132 - $columns[ $WPRole . '_tiered_price_type' ] = 'Tiered Pricing — ' . ' [' . $roleName . '] ' . __( 'Tiered pricing type',
140 + $columns[ $WPRole . '_tiered_price_type' ] = 'Tiered Pricing — [' . $roleName . '] ' . __( 'Tiered pricing type',
133 141 'tier-pricing-table' );
134 - $columns[ $WPRole . '_tiered_price_minimum' ] = 'Tiered Pricing — ' . ' [' . $roleName . '] ' . __( 'Minimum order quantity',
142 + $columns[ $WPRole . '_tiered_price_minimum' ] = 'Tiered Pricing — [' . $roleName . '] ' . __( 'Minimum order quantity',
135 143 'tier-pricing-table' );
136 144 }
137 145
138 146 return $columns;