| @@ -1,6 +1,8 @@ | ||
| 1 | 1 | <?php namespace TierPricingTable\Addons\Tools\Settings; |
| 2 | 2 | |
| 3 | +use TierPricingTable\Addons\GlobalTieredPricing\CPT\GlobalTieredPricingCPT; | |
| 4 | +use TierPricingTable\Addons\Tools\PricingTest\PricingTester; | |
| 3 | 5 | use TierPricingTable\Settings\Settings as MainSettings; |
| 4 | 6 | |
| 5 | 7 | class Settings { |
| 6 | 8 | |
| @@ -14,9 +16,9 @@ | ||
| 14 | 16 | 'type' => 'tiered-pricing_tools-anchor', |
| 15 | 17 | ), |
| 16 | 18 | array( |
| 17 | 19 | 'title' => __( 'Utilities', 'tier-pricing-table' ), |
| 18 | - 'desc' => __( 'Manage roles and clean up tiered pricing data.', 'tier-pricing-table' ), | |
| 20 | + 'desc' => __( 'Manage roles, test what a customer pays, and clean up tiered pricing data.', 'tier-pricing-table' ), | |
| 19 | 21 | 'id' => MainSettings::SETTINGS_PREFIX . 'tools_utilities', |
| 20 | 22 | 'type' => 'title', |
| 21 | 23 | ), |
| 22 | 24 | array( |
| @@ -66,8 +68,28 @@ | ||
| 66 | 68 | $assetFile['version'], true ); |
| 67 | 69 | |
| 68 | 70 | wp_set_script_translations( 'tiered-pricing/feature/tools', 'tier-pricing-table', |
| 69 | 71 | dirname( __FILE__, 5 ) . '/languages' ); |
| 72 | + | |
| 73 | + // a rule to highlight in the Pricing test, from the links on the rules screens | |
| 74 | + $testRule = isset( $_GET[ PricingTester::RULE_PARAM ] ) ? absint( $_GET[ PricingTester::RULE_PARAM ] ) : 0; | |
| 75 | + $testRule = $testRule && GlobalTieredPricingCPT::SLUG === get_post_type( $testRule ) ? $testRule : 0; | |
| 76 | + | |
| 77 | + wp_localize_script( 'tiered-pricing/feature/tools', 'tptToolsConfig', array( | |
| 78 | + 'ajaxUrl' => admin_url( 'admin-ajax.php' ), | |
| 79 | + 'searchProductsNonce' => wp_create_nonce( 'search-products' ), | |
| 80 | + 'searchCustomersNonce' => wp_create_nonce( 'search-customers' ), | |
| 81 | + 'pricingTest' => array( | |
| 82 | + 'rulesEnabled' => PricingTester::rulesEnabled(), | |
| 83 | + 'rulesUrl' => admin_url( 'edit.php?post_type=' . GlobalTieredPricingCPT::SLUG ), | |
| 84 | + 'newRuleUrl' => admin_url( 'post-new.php?post_type=' . GlobalTieredPricingCPT::SLUG ), | |
| 85 | + 'rule' => $testRule ? array( | |
| 86 | + 'id' => $testRule, | |
| 87 | + 'title' => PricingTester::ruleTitle( $testRule ), | |
| 88 | + 'url' => get_edit_post_link( $testRule, 'raw' ), | |
| 89 | + ) : null, | |
| 90 | + ), | |
| 91 | + ) ); | |
| 70 | 92 | |
| 71 | 93 | wp_enqueue_style( 'wp-components' ); |
| 72 | 94 | } ); |
| 73 | 95 | } |