| 1 |
<?php |
| 2 |
/** |
| 3 |
* Merchant Pro upsell notice. |
| 4 |
* |
| 5 |
*/ |
| 6 |
|
| 7 |
if ( ! defined( 'ABSPATH' ) ) { |
| 8 |
exit; // Exit if accessed directly |
| 9 |
} |
| 10 |
|
| 11 |
class Merchant_Notice_Upsell extends Merchant_Notice { |
| 12 |
|
| 13 |
/** |
| 14 |
* Constructor. |
| 15 |
* |
| 16 |
*/ |
| 17 |
public function __construct() { |
| 18 |
$this->id = 'merchant-upsell-notice'; |
| 19 |
$this->only_free = true; |
| 20 |
|
| 21 |
parent::__construct(); |
| 22 |
|
| 23 |
add_action( 'admin_init', array( $this, 'set_plugin_installed_time' ), 0 ); |
| 24 |
} |
| 25 |
|
| 26 |
/** |
| 27 |
* Set plugin installed time in database. |
| 28 |
* |
| 29 |
* @return void |
| 30 |
*/ |
| 31 |
public function set_plugin_installed_time() { |
| 32 |
if ( ! get_option( 'merchant_plugin_installed_time' ) ) { |
| 33 |
update_option( 'merchant_plugin_installed_time', time() ); |
| 34 |
} |
| 35 |
} |
| 36 |
|
| 37 |
/** |
| 38 |
* Show HTML markup if conditions meet. |
| 39 |
* |
| 40 |
* @return void |
| 41 |
*/ |
| 42 |
public function notice_markup() { |
| 43 |
if ( ( get_option( 'merchant_plugin_installed_time' ) > strtotime( '-3 day' ) ) ) { |
| 44 |
return; |
| 45 |
} |
| 46 |
|
| 47 |
$url = merchant_admin_upgrade_link( |
| 48 |
'https://athemes.com/merchant-upgrade', |
| 49 |
array( |
| 50 |
'utm_source' => 'plugin_notice', |
| 51 |
'utm_content' => 'upgrade_notice', |
| 52 |
'utm_medium' => 'button', |
| 53 |
'utm_campaign' => 'Merchant', |
| 54 |
), |
| 55 |
'plugin-admin-notice' |
| 56 |
); |
| 57 |
|
| 58 |
?> |
| 59 |
<div class="merchant-notice merchant-notice-with-thumbnail notice" style="position:relative;"> |
| 60 |
<h3><?php echo esc_html__( 'Supercharge Your Store with Merchant Pro! 🚀', 'merchant' ); ?></h3> |
| 61 |
|
| 62 |
<p> |
| 63 |
<?php |
| 64 |
echo esc_html__( 'With Merchant Pro\'s 40+ powerful modules — including Product Bundles, Frequently Bought Together, and Bulk Discounts — you can boost sales, enhance customer experience, and minimize cart abandonment, all from one convenient plugin.', 'merchant' ); |
| 65 |
?> |
| 66 |
</p> |
| 67 |
|
| 68 |
<a href="<?php echo esc_url( $url ) ?>" class="merchant-btn merchant-btn-secondary" target="_blank"><?php esc_html_e( 'Upgrade To Merchant Pro', 'merchant' ); ?></a> |
| 69 |
|
| 70 |
<a class="notice-dismiss" href="?<?php echo esc_attr( $this->id ); ?>_dismiss=1" style="text-decoration:none;"></a> |
| 71 |
</div> |
| 72 |
|
| 73 |
<?php |
| 74 |
} |
| 75 |
} |
| 76 |
|
| 77 |
new Merchant_Notice_Upsell(); |
| 78 |
|