| @@ -49,15 +49,26 @@ | ||
| 49 | 49 | add_action( 'admin_enqueue_scripts', [ $this, 'enqueueAssets' ] ); |
| 50 | 50 | if ( get_transient( 'tier_pricing_table_activated' ) ) { |
| 51 | 51 | add_action( 'admin_notices', [ $this, 'showActivationMessage' ] ); |
| 52 | 52 | } |
| 53 | + | |
| 53 | 54 | if ( $this->licence->isFree() ) { |
| 54 | - add_action( 'woocommerce_settings_' . Settings::SETTINGS_PAGE, function () { | |
| 55 | - $this->fileManager->includeTemplate( 'admin/upgrade-message.php', [ | |
| 56 | - 'upgradeLink' => $this->licence->getUpgradeLink(), | |
| 55 | + | |
| 56 | + if ( tpt_fs()->is_anonymous() || !tpt_fs()->is_installed_on_site() ) { | |
| 57 | + $template = 'opt-in-alert.php'; | |
| 58 | + } else { | |
| 59 | + $template = 'upgrade-alert.php'; | |
| 60 | + } | |
| 61 | + | |
| 62 | + add_action( 'woocommerce_settings_' . Settings::SETTINGS_PAGE, function () use( $template ) { | |
| 63 | + $this->fileManager->includeTemplate( 'admin/alerts/' . $template, [ | |
| 64 | + 'upgradeUrl' => $this->licence->getUpgradeLink(), | |
| 65 | + 'contactUsUrl' => $this->licence->getContactUsPageUrl(), | |
| 57 | 66 | ] ); |
| 67 | + $this->fileManager->includeTemplate( 'admin/only-in-premium-script.php' ); | |
| 58 | 68 | } ); |
| 59 | 69 | } |
| 70 | + | |
| 60 | 71 | } |
| 61 | 72 | |
| 62 | 73 | public function initManagers() |
| 63 | 74 | { |
| @@ -72,9 +83,9 @@ | ||
| 72 | 83 | */ |
| 73 | 84 | public function showActivationMessage() |
| 74 | 85 | { |
| 75 | 86 | $link = $this->settings->getLink(); |
| 76 | - $this->fileManager->includeTemplate( 'admin/activation-message.php', [ | |
| 87 | + $this->fileManager->includeTemplate( 'admin/alerts/activation-alert.php', [ | |
| 77 | 88 | 'link' => $link, |
| 78 | 89 | ] ); |
| 79 | 90 | delete_transient( 'tiered_pricing_table_activated' ); |
| 80 | 91 | } |
| @@ -85,11 +96,11 @@ | ||
| 85 | 96 | * @param $page |
| 86 | 97 | */ |
| 87 | 98 | public function enqueueAssets( $page ) |
| 88 | 99 | { |
| 89 | - global $post ; | |
| 100 | + global $post, $page ; | |
| 90 | 101 | |
| 91 | - if ( ($page == 'post.php' || ($page = 'post_new.php')) && $post && $post->post_type == 'product' ) { | |
| 102 | + if ( isset( $_GET['tab'] ) && $_GET['tab'] == Settings::SETTINGS_PAGE || ($page == 'post.php' || ($page = 'post_new.php')) && $post && $post->post_type == 'product' ) { | |
| 92 | 103 | wp_enqueue_script( |
| 93 | 104 | 'tier-pricing-table-admin-js', |
| 94 | 105 | $this->fileManager->locateAsset( 'admin/main.js' ), |
| 95 | 106 | 'jquery', |