Skip to content

Commit 351b95f

Browse files
committed
Upgrade notice made persistant
1 parent 613bcf5 commit 351b95f

5 files changed

Lines changed: 135 additions & 8 deletions

File tree

assets/images/logo-full.png

7.13 KB
Loading

assets/images/screenshot.png

52.3 KB
Loading

includes/class-welcome-20.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ class WCCT_Welcome_20 {
1010
function __construct() {
1111
add_action( 'admin_init', array( $this, 'redirect_to_page' ), 9999 );
1212
add_action( 'wcct_before_nav', array( $this, 'show_notice' ) );
13+
14+
add_action( 'wp_ajax_wcct_dismiss_notice', array( $this, 'dismiss_notice' ) );
1315
}
1416

1517
/**
@@ -33,13 +35,25 @@ public function redirect_to_page() {
3335
exit;
3436
}
3537

38+
/**
39+
* Dismiss notice
40+
*
41+
* @return void
42+
*/
43+
public function dismiss_notice() {
44+
update_option( '_wcct_20_notice_dismiss', true );
45+
wp_send_json_success();
46+
}
47+
3648
/**
3749
* Show welcome notice to 2.0
3850
*
3951
* @return void
4052
*/
4153
public function show_notice() {
42-
if ( isset( $_GET['notice'] ) && $_GET['notice'] === 'welcome' ) {
54+
$dismissed = get_option( '_wcct_20_notice_dismiss', false );
55+
56+
if ( ! $dismissed ) {
4357
include WCCT_INCLUDES . '/views/welcome-20.php';
4458
}
4559
}

includes/upgrades/upgrade-2.0.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ function wcct_upgrade_2_0_change_option_key() {
2020
);
2121

2222
update_option( 'wcct_settings', $change_settings['custom'] );
23+
update_option( '_wcct_20_notice_dismiss', false );
2324

2425
// redirect transient
2526
set_transient( 'wcct_upgrade_to_20', true, MINUTE_IN_SECONDS );

includes/views/welcome-20.php

Lines changed: 119 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,156 @@
11
<div class="wcct-welcome">
22
<div class="icon-wrap">
3-
<img src="<?php echo WCCT_ASSETS; ?>/images/logo.png" alt="Conversion Tracking Logo">
3+
<img src="<?php echo WCCT_ASSETS; ?>/images/screenshot.png" alt="Conversion Tracking Logo">
44
</div>
55

6+
<button type="button" class="notice-dismiss" id="dismiss-wcct-20">
7+
<span class="screen-reader-text">Dismiss this notice.</span>
8+
</button>
9+
610
<div class="msg-wrap">
7-
<h3>WooCommerce Conversion Tracking just got better</h3>
11+
<h3>WooCommerce Conversion Tracking just got <span style="color:#CD47B1">better</span></h3>
812

913
<p>
1014
Good news, now you can easily track conversions of your WooCommerce store and send data to your favorite ad platforms for improved and precised retargeting campaigns without any coding at all! This makes your Facebook, Twitter, Google Adwords marketing and retargeting easier than ever!
1115
</p>
1216

13-
<p>
14-
<a href="https://wedevs.com/blog/?utm_source=wp-admin&utm_medium=whats_new&utm_campaign=wcct_upgrade_20&utm_content=Whats_New" target="_blank" class="button button-primary">Checkout What's New</a>
15-
<a href="https://wedevs.com/woocommerce-conversion-tracking/upgrade-to-pro/?utm_source=wp-admin&utm_medium=pro-upgrade&utm_campaign=wcct_upgrade&utm_content=Get_Premium" target="_blank" class="button">Upgrate to Pro</a>
17+
<p class="cta-buttons">
18+
<a href="https://wedevs.com/in/woocommerce-conversion-tracking" target="_blank" class="btn-whats-new">Checkout What's New</a>
19+
<a href="https://wedevs.com/woocommerce-conversion-tracking/upgrade-to-pro/?utm_source=wp-admin&utm_medium=pro-upgrade&utm_campaign=wcct_upgrade&utm_content=Get_Premium" target="_blank" class="btn-pro-upgrade">Upgrate to Pro</a>
1620
</p>
21+
22+
<span class="bottom-logo">
23+
<img src="<?php echo WCCT_ASSETS; ?>/images/logo-full.png" width="125" alt="Conversion Tracking Logo">
24+
</span>
1725
</div>
1826
</div>
1927

28+
<script type="text/javascript">
29+
jQuery(function($) {
30+
$('#dismiss-wcct-20').on('click', function(event) {
31+
event.preventDefault();
32+
33+
$(this).parents('.wcct-welcome').slideUp('fast', function() {
34+
$(this).remove();
35+
});
36+
37+
wp.ajax.send('wcct_dismiss_notice');
38+
});
39+
});
40+
</script>
41+
2042
<style>
2143
.wcct-welcome {
2244
background: #fff;
23-
padding: 10px 15px;
45+
padding: 10px 10px 0 10px;
2446
border: 1px solid #e5e5e5;
2547
box-shadow: 0 1px 1px rgba(0,0,0,.04);
2648
display: flex;
2749
margin-top: 15px;
2850
margin-bottom: 15px;
51+
position: relative;
52+
}
53+
54+
.wcct-welcome .notice-dismiss {
55+
z-index: 99;
2956
}
3057

3158
.wcct-welcome .icon-wrap {
32-
width: 100px;
59+
width: 242px;
3360
margin-right: 15px;
3461
}
3562

63+
.wcct-welcome .msg-wrap {
64+
width: calc(100% - 242px);
65+
padding-top: 10px;
66+
position: relative;
67+
}
68+
3669
.wcct-welcome .icon-wrap img {
3770
max-width: 100%;
3871
}
3972

73+
a.btn-whats-new,
74+
a.btn-pro-upgrade {
75+
font-size: 14px;
76+
line-height: 28px;
77+
height: 32px;
78+
display: inline-block;
79+
color: #fff;
80+
text-decoration: none;
81+
cursor: pointer;
82+
border-radius: 3px;
83+
white-space: nowrap;
84+
box-sizing: border-box;
85+
padding: 1px 14px 0px;
86+
}
87+
88+
a.btn-whats-new:hover {
89+
color: #fff;
90+
background: #e45f44;
91+
}
92+
93+
a.btn-whats-new {
94+
background-color: #FD6E51;
95+
margin-right: 10px;
96+
border: 1px solid #f55d3e;
97+
}
98+
99+
a.btn-pro-upgrade {
100+
color: #B190E6;
101+
background-color: #fff;
102+
border: 1px solid #ddd;
103+
box-shadow: 0px 3px 10px 0px rgba(0,0,0, 0.1);
104+
}
105+
106+
a.btn-pro-upgrade:hover {
107+
background-color: #B190E6;
108+
color: #fff;
109+
border: 1px solid #B190E6;
110+
}
111+
112+
.msg-wrap .bottom-logo {
113+
position: absolute;
114+
bottom: 15px;
115+
right: 20px;
116+
}
117+
40118
.wcct-welcome h3 {
119+
color: #000;
41120
margin-top: 5px;
42121
margin-bottom: 10px;
122+
font-weight: bold;
123+
font-size: 20px;
124+
line-height: 150%;
125+
}
126+
127+
p.cta-buttons {
128+
margin: 18px 0 0 0;
129+
}
130+
131+
@media (min-width: 768px) {
132+
p.cta-buttons {
133+
margin-bottom: 20px;
134+
}
135+
}
136+
137+
@media (max-width: 767px) {
138+
.wcct-welcome {
139+
display: block;
140+
padding-bottom: 20px;
141+
}
142+
143+
.wcct-welcome .icon-wrap,
144+
.wcct-welcome .msg-wrap {
145+
width: 100%;
146+
}
147+
148+
.wcct-welcome .msg-wrap {
149+
padding: 0 15px;
150+
}
151+
152+
.msg-wrap .bottom-logo {
153+
display: none;
154+
}
43155
}
44156
</style>

0 commit comments

Comments
 (0)