← All changes
|
src/Addons/RoleBasedPricing/Import/RoleBasedPricingImport.php
+17
-14
7.1.4
→
8.1.0
View file →
| @@ -151,23 +151,26 @@ | ||
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | $roleName = isset( $wp_roles->role_names[ $WPRole ] ) ? translate_user_role( $wp_roles->role_names[ $WPRole ] ) : $WPRole; |
| 154 | 154 | |
| 155 | - $columns[ 'Tiered Pricing — [' . $roleName . '] Regular pricing type' ] = $WPRole . '_tiered_price_pricing_type'; | |
| 155 | + $labels = array( | |
| 156 | + 'Regular pricing type' => $WPRole . '_tiered_price_pricing_type', | |
| 157 | + 'Regular price' => $WPRole . '_tiered_price_regular_price', | |
| 158 | + 'Sale price' => $WPRole . '_tiered_price_sale_price', | |
| 159 | + 'Percentage discount' => $WPRole . '_tiered_price_discount', | |
| 160 | + 'Fixed pricing rules' => $WPRole . '_tiered_price_fixed', | |
| 161 | + 'Percentage pricing rules' => $WPRole . '_tiered_price_percentage', | |
| 162 | + 'Tiered pricing type' => $WPRole . '_tiered_price_type', | |
| 163 | + 'Minimum order quantity' => $WPRole . '_tiered_price_minimum', | |
| 164 | + ); | |
| 156 | 165 | |
| 157 | - $columns[ 'Tiered Pricing — [' . $roleName . '] Regular price' ] = $WPRole . '_tiered_price_regular_price'; | |
| 158 | - | |
| 159 | - $columns[ 'Tiered Pricing — [' . $roleName . '] Sale price' ] = $WPRole . '_tiered_price_sale_price'; | |
| 160 | - | |
| 161 | - $columns[ 'Tiered Pricing — [' . $roleName . '] Percentage discount' ] = $WPRole . '_tiered_price_discount'; | |
| 162 | - | |
| 163 | - $columns[ 'Tiered Pricing — [' . $roleName . '] Fixed pricing rules' ] = $WPRole . '_tiered_price_fixed'; | |
| 164 | - | |
| 165 | - $columns[ 'Tiered Pricing — [' . $roleName . '] Percentage pricing rules' ] = $WPRole . '_tiered_price_percentage'; | |
| 166 | - | |
| 167 | - $columns[ 'Tiered Pricing — [' . $roleName . '] Tiered pricing type' ] = $WPRole . '_tiered_price_type'; | |
| 168 | - | |
| 169 | - $columns[ 'Tiered Pricing — [' . $roleName . '] Minimum order quantity' ] = $WPRole . '_tiered_price_minimum'; | |
| 166 | + foreach ( $labels as $label => $column ) { | |
| 167 | + // The exporter writes "Tiered Pricing — [Role] Label". Files exported before 8.0.3 / 10.0.3 carried | |
| 168 | + // two (three for the pricing type) spaces before the bracket; they must keep mapping automatically. | |
| 169 | + foreach ( array( ' ', ' ', ' ' ) as $spacing ) { | |
| 170 | + $columns[ 'Tiered Pricing —' . $spacing . '[' . $roleName . '] ' . $label ] = $column; | |
| 171 | + } | |
| 172 | + } | |
| 170 | 173 | } |
| 171 | 174 | |
| 172 | 175 | return $columns; |
| 173 | 176 | } |