Skip to content

Commit

Permalink
Merge pull request #187 from pluginever/fix/184
Browse files Browse the repository at this point in the history
Include the Black Friday deals notice
  • Loading branch information
kawsarahmedr authored Nov 24, 2024
2 parents 82064e9 + 7d3eaad commit ef8a843
Show file tree
Hide file tree
Showing 6 changed files with 162 additions and 18 deletions.
57 changes: 57 additions & 0 deletions assets/css/_black-friday.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
.notice.notice-black-friday {
position: relative;
.notice-content {
width: 85%;
h3{
font-size: 1.5rem;
}
}
.notice-footer {
justify-content: space-between;
.footer-btn {
display: flex;
gap: 20px;
}
.black-friday-dismiss-btn{
position: absolute;
top: 12px;
right: 12px;
background-color: transparent;
border-color: transparent;
color: #64748B;
&:hover {
color: #000;
}
}
.black-friday-footer-text {
float: right;
color: #8c8f94;
}
}
@media screen and (max-width: 500px ) {
.notice-body {
align-items: flex-start;
h3{
font-size: 18px;
}
}
.notice-footer {
flex-direction: column;
.footer-btn {
flex-direction: column;
align-items: center;
gap: 10px;
}
.black-friday-dismiss-btn {
top: -6px;
right: 3px;
z-index: 1;
padding: 0;
color: red;
}
.btn-text{
display: none;
}
}
}
}
2 changes: 1 addition & 1 deletion assets/css/admin.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import "halloween.scss";
@import "black-friday.scss";
.bk-card {
&.promo-panel{
background: #2563eb;
Expand Down
15 changes: 15 additions & 0 deletions assets/images/black-friday-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 8 additions & 8 deletions includes/Admin/Notices.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,16 @@ public function admin_notices() {
$installed_time = get_option( 'wc_min_max_quantities_installed' );
$current_time = wp_date( 'U' );

// Halloween's promotion notice.
$halloween_time = date_i18n( strtotime( '2024-11-11 00:00:00' ) );
if ( $current_time < $halloween_time ) {
// Promotional notice for Black Friday.
$offer_time = date_i18n( strtotime( '2024-12-07 00:00:00' ) );
if ( $current_time < $offer_time ) {
wc_min_max_quantities()->notices->add(
array(
'message' => __DIR__ . '/views/notices/halloween.php',
'message' => __DIR__ . '/views/notices/black-friday.php',
'notice_id' => 'wcmmq_black_friday_promotion_24',
'class' => 'notice-black-friday',
'style' => 'border-left-color:#2271b1;',
'dismissible' => false,
'notice_id' => 'wcmmq_halloween_promotion',
'style' => 'border-left-color: #8500ff;background-image: url("' . esc_url( wc_min_max_quantities()->get_assets_url( 'images/halloween-banner.svg' ) ) . '");',
'class' => 'notice-halloween',
)
);
}
Expand All @@ -49,7 +49,7 @@ public function admin_notices() {
array(
'message' => __DIR__ . '/views/notices/upgrade.php',
'notice_id' => 'wcmmq_upgrade',
'style' => 'border-left-color: #0542fa;',
'style' => 'border-left-color:#0542fa;',
'dismissible' => false,
)
);
Expand Down
51 changes: 51 additions & 0 deletions includes/Admin/views/notices/black-friday.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?php
/**
* Admin notice: Black Friday offer.
*
* @package WooCommerceMinMaxQuantities
* @since 2.0.3
* @return void
*/

defined( 'ABSPATH' ) || exit; // Exit if accessed directly.

?>
<div class="notice-body">
<div class="notice-icon">
<img src="<?php echo esc_url( wc_min_max_quantities()->get_assets_url( 'images/black-friday-icon.svg' ) ); ?>" alt="WooCommerce Min-Max Quantities Black Friday Offer">
</div>
<div class="notice-content">
<h3>
<?php esc_html_e( 'Black Friday & Cyber Monday: Flat 40% OFF All Premium Plugins!', 'wc-min-max-quantities' ); ?>
</h3>
<p>
<?php
echo wp_kses_post(
sprintf(
// translators: 1.Offer Percentage, 2. Coupon Code.
__( 'Boost your WooCommerce store this Black Friday! Get %1$s on all premium plugins with code %2$s. Don’t miss this limited-time deal!', 'wc-min-max-quantities' ),
'<strong>' . esc_attr( '40% OFF' ) . '</strong>',
'<strong>' . esc_attr( 'FLASH40' ) . '</strong>'
)
);
?>
</p>
</div>
</div>
<div class="notice-footer">
<div class="footer-btn">
<a href="<?php echo esc_url( wc_min_max_quantities()->plugin_uri . '?utm_source=plugin&utm_medium=notice&utm_campaign=black-friday-2024&discount=FLASH40' ); ?>" class="button button-primary black-friday-upgrade-btn" target="_blank">
<span class="dashicons dashicons-cart"></span>
<?php esc_html_e( 'Claim your 40% discount!!', 'wc-min-max-quantities' ); ?>
</a>
<a href="#" data-snooze="<?php echo esc_attr( WEEK_IN_SECONDS ); ?>">
<span class="dashicons dashicons-clock"></span>
<?php esc_html_e( 'Remind me later', 'wc-min-max-quantities' ); ?>
</a>
<a href="#" class="button black-friday-dismiss-btn" data-dismiss>
<span class="dashicons dashicons-dismiss"></span>
<span class="btn-text"><?php esc_html_e( 'DISMISS', 'wc-min-max-quantities' ); ?></span>
</a>
</div>
<span class="black-friday-footer-text"><?php esc_html_e( 'Valid until November 7, 2024', 'wc-min-max-quantities' ); ?></span>
</div>
39 changes: 30 additions & 9 deletions languages/wc-min-max-quantities.pot
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WC Min Max Quantities 2.0.2\n"
"Report-Msgid-Bugs-To: https://pluginever.com/support/\n"
"POT-Creation-Date: 2024-11-24 06:40:43+00:00\n"
"POT-Creation-Date: 2024-11-24 10:21:59+00:00\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
Expand Down Expand Up @@ -223,6 +223,35 @@ msgstr ""
msgid "Documentation"
msgstr ""

#: includes/Admin/views/notices/black-friday.php:19
msgid "Black Friday & Cyber Monday: Flat 40% OFF All Premium Plugins!"
msgstr ""

#: includes/Admin/views/notices/black-friday.php:26
#. translators: 1.Offer Percentage, 2. Coupon Code.
msgid ""
"Boost your WooCommerce store this Black Friday! Get %1$s on all premium "
"plugins with code %2$s. Don’t miss this limited-time deal!"
msgstr ""

#: includes/Admin/views/notices/black-friday.php:39
msgid "Claim your 40% discount!!"
msgstr ""

#: includes/Admin/views/notices/black-friday.php:43
#: includes/Admin/views/notices/halloween.php:43
msgid "Remind me later"
msgstr ""

#: includes/Admin/views/notices/black-friday.php:47
#: includes/Admin/views/notices/halloween.php:51
msgid "DISMISS"
msgstr ""

#: includes/Admin/views/notices/black-friday.php:50
msgid "Valid until November 7, 2024"
msgstr ""

#: includes/Admin/views/notices/halloween.php:19
msgid "Limited Time Offer! PluginEver Halloween Sale: 30% OFF!!"
msgstr ""
Expand All @@ -238,18 +267,10 @@ msgstr ""
msgid "Claim your discount!!"
msgstr ""

#: includes/Admin/views/notices/halloween.php:43
msgid "Remind me later"
msgstr ""

#: includes/Admin/views/notices/halloween.php:47
msgid "Never show this again!"
msgstr ""

#: includes/Admin/views/notices/halloween.php:51
msgid "DISMISS"
msgstr ""

#: includes/Admin/views/notices/halloween.php:54
msgid "Valid until November 10, 2024"
msgstr ""
Expand Down

0 comments on commit ef8a843

Please sign in to comment.