From eb335ba4fea3fef644584db0ba7fc44b557b8b73 Mon Sep 17 00:00:00 2001 From: Vu Van Tu Date: Tue, 9 Feb 2021 14:55:02 +0700 Subject: [PATCH 01/11] fix bug: compatible with newAction on m241 --- Plugin/Controller/Subscriber/NewAction.php | 1 + 1 file changed, 1 insertion(+) diff --git a/Plugin/Controller/Subscriber/NewAction.php b/Plugin/Controller/Subscriber/NewAction.php index 74669d2..749b485 100644 --- a/Plugin/Controller/Subscriber/NewAction.php +++ b/Plugin/Controller/Subscriber/NewAction.php @@ -22,6 +22,7 @@ namespace Mageplaza\BetterPopup\Plugin\Controller\Subscriber; use Exception; +use Magento\Framework\App\ObjectManager; use Magento\Framework\Controller\Result\Json; use Magento\Framework\Controller\Result\JsonFactory; use Magento\Framework\Exception\LocalizedException; From 749f7c03ee8230905efe2fab46bfec1c96c13a52 Mon Sep 17 00:00:00 2001 From: Vu Van Tu Date: Thu, 25 Feb 2021 16:32:38 +0700 Subject: [PATCH 02/11] Fix bug: plugin newAction --- Plugin/Controller/Subscriber/NewAction.php | 57 +++++++++++++++++++--- 1 file changed, 51 insertions(+), 6 deletions(-) diff --git a/Plugin/Controller/Subscriber/NewAction.php b/Plugin/Controller/Subscriber/NewAction.php index 749b485..34f8502 100644 --- a/Plugin/Controller/Subscriber/NewAction.php +++ b/Plugin/Controller/Subscriber/NewAction.php @@ -22,11 +22,18 @@ namespace Mageplaza\BetterPopup\Plugin\Controller\Subscriber; use Exception; +use Magento\Customer\Api\AccountManagementInterface as CustomerAccountManagement; +use Magento\Customer\Model\Session; +use Magento\Customer\Model\Url as CustomerUrl; +use Magento\Framework\App\Action\Context; use Magento\Framework\App\ObjectManager; use Magento\Framework\Controller\Result\Json; use Magento\Framework\Controller\Result\JsonFactory; use Magento\Framework\Exception\LocalizedException; +use Magento\Framework\Validator\EmailAddress as EmailValidator; use Magento\Newsletter\Model\SubscriberFactory; +use Magento\Newsletter\Model\SubscriptionManagerInterface; +use Magento\Store\Model\StoreManagerInterface; use Mageplaza\BetterPopup\Helper\Data; /** @@ -45,6 +52,47 @@ class NewAction extends \Magento\Newsletter\Controller\Subscriber\NewAction */ protected $_helperData; + /** + * NewAction constructor. + * + * @param Context $context + * @param SubscriberFactory $subscriberFactory + * @param Session $customerSession + * @param StoreManagerInterface $storeManager + * @param CustomerUrl $customerUrl + * @param CustomerAccountManagement $customerAccountManagement + * @param SubscriptionManagerInterface $subscriptionManager + * @param JsonFactory $jsonFactory + * @param Data $helperData + * @param EmailValidator|null $emailValidator + */ + public function __construct( + Context $context, + SubscriberFactory $subscriberFactory, + Session $customerSession, + StoreManagerInterface $storeManager, + CustomerUrl $customerUrl, + CustomerAccountManagement $customerAccountManagement, + SubscriptionManagerInterface $subscriptionManager, + JsonFactory $jsonFactory, + Data $helperData, + EmailValidator $emailValidator = null + ) { + $this->resultJsonFactory = $jsonFactory; + $this->_helperData = $helperData; + + parent::__construct( + $context, + $subscriberFactory, + $customerSession, + $storeManager, + $customerUrl, + $customerAccountManagement, + $subscriptionManager, + $emailValidator + ); + } + /** * @param $subject * @param $proceed @@ -53,10 +101,7 @@ class NewAction extends \Magento\Newsletter\Controller\Subscriber\NewAction */ public function aroundExecute($subject, $proceed) { - $resultJsonFactory = ObjectManager::getInstance()->get(JsonFactory::class); - $_helperData = ObjectManager::getInstance()->get(Data::class); - - if (!$_helperData->isEnabled() || !$this->getRequest()->isAjax()) { + if (!$this->_helperData->isEnabled() || !$this->getRequest()->isAjax()) { return $proceed(); } @@ -70,7 +115,7 @@ public function aroundExecute($subject, $proceed) $this->validateEmailAvailable($email); $this->_subscriberFactory->create()->subscribe($email); - if (!$_helperData->versionCompare('2.2.0')) { + if (!$this->_helperData->versionCompare('2.2.0')) { $this->_subscriberFactory->create() ->loadByEmail($email) ->setChangeStatusAt(date('Y-m-d h:i:s'))->save(); @@ -88,6 +133,6 @@ public function aroundExecute($subject, $proceed) } } - return $resultJsonFactory->create()->setData($response); + return $this->resultJsonFactory->create()->setData($response); } } From 30ae75aeac4dcfd35bf4a35a139fff4b9235e006 Mon Sep 17 00:00:00 2001 From: Vu Van Tu Date: Thu, 25 Feb 2021 17:59:04 +0700 Subject: [PATCH 03/11] clean code --- Plugin/Controller/Subscriber/NewAction.php | 83 ++++++++++++++++++---- 1 file changed, 71 insertions(+), 12 deletions(-) diff --git a/Plugin/Controller/Subscriber/NewAction.php b/Plugin/Controller/Subscriber/NewAction.php index 34f8502..2a27ba9 100644 --- a/Plugin/Controller/Subscriber/NewAction.php +++ b/Plugin/Controller/Subscriber/NewAction.php @@ -26,11 +26,12 @@ use Magento\Customer\Model\Session; use Magento\Customer\Model\Url as CustomerUrl; use Magento\Framework\App\Action\Context; -use Magento\Framework\App\ObjectManager; use Magento\Framework\Controller\Result\Json; use Magento\Framework\Controller\Result\JsonFactory; use Magento\Framework\Exception\LocalizedException; +use Magento\Framework\Phrase; use Magento\Framework\Validator\EmailAddress as EmailValidator; +use Magento\Newsletter\Model\Subscriber; use Magento\Newsletter\Model\SubscriberFactory; use Magento\Newsletter\Model\SubscriptionManagerInterface; use Magento\Store\Model\StoreManagerInterface; @@ -52,6 +53,11 @@ class NewAction extends \Magento\Newsletter\Controller\Subscriber\NewAction */ protected $_helperData; + /** + * @var SubscriptionManagerInterface + */ + protected $subscriberManagerInterface; + /** * NewAction constructor. * @@ -78,8 +84,9 @@ public function __construct( Data $helperData, EmailValidator $emailValidator = null ) { - $this->resultJsonFactory = $jsonFactory; - $this->_helperData = $helperData; + $this->resultJsonFactory = $jsonFactory; + $this->_helperData = $helperData; + $this->subscriberManagerInterface = $subscriptionManager; parent::__construct( $context, @@ -114,25 +121,77 @@ public function aroundExecute($subject, $proceed) $this->validateGuestSubscription(); $this->validateEmailAvailable($email); - $this->_subscriberFactory->create()->subscribe($email); - if (!$this->_helperData->versionCompare('2.2.0')) { - $this->_subscriberFactory->create() - ->loadByEmail($email) - ->setChangeStatusAt(date('Y-m-d h:i:s'))->save(); + $websiteId = (int)$this->_storeManager->getStore()->getWebsiteId(); + $subscriber = $this->_subscriberFactory->create()->loadBySubscriberEmail($email, $websiteId); + if ($subscriber->getId() + && (int)$subscriber->getSubscriberStatus() === Subscriber::STATUS_SUBSCRIBED) { + $response = [ + 'success' => false, + 'msg' => __('This email address is already subscribed.') + ]; + + return $this->resultJsonFactory->create()->setData($response); } + $storeId = (int)$this->_storeManager->getStore()->getId(); + $currentCustomerId = $this->getSessionCustomerId($email); + $subscriber = $currentCustomerId + ? $this->subscriberManagerInterface->subscribeCustomer($currentCustomerId, $storeId) + : $this->subscriberManagerInterface->subscribe($email, $storeId); + $message = $this->getSuccessMessage((int)$subscriber->getSubscriberStatus()); + $response = [ + 'success' => true, + 'msg' => $message, + ]; } catch (LocalizedException $e) { $response = [ - 'success' => true, - 'msg' => __('There was a problem with the subscription: %1', $e->getMessage()), + 'success' => false, + 'msg' => __('There was a problem with the subscription: %1', $e->getMessage()), ]; } catch (Exception $e) { $response = [ - 'status' => 'ERROR', - 'msg' => __('Something went wrong with the subscription: %1', $e->getMessage()), + 'status' => false, + 'msg' => __('Something went wrong with the subscription: %1', $e->getMessage()), ]; } } return $this->resultJsonFactory->create()->setData($response); } + + /** + * Get customer id from session if he is owner of the email + * + * @param string $email + * + * @return int|null + */ + private function getSessionCustomerId(string $email): ?int + { + if (!$this->_customerSession->isLoggedIn()) { + return null; + } + + $customer = $this->_customerSession->getCustomerDataObject(); + if ($customer->getEmail() !== $email) { + return null; + } + + return (int)$this->_customerSession->getId(); + } + + /** + * Get success message + * + * @param int $status + * + * @return Phrase + */ + private function getSuccessMessage(int $status): Phrase + { + if ($status === Subscriber::STATUS_NOT_ACTIVE) { + return __('The confirmation request has been sent.'); + } + + return __('Thank you for your subscription.'); + } } From a58038b28212d3c3151a7dc4114128a1b34a6de9 Mon Sep 17 00:00:00 2001 From: Vu Van Tu Date: Thu, 25 Feb 2021 17:59:55 +0700 Subject: [PATCH 04/11] Update Feature: show message error/success --- Block/Popup.php | 1 + etc/adminhtml/system.xml | 493 ++++++++-------- etc/config.xml | 195 +++--- .../popup/template/template3/popup.html | 52 +- .../popup/template/template4/popup.html | 48 +- .../popup/template/template5/popup.html | 48 +- .../popup/template/template6/popup.html | 52 +- view/frontend/web/js/popup.js | 554 +++++++++--------- 8 files changed, 733 insertions(+), 710 deletions(-) diff --git a/Block/Popup.php b/Block/Popup.php index ce9ae42..93a2f61 100644 --- a/Block/Popup.php +++ b/Block/Popup.php @@ -404,6 +404,7 @@ public function getAjaxData() 'bgColor' => $this->getBackGroundColor() ], 'isExitIntent' => $this->isExitIntent(), + 'isShowPopupSuccess' => $this->_helperData->getWhatToShowConfig('popup_success/enabled'), 'isShowFireworks' => $this->isShowFireworks(), 'popupConfig' => [ 'width' => $this->getWidthPopup(), diff --git a/etc/adminhtml/system.xml b/etc/adminhtml/system.xml index 59a9c01..4ed9918 100755 --- a/etc/adminhtml/system.xml +++ b/etc/adminhtml/system.xml @@ -1,244 +1,249 @@ - - - - -
- - mageplaza - Mageplaza_BetterPopup::configuration - - - - - Magento\Config\Model\Config\Source\Yesno - Select Yes to enable this module - - - - - - - Load HTML - Mageplaza\BetterPopup\Block\Adminhtml\System\Config\Template - Select a template, then click to Load HTML. - - - - HTML content - - - - Mageplaza\BetterPopup\Model\Config\Source\Responsive - - - - validate-digits - In pixel - - 1 - - - - - validate-digits - In pixel - - 1 - - - - - jscolor {hash:true,refine:false} - - - - jscolor {hash:true,refine:false} - - - - - - Magento\Config\Model\Config\Source\Yesno - - - - Mageplaza\BetterPopup\Model\Config\Source\CartRules - Go to Marketing > Cart Price Rules to generate a rule.
- The rule should be set as a Specific Coupon and Auto-generated.
- Learn more - ]]> -
- - 1 - -
- - - A coupon code pattern follows this rule:
- [4A] - 4 alpha characters
- [4N] - 4 numeric characters
- [4AN] - 4 alphanumeric characters
- Eg: GIFT-[4AN]-[3A]-[5N]
=> GIFT-J34T-OEC-54354
- ]]> -
- - 1 - -
- - - HTML content. Use {{coupon_code}} variable to add coupon code - - - - Magento\Config\Model\Config\Source\Yesno - -
-
- - - - - Mageplaza\BetterPopup\Model\Config\Source\PageToShow - - - - Mageplaza\BetterPopup\Model\Config\Backend\Validate - Example: cms_index_index (for homepage)
- Separated by a new line - ]]> -
- - 1 - -
- - - Separated by a new line - - 1 - - - - - Example: cms_index_index (for homepage)
- Separated by a new line - ]]> -
-
- - - Separated by a new line - - - - Mageplaza\BetterPopup\Block\Adminhtml\System\FeatureDisplay - - 3 - - -
- - - - - Mageplaza\BetterPopup\Model\Config\Source\Appear - - - - validate-digits - Percentage - - 4 - - - - - validate-digits - - 3 - - - - - validate-digits - days. Leave empty to redisplay the popup after 30 days - - - - Magento\Config\Model\Config\Source\Yesno - Click trigger to open - - - - Mageplaza\BetterPopup\Model\Config\Source\ButtonDirection - - 1 - - - - - Default: Subscribe - - 1 - - - - - - - - Magento\Config\Model\Config\Source\Yesno - - Mageplaza_SMTP to avoid sending to spam box.]]> - - - - - - - Automatically send email notifications to store owners every Saturday - ]]> - - - 1 - - - - - Send Now - adminhtml/send/send - Mageplaza\BetterPopup\Block\Adminhtml\System\Config\Button - - 1 - - - -
-
-
+ + + + +
+ + mageplaza + Mageplaza_BetterPopup::configuration + + + + + Magento\Config\Model\Config\Source\Yesno + Select Yes to enable this module + + + + + + + Load HTML + Mageplaza\BetterPopup\Block\Adminhtml\System\Config\Template + Select a template, then click to Load HTML. + + + + HTML content + + + + Mageplaza\BetterPopup\Model\Config\Source\Responsive + + + + validate-digits + In pixel + + 1 + + + + + validate-digits + In pixel + + 1 + + + + + jscolor {hash:true,refine:false} + + + + jscolor {hash:true,refine:false} + + + + + + Magento\Config\Model\Config\Source\Yesno + Select Yes to enable popup success + + + + Magento\Config\Model\Config\Source\Yesno + + + + Mageplaza\BetterPopup\Model\Config\Source\CartRules + Go to Marketing > Cart Price Rules to generate a rule.
+ The rule should be set as a Specific Coupon and Auto-generated.
+ Learn more + ]]> +
+ + 1 + +
+ + + A coupon code pattern follows this rule:
+ [4A] - 4 alpha characters
+ [4N] - 4 numeric characters
+ [4AN] - 4 alphanumeric characters
+ Eg: GIFT-[4AN]-[3A]-[5N]
=> GIFT-J34T-OEC-54354
+ ]]> +
+ + 1 + +
+ + + HTML content. Use {{coupon_code}} variable to add coupon code + + + + Magento\Config\Model\Config\Source\Yesno + +
+
+ + + + + Mageplaza\BetterPopup\Model\Config\Source\PageToShow + + + + Mageplaza\BetterPopup\Model\Config\Backend\Validate + Example: cms_index_index (for homepage)
+ Separated by a new line + ]]> +
+ + 1 + +
+ + + Separated by a new line + + 1 + + + + + Example: cms_index_index (for homepage)
+ Separated by a new line + ]]> +
+
+ + + Separated by a new line + + + + Mageplaza\BetterPopup\Block\Adminhtml\System\FeatureDisplay + + 3 + + +
+ + + + + Mageplaza\BetterPopup\Model\Config\Source\Appear + + + + validate-digits + Percentage + + 4 + + + + + validate-digits + + 3 + + + + + validate-digits + days. Leave empty to redisplay the popup after 30 days + + + + Magento\Config\Model\Config\Source\Yesno + Click trigger to open + + + + Mageplaza\BetterPopup\Model\Config\Source\ButtonDirection + + 1 + + + + + Default: Subscribe + + 1 + + + + + + + + Magento\Config\Model\Config\Source\Yesno + + Mageplaza_SMTP to avoid sending to spam box.]]> + + + + + + + Automatically send email notifications to store owners every Saturday + ]]> + + + 1 + + + + + Send Now + adminhtml/send/send + Mageplaza\BetterPopup\Block\Adminhtml\System\Config\Button + + 1 + + + +
+
+
diff --git a/etc/config.xml b/etc/config.xml index 1c52758..95477ba 100644 --- a/etc/config.xml +++ b/etc/config.xml @@ -1,97 +1,98 @@ - - - - - - - 1 - - - 1 - - - - - -
- -
-
-
Subscribe
-
TO OUR NEWSLETTER
-
Subsribe to our email newsletter today to receive update on the latest news, tutorials and special offers!
- -
- - ]]> -
- 1 - 800 - 321 - #3d9bc7 - #FFFFFF - - 0 - - Thank you, you got the offer!

-
- - -
- Please use this coupon code when checking out - ]]> -
- 0 - [12AN] -
-
- - 2 - - - 1 - 50 - 5 - 0 - 0 - Subscribe - -
-
-
+ + + + + + + 1 + + + 1 + + + + + +
+ +
+
+
Subscribe
+
TO OUR NEWSLETTER
+
Subsribe to our email newsletter today to receive update on the latest news, tutorials and special offers!
+ +
+ + ]]> +
+ 1 + 800 + 321 + #3d9bc7 + #FFFFFF + + 1 + 0 + + Thank you, you got the offer!

+
+ + +
+ Please use this coupon code when checking out + ]]> +
+ 0 + [12AN] +
+
+ + 2 + + + 1 + 50 + 5 + 0 + 0 + Subscribe + +
+
+
diff --git a/view/frontend/templates/popup/template/template3/popup.html b/view/frontend/templates/popup/template/template3/popup.html index 2704d84..529434c 100644 --- a/view/frontend/templates/popup/template/template3/popup.html +++ b/view/frontend/templates/popup/template/template3/popup.html @@ -1,25 +1,27 @@ -
-
- -
-
-
Subscribe
-
TO OUR NEWSLETTER
-
Subsribe to our email newsletter today to receive update on the latest news, tutorials and special offers!
- -
-
+
+
+ +
+
+
Subscribe
+
TO OUR NEWSLETTER
+
Subsribe to our email newsletter today to receive update on the latest news, tutorials and special offers!
+ +
+
diff --git a/view/frontend/templates/popup/template/template4/popup.html b/view/frontend/templates/popup/template/template4/popup.html index 8f6e2dc..85dc337 100644 --- a/view/frontend/templates/popup/template/template4/popup.html +++ b/view/frontend/templates/popup/template/template4/popup.html @@ -1,23 +1,25 @@ -
-
-
Subscribe
-
TO OUR NEWSLETTER
-
Subsribe to our email newsletter today to receive update on the latest news, tutorials and special offers!
-
- -
- -
-
+
+
+
Subscribe
+
TO OUR NEWSLETTER
+
Subsribe to our email newsletter today to receive update on the latest news, tutorials and special offers!
+
+ +
+ +
+
diff --git a/view/frontend/templates/popup/template/template5/popup.html b/view/frontend/templates/popup/template/template5/popup.html index 261de84..50cf33e 100644 --- a/view/frontend/templates/popup/template/template5/popup.html +++ b/view/frontend/templates/popup/template/template5/popup.html @@ -1,23 +1,25 @@ -
- - -
-
Subscribe
-
TO OUR NEWSLETTER
-
Subsribe to our email newsletter today to receive update on the latest news, tutorials and special offers!
-
- -
-
+
+ + +
+
Subscribe
+
TO OUR NEWSLETTER
+
Subsribe to our email newsletter today to receive update on the latest news, tutorials and special offers!
+
+ +
+
diff --git a/view/frontend/templates/popup/template/template6/popup.html b/view/frontend/templates/popup/template/template6/popup.html index ed5c5d1..87a0811 100644 --- a/view/frontend/templates/popup/template/template6/popup.html +++ b/view/frontend/templates/popup/template/template6/popup.html @@ -1,25 +1,27 @@ -
-
-
    -
  • SUBSCRIBE
  • -
  • TO OUR
  • -
  • NEWSLETTER
  • -
-
-
-
Subsribe to our email newsletter today to receive update on the latest news, tutorials and special offers!
- -
-
\ No newline at end of file +
+
+
    +
  • SUBSCRIBE
  • +
  • TO OUR
  • +
  • NEWSLETTER
  • +
+
+
+
Subsribe to our email newsletter today to receive update on the latest news, tutorials and special offers!
+ +
+
diff --git a/view/frontend/web/js/popup.js b/view/frontend/web/js/popup.js index c2c9d0b..3ea570e 100755 --- a/view/frontend/web/js/popup.js +++ b/view/frontend/web/js/popup.js @@ -1,273 +1,281 @@ -/** - * Mageplaza - * - * NOTICE OF LICENSE - * - * This source file is subject to the Mageplaza.com license that is - * available through the world-wide-web at this URL: - * https://www.mageplaza.com/LICENSE.txt - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade this extension to newer - * version in the future. - * - * @category Mageplaza - * @package Mageplaza_BetterPopup - * @copyright Copyright (c) Mageplaza (https://www.mageplaza.com/) - * @license https://www.mageplaza.com/LICENSE.txt - */ - -define([ - 'jquery', - 'fireworks', - 'bioEp', - 'jquery-ui-modules/widget' -], function ($, firework) { - 'use strict'; - - $.widget('mageplaza.betterpopup_block', { - options: { - dataPopup: {} - }, - - _create: function () { - this._showPopup(); - this._clickTrigger(); - this._clickClose(); - this._clickSuccess(); - if (this._checkUpdateTemplate()) { - if ($('#mp-popup-template5').length) { - $('#bio_ep_close').css({'top': '-100px'}); - $('#bio_ep_close img').attr('src', this.options.dataPopup.srcCloseIconWhite); - } - } - - }, - - _showPopup: function () { - var self = this, - popupElem = $('.mageplaza-betterpopup-block').length, - triggerElem = $('.mp-better-popup-click-trigger'); - this._createStyleTag(); - this._removeDuplicatePopup(); - - //Check show trigger - if (this.options.dataPopup.afterSeconds.isAfterSeconds) { - setTimeout(function () { - triggerElem.show(); - self._setDefaultSize(); - }, this.options.dataPopup.afterSeconds.delay * 1000); - } else { - triggerElem.show(); - self._setDefaultSize(); - } - - if (popupElem <= 1) { - if (this.options.dataPopup.isScroll) { // show when scroll - self._scrollToShow(); - self._setDefaultSize(); - } else if (this.options.dataPopup.isExitIntent) { //show when Exit Intent - $(document).mouseleave(function () { - bioEp.init(self.options.dataPopup.popupConfig); - self._fullScreen(); - $(document).off('mouseleave'); - self._setDefaultSize(); - }); - } else { - bioEp.init(self.options.dataPopup.popupConfig); - - if (this.options.dataPopup.fullScreen.isFullScreen) { - self._setDefaultSize(); - } - self._fullScreen(); - } - - } - }, - - /** - * Event click float button to show popup - * @private - */ - _clickTrigger: function () { - var self = this; - - $('.mp-better-popup-click-trigger').click(function () { - var bgEl = $('#bio_ep_bg'); - if (!bgEl.length) { - $('body').append("
"); - self._fullScreen(); - } - - bioEp.init(self.options.dataPopup.popupConfig); - self._scrollToShow(); - $('#bio_ep').show(); - $('#bio_ep_bg').show(); - $('#bio_ep_close').show(); - $('#mp-newsletter-error').hide(); - $('#mp-newsletter').css('border-color', '#c2c2c2'); - $('[id]').each(function () { - $('[id="bio_ep_bg"]:gt(0)').remove(); - }); - }); - }, - - /** - * Event click close popup button - * @private - */ - _clickClose: function () { - $('#bio_ep_close').click(function () { - $('#bio_ep').hide(); - $('#bio_ep_bg').hide(); - $('.btn-copy').text('Copy'); - $('canvas#screen').hide(); - }) - }, - - /** - * Event click success button - * @private - */ - _clickSuccess: function () { - var self = this, - bioContent = $('#bio_ep_content'), - template4 = $('#mp-popup-template4').length, // check on template 4 - template5 = $('#mp-popup-template5').length, // check on template 5 - form = $('#mp-newsletter-validate-detail'); - - - form.submit(function (e) { - if (form.validation('isValid')) { - var email = $("#mp-newsletter").val(); - var url = form.attr('action'); - - $('.popup-loader').show(); - if (template4) { - $('.popup-loader').css({'left': '200px'}); - } - e.preventDefault(); - $.ajax({ - url: url, - dataType: 'json', - type: 'POST', - data: {email: email}, - success: function (data) { - $.ajax({ - url: self.options.dataPopup.url, - dataType: 'json', - cache: false, - success: function (result) { - bioContent.empty; - bioContent.html(result.success); - bioContent.trigger('contentUpdated'); - if (self.options.dataPopup.isShowFireworks === '1') { - $('canvas#screen').show(); - firework(this); - } - if (template4 || template5) { - $('#bio_ep_content').css('color', '#3d3d3e'); - $('#mp-coupon-code').css('color', '#3d3d3e'); - } - if (template5) { - $('#bio_ep_close').css({'top': '0px'}); - } - } - }); - } - }); - } - - //css for error message - if (!self._checkUpdateTemplate()) { - $('#mp-newsletter-error').css({"position": "absolute", "width": "100%"}); - } - - if (template4) { - $('#mp-newsletter-error').css({"position": "absolute", "bottom": "25px", "left": "35px"}); - } - - if (template5) { - $('.tmp5-msg-error').html(''); - $("#mp-newsletter-error").appendTo(".tmp5-msg-error"); - } - }); - }, - - /** - * Scroll to show popup - * @private - */ - _scrollToShow: function () { - var self = this; - - $(window).scroll(function () { - var scrollTop = $(window).scrollTop(), - docHeight = $(document).height(), - winHeight = $(window).height(), - scrollPercent = (scrollTop) / (docHeight - winHeight), - optionScroll = self.options.dataPopup.percentage / 100; - - if ((scrollPercent >= optionScroll) || (scrollPercent > 0.9)) { - bioEp.init(self.options.dataPopup.popupConfig); - self._fullScreen(); - $(window).off('scroll'); - } - }); - }, - - /** - * Css for full creen option - * @private - */ - _fullScreen: function () { - if (this.options.dataPopup.fullScreen.isFullScreen) { - $('#bio_ep_bg').css({'background-color': this.options.dataPopup.fullScreen.bgColor, 'opacity': 1}); - } - }, - - /** - * Remove duplicate popup - * @private - */ - _removeDuplicatePopup: function () { - $('[id]').each(function () { - $('[id="mageplaza-betterpopup-block"]:gt(0)').remove(); - }); - }, - - /** - * Create Style tag on head - * @private - */ - _createStyleTag: function () { - var head = document.head, - style = document.createElement('style'); - - style.type = 'text/css'; - head.appendChild(style); - }, - - _checkUpdateTemplate: function () { - return !!($('#mp-popup-template3').length || $('#mp-popup-template4').length || $('#mp-popup-template5').length || $('#mp-popup-template6').length); - }, - - _setDefaultSize: function() { - if (this.options.dataPopup.popupConfig.width === null - || this.options.dataPopup.popupConfig.height === null) { - if ($('#mp-popup-template3').length) { - $('#bio_ep').css({"width": "800px", "height": "321px"}); - } else if ($('#mp-popup-template4').length) { - $('#bio_ep').css({"width": "605px", "height": "330px"}); - } else if ($('#mp-popup-template5').length) { - $('#bio_ep').css({"width": "359px", "height": "260px"}); - } else if ($('#mp-popup-template6').length) { - $('#bio_ep').css({"width": "800px", "height": "250px"}); - } - } - } - }); - - return $.mageplaza.betterpopup_block; -}); +/** + * Mageplaza + * + * NOTICE OF LICENSE + * + * This source file is subject to the Mageplaza.com license that is + * available through the world-wide-web at this URL: + * https://www.mageplaza.com/LICENSE.txt + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade this extension to newer + * version in the future. + * + * @category Mageplaza + * @package Mageplaza_BetterPopup + * @copyright Copyright (c) Mageplaza (https://www.mageplaza.com/) + * @license https://www.mageplaza.com/LICENSE.txt + */ + +define([ + 'jquery', + 'fireworks', + 'bioEp', + 'jquery-ui-modules/widget' +], function ($, firework) { + 'use strict'; + + $.widget('mageplaza.betterpopup_block', { + options: { + dataPopup: {} + }, + + _create: function () { + this._showPopup(); + this._clickTrigger(); + this._clickClose(); + this._clickSuccess(); + if (this._checkUpdateTemplate()) { + if ($('#mp-popup-template5').length) { + $('#bio_ep_close').css({'top': '-100px'}); + $('#bio_ep_close img').attr('src', this.options.dataPopup.srcCloseIconWhite); + } + } + + }, + + _showPopup: function () { + var self = this, + popupElem = $('.mageplaza-betterpopup-block').length, + triggerElem = $('.mp-better-popup-click-trigger'); + this._createStyleTag(); + this._removeDuplicatePopup(); + + //Check show trigger + if (this.options.dataPopup.afterSeconds.isAfterSeconds) { + setTimeout(function () { + triggerElem.show(); + self._setDefaultSize(); + }, this.options.dataPopup.afterSeconds.delay * 1000); + } else { + triggerElem.show(); + self._setDefaultSize(); + } + + if (popupElem <= 1) { + if (this.options.dataPopup.isScroll) { // show when scroll + self._scrollToShow(); + self._setDefaultSize(); + } else if (this.options.dataPopup.isExitIntent) { //show when Exit Intent + $(document).mouseleave(function () { + bioEp.init(self.options.dataPopup.popupConfig); + self._fullScreen(); + $(document).off('mouseleave'); + self._setDefaultSize(); + }); + } else { + bioEp.init(self.options.dataPopup.popupConfig); + + if (this.options.dataPopup.fullScreen.isFullScreen) { + self._setDefaultSize(); + } + self._fullScreen(); + } + + } + }, + + /** + * Event click float button to show popup + * @private + */ + _clickTrigger: function () { + var self = this; + + $('.mp-better-popup-click-trigger').click(function () { + var bgEl = $('#bio_ep_bg'); + if (!bgEl.length) { + $('body').append("
"); + self._fullScreen(); + } + + bioEp.init(self.options.dataPopup.popupConfig); + self._scrollToShow(); + $('#bio_ep').show(); + $('#bio_ep_bg').show(); + $('#bio_ep_close').show(); + $('#mp-newsletter-error').hide(); + $('#mp-newsletter').css('border-color', '#c2c2c2'); + $('[id]').each(function () { + $('[id="bio_ep_bg"]:gt(0)').remove(); + }); + }); + }, + + /** + * Event click close popup button + * @private + */ + _clickClose: function () { + $('#bio_ep_close').click(function () { + $('#bio_ep').hide(); + $('#bio_ep_bg').hide(); + $('.btn-copy').text('Copy'); + $('canvas#screen').hide(); + }) + }, + + /** + * Event click success button + * @private + */ + _clickSuccess: function () { + var self = this, + bioContent = $('#bio_ep_content'), + template4 = $('#mp-popup-template4').length, // check on template 4 + template5 = $('#mp-popup-template5').length, // check on template 5 + form = $('#mp-newsletter-validate-detail'); + + + form.submit(function (e) { + if (form.validation('isValid')) { + var email = $("#mp-newsletter").val(), + url = form.attr('action'), + loader = $('.popup-loader'); + + loader.show(); + if (template4) { + $('.popup-loader').css({'left': '200px'}); + } + e.preventDefault(); + $.ajax({ + url: url, + dataType: 'json', + type: 'POST', + data: {email: email}, + success: function (data) { + if (!data.success) { + loader.hide(); + $('#mp-newsletter-error').text(data.msg).show(); + } else if (!self.options.isShowPopupSuccess) { + $('#mp-newsletter-success').text(data.msg).show(); + } else { + $.ajax({ + url: self.options.dataPopup.url, + dataType: 'json', + cache: false, + success: function (result) { + bioContent.empty; + bioContent.html(result.success); + bioContent.trigger('contentUpdated'); + if (self.options.dataPopup.isShowFireworks === '1') { + $('canvas#screen').show(); + firework(this); + } + if (template4 || template5) { + $('#bio_ep_content').css('color', '#3d3d3e'); + $('#mp-coupon-code').css('color', '#3d3d3e'); + } + if (template5) { + $('#bio_ep_close').css({'top': '0px'}); + } + } + }); + } + } + }); + } + + //css for error message + if (!self._checkUpdateTemplate()) { + $('#mp-newsletter-error').css({"position": "absolute", "width": "100%"}); + } + + if (template4) { + $('#mp-newsletter-error').css({"position": "absolute", "bottom": "25px", "left": "35px"}); + } + + if (template5) { + $('.tmp5-msg-error').html(''); + $("#mp-newsletter-error").appendTo(".tmp5-msg-error"); + } + }); + }, + + /** + * Scroll to show popup + * @private + */ + _scrollToShow: function () { + var self = this; + + $(window).scroll(function () { + var scrollTop = $(window).scrollTop(), + docHeight = $(document).height(), + winHeight = $(window).height(), + scrollPercent = (scrollTop) / (docHeight - winHeight), + optionScroll = self.options.dataPopup.percentage / 100; + + if ((scrollPercent >= optionScroll) || (scrollPercent > 0.9)) { + bioEp.init(self.options.dataPopup.popupConfig); + self._fullScreen(); + $(window).off('scroll'); + } + }); + }, + + /** + * Css for full creen option + * @private + */ + _fullScreen: function () { + if (this.options.dataPopup.fullScreen.isFullScreen) { + $('#bio_ep_bg').css({'background-color': this.options.dataPopup.fullScreen.bgColor, 'opacity': 1}); + } + }, + + /** + * Remove duplicate popup + * @private + */ + _removeDuplicatePopup: function () { + $('[id]').each(function () { + $('[id="mageplaza-betterpopup-block"]:gt(0)').remove(); + }); + }, + + /** + * Create Style tag on head + * @private + */ + _createStyleTag: function () { + var head = document.head, + style = document.createElement('style'); + + style.type = 'text/css'; + head.appendChild(style); + }, + + _checkUpdateTemplate: function () { + return !!($('#mp-popup-template3').length || $('#mp-popup-template4').length || $('#mp-popup-template5').length || $('#mp-popup-template6').length); + }, + + _setDefaultSize: function() { + if (this.options.dataPopup.popupConfig.width === null + || this.options.dataPopup.popupConfig.height === null) { + if ($('#mp-popup-template3').length) { + $('#bio_ep').css({"width": "800px", "height": "321px"}); + } else if ($('#mp-popup-template4').length) { + $('#bio_ep').css({"width": "605px", "height": "330px"}); + } else if ($('#mp-popup-template5').length) { + $('#bio_ep').css({"width": "359px", "height": "260px"}); + } else if ($('#mp-popup-template6').length) { + $('#bio_ep').css({"width": "800px", "height": "250px"}); + } + } + } + }); + + return $.mageplaza.betterpopup_block; +}); From 3a274e0f0a3842398807dc56bf506a34879a8ff6 Mon Sep 17 00:00:00 2001 From: Vu Van Tu Date: Fri, 26 Feb 2021 10:39:21 +0700 Subject: [PATCH 05/11] fix bug: show message success --- view/frontend/web/js/popup.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/view/frontend/web/js/popup.js b/view/frontend/web/js/popup.js index 3ea570e..0f36529 100755 --- a/view/frontend/web/js/popup.js +++ b/view/frontend/web/js/popup.js @@ -158,7 +158,7 @@ define([ if (!data.success) { loader.hide(); $('#mp-newsletter-error').text(data.msg).show(); - } else if (!self.options.isShowPopupSuccess) { + } else if (self.options.dataPopup.isShowPopupSuccess !== '1') { $('#mp-newsletter-success').text(data.msg).show(); } else { $.ajax({ From af3cfddea563e6ab68eb4b8fd4716739afeb9408 Mon Sep 17 00:00:00 2001 From: Vu Van Tu Date: Fri, 26 Feb 2021 10:58:44 +0700 Subject: [PATCH 06/11] add message to default template --- etc/config.xml | 2 ++ view/frontend/web/js/popup.js | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/etc/config.xml b/etc/config.xml index 95477ba..ad22f36 100644 --- a/etc/config.xml +++ b/etc/config.xml @@ -52,6 +52,8 @@ + + diff --git a/view/frontend/web/js/popup.js b/view/frontend/web/js/popup.js index 0f36529..7e737f0 100755 --- a/view/frontend/web/js/popup.js +++ b/view/frontend/web/js/popup.js @@ -155,8 +155,8 @@ define([ type: 'POST', data: {email: email}, success: function (data) { + loader.hide(); if (!data.success) { - loader.hide(); $('#mp-newsletter-error').text(data.msg).show(); } else if (self.options.dataPopup.isShowPopupSuccess !== '1') { $('#mp-newsletter-success').text(data.msg).show(); From ada9b7d8feb71ba417cf9f4398e1dc52d58723cf Mon Sep 17 00:00:00 2001 From: Duong Huy Toan Date: Tue, 30 Mar 2021 11:02:14 +0700 Subject: [PATCH 07/11] =?UTF-8?q?L=E1=BB=97i=20hi=E1=BB=83n=20th=E1=BB=8B?= =?UTF-8?q?=20tr=C3=AAn=20trang=20better=20maintenance.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Block/Popup.php | 332 ++++++++++++---------- Helper/Data.php | 73 +++-- view/frontend/templates/popup/popup.phtml | 2 +- 3 files changed, 222 insertions(+), 185 deletions(-) diff --git a/Block/Popup.php b/Block/Popup.php index 93a2f61..9260c66 100644 --- a/Block/Popup.php +++ b/Block/Popup.php @@ -24,6 +24,7 @@ use Magento\Catalog\Block\Product\AbstractProduct; use Magento\Catalog\Block\Product\Context; use Magento\Framework\Phrase; +use Magento\Framework\Stdlib\DateTime\TimezoneInterface; use Magento\Newsletter\Model\ResourceModel\Subscriber\CollectionFactory; use Magento\Widget\Block\BlockInterface; use Mageplaza\BetterPopup\Helper\Data as HelperData; @@ -42,6 +43,11 @@ class Popup extends AbstractProduct implements BlockInterface */ protected $_helperData; + /** + * @var TimezoneInterface + */ + protected $_localeDate; + /** * @var CollectionFactory */ @@ -49,54 +55,27 @@ class Popup extends AbstractProduct implements BlockInterface /** * Popup constructor. - * * @param Context $context * @param HelperData $helperData + * @param TimezoneInterface $localeDate * @param CollectionFactory $subscriberCollectionFactory * @param array $data */ public function __construct( Context $context, HelperData $helperData, + TimezoneInterface $localeDate, CollectionFactory $subscriberCollectionFactory, array $data = [] - ) { + ) + { $this->_helperData = $helperData; + $this->_localeDate = $localeDate; $this->_subscriberCollectionFactory = $subscriberCollectionFactory; parent::__construct($context, $data); } - /** - * Get Width Popup Config - * - * @return array|mixed - */ - public function getWidthPopup() - { - return $this->_helperData->getWhatToShowConfig('width'); - } - - /** - * Get Height Popup Config - * - * @return array|mixed - */ - public function getHeightPopup() - { - return $this->_helperData->getWhatToShowConfig('height'); - } - - /** - * Get Background Color Popup - * - * @return array|mixed - */ - public function getBackGroundColor() - { - return $this->_helperData->getWhatToShowConfig('background_color'); - } - /** * Get Text Color in Popup * @@ -107,26 +86,6 @@ public function getTextColor() return $this->_helperData->getWhatToShowConfig('text_color'); } - /** - * Check FullScreen option - * - * @return bool - */ - public function isFullScreen() - { - return (int)$this->_helperData->getWhatToShowConfig('responsive') === Responsive::FULLSCREEN_POPUP; - } - - /** - * Check show fireworks config - * - * @return bool - */ - public function isShowFireworks() - { - return $this->_helperData->getWhatToShowConfig('popup_success/enabled_fireworks'); - } - /** * Is Enable Show Float Button * @@ -159,62 +118,6 @@ public function getFloatLabel() return $label ?: __('Subscribe'); } - /** - * Get Config Popup Appear - * - * @return array|mixed - */ - public function getPopupAppear() - { - return (int)$this->_helperData->getWhenToShowConfig('popup_appear'); - } - - /** - * Get time delay to show popup - * - * @return array|int|mixed - */ - public function getDelayConfig() - { - if ($this->getPopupAppear() === Appear::AFTER_X_SECONDS) { - return $this->_helperData->getWhenToShowConfig('delay'); - } - - return 0; - } - - /** - * is Exit Intent Config - * - * @return string - */ - public function isExitIntent() - { - return $this->getPopupAppear() === Appear::EXIT_INTENT; - } - - /** - * Get Popup show again after (days) - * - * @return array|mixed - */ - public function getCookieConfig() - { - $cookieDays = $this->_helperData->getWhenToShowConfig('cookieExp'); - - return ($cookieDays !== null) ? $cookieDays : 30; - } - - /** - * Get Percentage scroll down to show Popup - * - * @return array|mixed - */ - public function getPercentageScroll() - { - return $this->_helperData->getWhenToShowConfig('after_scroll'); - } - /** * Get Html Content popup * @@ -255,40 +158,50 @@ public function getPopupContent() } /** - * Check include pages are show Popup + * Get Url NewAction Newsletter * + * @return string + */ + public function getFormActionUrl() + { + return $this->getUrl('newsletter/subscriber/new', ['_secure' => true]); + } + + /** * @return bool */ - public function checkIncludePages() + public function checkBetterMaintenance() { - $fullActionName = $this->getRequest()->getFullActionName(); - $arrayPages = explode("\n", $this->_helperData->getWhereToShowConfig('include_pages')); - $includePages = array_map('trim', $arrayPages); + if ($this->_helperData->getBetterMaintenanceConfigGeneral('enabled') === '1') { + if (strtotime($this->_localeDate->date()->format('m/d/Y H:i:s')) + < strtotime($this->_helperData->getBetterMaintenanceConfigGeneral('end_time'))) { + return false; + } + } - return in_array($fullActionName, $includePages, true); + return true; } /** - * Check include paths to show popup + * check Manually Insert Config * * @return bool */ - public function checkIncludePaths() + public function isManuallyInsert() { - $currentPath = $this->getRequest()->getRequestUri(); - $pathsConfig = $this->_helperData->getWhereToShowConfig('include_pages_with_url'); - - if ($pathsConfig) { - $arrayPaths = explode("\n", $pathsConfig); - $pathsUrl = array_map('trim', $arrayPaths); - foreach ($pathsUrl as $path) { - if ($path && strpos($currentPath, $path) !== false) { - return true; - } - } - } + return $this->_helperData->isEnabled() + && (int)$this->_helperData->getWhereToShowConfig('which_page_to_show') === PageToShow::MANUALLY_INSERT + && $this->checkExclude(); + } - return false; + /** + * Check Exclude (page & path) + * + * @return bool + */ + public function checkExclude() + { + return ($this->checkExcludePages() && $this->checkExcludePaths()); } /** @@ -330,54 +243,69 @@ public function checkExcludePaths() } /** - * Check Include (page & path) + * Check Pages to show popup * * @return bool */ - public function checkInclude() + public function checkPagesToShow() { - return ($this->checkIncludePages() || $this->checkIncludePaths()); + if ($this->_helperData->isEnabled()) { + $config = $this->_helperData->getWhereToShowConfig('which_page_to_show'); + + switch ($config) { + case PageToShow::SPECIFIC_PAGES: + return ($this->checkInclude() && $this->checkExclude()); + case PageToShow::ALL_PAGES: + return $this->checkExclude(); + case PageToShow::MANUALLY_INSERT: + return false; + } + } + + return false; } /** - * Check Exclude (page & path) + * Check Include (page & path) * * @return bool */ - public function checkExclude() + public function checkInclude() { - return ($this->checkExcludePages() && $this->checkExcludePaths()); + return ($this->checkIncludePages() || $this->checkIncludePaths()); } /** - * check Manually Insert Config + * Check include pages are show Popup * * @return bool */ - public function isManuallyInsert() + public function checkIncludePages() { - return $this->_helperData->isEnabled() - && (int)$this->_helperData->getWhereToShowConfig('which_page_to_show') === PageToShow::MANUALLY_INSERT - && $this->checkExclude(); + $fullActionName = $this->getRequest()->getFullActionName(); + $arrayPages = explode("\n", $this->_helperData->getWhereToShowConfig('include_pages')); + $includePages = array_map('trim', $arrayPages); + + return in_array($fullActionName, $includePages, true); } /** - * Check Pages to show popup + * Check include paths to show popup * * @return bool */ - public function checkPagesToShow() + public function checkIncludePaths() { - if ($this->_helperData->isEnabled()) { - $config = $this->_helperData->getWhereToShowConfig('which_page_to_show'); + $currentPath = $this->getRequest()->getRequestUri(); + $pathsConfig = $this->_helperData->getWhereToShowConfig('include_pages_with_url'); - switch ($config) { - case PageToShow::SPECIFIC_PAGES: - return ($this->checkInclude() && $this->checkExclude()); - case PageToShow::ALL_PAGES: - return $this->checkExclude(); - case PageToShow::MANUALLY_INSERT: - return false; + if ($pathsConfig) { + $arrayPaths = explode("\n", $pathsConfig); + $pathsUrl = array_map('trim', $arrayPaths); + foreach ($pathsUrl as $path) { + if ($path && strpos($currentPath, $path) !== false) { + return true; + } } } @@ -420,12 +348,108 @@ public function getAjaxData() } /** - * Get Url NewAction Newsletter + * Get Config Popup Appear + * + * @return array|mixed + */ + public function getPopupAppear() + { + return (int)$this->_helperData->getWhenToShowConfig('popup_appear'); + } + + /** + * Get time delay to show popup + * + * @return array|int|mixed + */ + public function getDelayConfig() + { + if ($this->getPopupAppear() === Appear::AFTER_X_SECONDS) { + return $this->_helperData->getWhenToShowConfig('delay'); + } + + return 0; + } + + /** + * Get Percentage scroll down to show Popup + * + * @return array|mixed + */ + public function getPercentageScroll() + { + return $this->_helperData->getWhenToShowConfig('after_scroll'); + } + + /** + * Check FullScreen option + * + * @return bool + */ + public function isFullScreen() + { + return (int)$this->_helperData->getWhatToShowConfig('responsive') === Responsive::FULLSCREEN_POPUP; + } + + /** + * Get Background Color Popup + * + * @return array|mixed + */ + public function getBackGroundColor() + { + return $this->_helperData->getWhatToShowConfig('background_color'); + } + + /** + * is Exit Intent Config * * @return string */ - public function getFormActionUrl() + public function isExitIntent() { - return $this->getUrl('newsletter/subscriber/new', ['_secure' => true]); + return $this->getPopupAppear() === Appear::EXIT_INTENT; + } + + /** + * Check show fireworks config + * + * @return bool + */ + public function isShowFireworks() + { + return $this->_helperData->getWhatToShowConfig('popup_success/enabled_fireworks'); + } + + /** + * Get Width Popup Config + * + * @return array|mixed + */ + public function getWidthPopup() + { + return $this->_helperData->getWhatToShowConfig('width'); + } + + /** + * Get Height Popup Config + * + * @return array|mixed + */ + public function getHeightPopup() + { + return $this->_helperData->getWhatToShowConfig('height'); + } + + /** + * Get Popup show again after (days) + * + * @return array|mixed + */ + public function getCookieConfig() + { + $cookieDays = $this->_helperData->getWhenToShowConfig('cookieExp'); + + return ($cookieDays !== null) ? $cookieDays : 30; } } diff --git a/Helper/Data.php b/Helper/Data.php index 84daa8c..d344c23 100644 --- a/Helper/Data.php +++ b/Helper/Data.php @@ -63,13 +63,26 @@ public function __construct( StoreManagerInterface $storeManager, Filesystem $filesystem, DirectoryList $directoryList - ) { + ) + { $this->_fileSystem = $filesystem; $this->_directoryList = $directoryList; parent::__construct($context, $objectManager, $storeManager); } + /** + * @param string $code + * @param null $storeId + * @return array|mixed + */ + public function getBetterMaintenanceConfigGeneral($code = '', $storeId = null) + { + $code = ($code !== '') ? '/' . $code : ''; + + return $this->getConfigValue('mpbettermaintenance/general' . $code, $storeId); + } + /** * @param $code * @param null $storeId @@ -104,24 +117,24 @@ public function getWhenToShowConfig($code, $storeId = null) } /** - * @param $code * @param null $storeId * * @return mixed */ - public function getSendEmailConfig($code, $storeId = null) + public function isSendEmail($storeId = null) { - return $this->getModuleConfig('send_email/' . $code, $storeId); + return $this->getSendEmailConfig('isSendEmail', $storeId); } /** + * @param $code * @param null $storeId * * @return mixed */ - public function isSendEmail($storeId = null) + public function getSendEmailConfig($code, $storeId = null) { - return $this->getSendEmailConfig('isSendEmail', $storeId); + return $this->getModuleConfig('send_email/' . $code, $storeId); } /** @@ -134,6 +147,30 @@ public function getToEmail() return $this->getSendEmailConfig('to'); } + /** + * @param $templateId + * + * @return string + * @throws FileSystemException + */ + public function getDefaultTemplateHtml($templateId) + { + return $this->readFile($this->getTemplatePath($templateId)); + } + + /** + * @param $relativePath + * + * @return string + * @throws FileSystemException + */ + public function readFile($relativePath) + { + $rootDirectory = $this->_fileSystem->getDirectoryRead(DirectoryList::ROOT); + + return $rootDirectory->readFile($relativePath); + } + /** * Get default template path * @@ -174,30 +211,6 @@ public function getTemplatePath($templateId, $type = '.html') return $templatePath . $templateId . $type; } - /** - * @param $relativePath - * - * @return string - * @throws FileSystemException - */ - public function readFile($relativePath) - { - $rootDirectory = $this->_fileSystem->getDirectoryRead(DirectoryList::ROOT); - - return $rootDirectory->readFile($relativePath); - } - - /** - * @param $templateId - * - * @return string - * @throws FileSystemException - */ - public function getDefaultTemplateHtml($templateId) - { - return $this->readFile($this->getTemplatePath($templateId)); - } - /** * @return int * @throws NoSuchEntityException diff --git a/view/frontend/templates/popup/popup.phtml b/view/frontend/templates/popup/popup.phtml index d5792ed..0e99cd7 100644 --- a/view/frontend/templates/popup/popup.phtml +++ b/view/frontend/templates/popup/popup.phtml @@ -20,7 +20,7 @@ */ /** @var \Mageplaza\BetterPopup\Block\Popup $block */ -if ($block->checkPagesToShow()): +if ($block->checkPagesToShow() && $block->checkBetterMaintenance()): $floatLocation = ($block->getLocationFloatButton() == 1) ? 'left: 70px' : 'right:70px'; $widthTempate5 = $block->getWidthPopup()-$block->getWidthPopup()*0.1; From 426a9e09b5c7134b349b9056b320e48a6360d521 Mon Sep 17 00:00:00 2001 From: Duong Huy Toan Date: Tue, 30 Mar 2021 11:28:17 +0700 Subject: [PATCH 08/11] =?UTF-8?q?L=E1=BB=97i=20hi=E1=BB=83n=20th=E1=BB=8B?= =?UTF-8?q?=20tr=C3=AAn=20trang=20better=20maintenance.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Block/Success.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Block/Success.php b/Block/Success.php index 9248a9d..9cc22aa 100644 --- a/Block/Success.php +++ b/Block/Success.php @@ -23,6 +23,7 @@ use Magento\Catalog\Block\Product\Context; use Magento\Framework\Exception\LocalizedException; +use Magento\Framework\Stdlib\DateTime\TimezoneInterface; use Magento\Newsletter\Model\ResourceModel\Subscriber\CollectionFactory; use Mageplaza\BetterPopup\Helper\Data as HelperData; use Mageplaza\BetterPopup\Model\Generate; @@ -41,9 +42,9 @@ class Success extends Popup /** * Success constructor. - * * @param Context $context * @param HelperData $helperData + * @param TimezoneInterface $localeDate * @param CollectionFactory $subscriberCollectionFactory * @param Generate $generate * @param array $data @@ -51,11 +52,12 @@ class Success extends Popup public function __construct( Context $context, HelperData $helperData, + TimezoneInterface $localeDate, CollectionFactory $subscriberCollectionFactory, Generate $generate, array $data = [] ) { - parent::__construct($context, $helperData, $subscriberCollectionFactory, $data); + parent::__construct($context, $helperData, $localeDate, $subscriberCollectionFactory, $data); $this->generate = $generate; } From a863e0017950a05b73b0d83ff9b801be3062201b Mon Sep 17 00:00:00 2001 From: Vu Van Tu Date: Mon, 5 Apr 2021 10:58:20 +0700 Subject: [PATCH 09/11] clean code --- Block/Popup.php | 52 ++++++++++++++++++++++++------------------------- Helper/Data.php | 14 ++++++------- 2 files changed, 33 insertions(+), 33 deletions(-) diff --git a/Block/Popup.php b/Block/Popup.php index 9260c66..2490834 100644 --- a/Block/Popup.php +++ b/Block/Popup.php @@ -55,6 +55,7 @@ class Popup extends AbstractProduct implements BlockInterface /** * Popup constructor. + * * @param Context $context * @param HelperData $helperData * @param TimezoneInterface $localeDate @@ -67,10 +68,9 @@ public function __construct( TimezoneInterface $localeDate, CollectionFactory $subscriberCollectionFactory, array $data = [] - ) - { - $this->_helperData = $helperData; - $this->_localeDate = $localeDate; + ) { + $this->_helperData = $helperData; + $this->_localeDate = $localeDate; $this->_subscriberCollectionFactory = $subscriberCollectionFactory; parent::__construct($context, $data); @@ -127,7 +127,7 @@ public function getPopupContent() { $htmlConfig = $this->_helperData->getWhatToShowConfig('html_content'); - $search = [ + $search = [ '{{form_url}}', '{{url_loader}}', '{{email_icon_url}}', @@ -212,8 +212,8 @@ public function checkExclude() public function checkExcludePages() { $fullActionName = $this->getRequest()->getFullActionName(); - $arrayPages = explode("\n", $this->_helperData->getWhereToShowConfig('exclude_pages')); - $includePages = array_map('trim', $arrayPages); + $arrayPages = explode("\n", $this->_helperData->getWhereToShowConfig('exclude_pages')); + $includePages = array_map('trim', $arrayPages); return !in_array($fullActionName, $includePages, true); } @@ -230,7 +230,7 @@ public function checkExcludePaths() if ($pathsConfig) { $arrayPaths = explode("\n", $pathsConfig); - $pathsUrl = array_map('trim', $arrayPaths); + $pathsUrl = array_map('trim', $arrayPaths); foreach ($pathsUrl as $path) { if (strpos($currentPath, $path) !== false) { @@ -283,8 +283,8 @@ public function checkInclude() public function checkIncludePages() { $fullActionName = $this->getRequest()->getFullActionName(); - $arrayPages = explode("\n", $this->_helperData->getWhereToShowConfig('include_pages')); - $includePages = array_map('trim', $arrayPages); + $arrayPages = explode("\n", $this->_helperData->getWhereToShowConfig('include_pages')); + $includePages = array_map('trim', $arrayPages); return in_array($fullActionName, $includePages, true); } @@ -301,7 +301,7 @@ public function checkIncludePaths() if ($pathsConfig) { $arrayPaths = explode("\n", $pathsConfig); - $pathsUrl = array_map('trim', $arrayPaths); + $pathsUrl = array_map('trim', $arrayPaths); foreach ($pathsUrl as $path) { if ($path && strpos($currentPath, $path) !== false) { return true; @@ -320,28 +320,28 @@ public function checkIncludePaths() public function getAjaxData() { $params = [ - 'url' => $this->getUrl('betterpopup/ajax/success'), - 'isScroll' => $this->getPopupAppear() === Appear::AFTER_SCROLL_DOWN, - 'afterSeconds' => [ + 'url' => $this->getUrl('betterpopup/ajax/success'), + 'isScroll' => $this->getPopupAppear() === Appear::AFTER_SCROLL_DOWN, + 'afterSeconds' => [ 'isAfterSeconds' => $this->getPopupAppear() === Appear::AFTER_X_SECONDS, - 'delay' => $this->getDelayConfig() + 'delay' => $this->getDelayConfig() ], - 'percentage' => $this->getPercentageScroll(), - 'fullScreen' => [ + 'percentage' => $this->getPercentageScroll(), + 'fullScreen' => [ 'isFullScreen' => $this->isFullScreen(), - 'bgColor' => $this->getBackGroundColor() + 'bgColor' => $this->getBackGroundColor() ], - 'isExitIntent' => $this->isExitIntent(), + 'isExitIntent' => $this->isExitIntent(), 'isShowPopupSuccess' => $this->_helperData->getWhatToShowConfig('popup_success/enabled'), - 'isShowFireworks' => $this->isShowFireworks(), - 'popupConfig' => [ - 'width' => $this->getWidthPopup(), - 'height' => $this->getHeightPopup(), - 'cookieExp' => $this->getCookieConfig(), - 'delay' => $this->getDelayConfig(), + 'isShowFireworks' => $this->isShowFireworks(), + 'popupConfig' => [ + 'width' => $this->getWidthPopup(), + 'height' => $this->getHeightPopup(), + 'cookieExp' => $this->getCookieConfig(), + 'delay' => $this->getDelayConfig(), 'showOnDelay' => true, ], - 'srcCloseIconWhite' => $this->getViewFileUrl('Mageplaza_BetterPopup::images/icon-close-white.png') + 'srcCloseIconWhite' => $this->getViewFileUrl('Mageplaza_BetterPopup::images/icon-close-white.png') ]; return HelperData::jsonEncode($params); diff --git a/Helper/Data.php b/Helper/Data.php index d344c23..e4462b5 100644 --- a/Helper/Data.php +++ b/Helper/Data.php @@ -63,9 +63,8 @@ public function __construct( StoreManagerInterface $storeManager, Filesystem $filesystem, DirectoryList $directoryList - ) - { - $this->_fileSystem = $filesystem; + ) { + $this->_fileSystem = $filesystem; $this->_directoryList = $directoryList; parent::__construct($context, $objectManager, $storeManager); @@ -74,6 +73,7 @@ public function __construct( /** * @param string $code * @param null $storeId + * * @return array|mixed */ public function getBetterMaintenanceConfigGeneral($code = '', $storeId = null) @@ -188,17 +188,17 @@ public function getTemplatePath($templateId, $type = '.html') $rootPath = $this->_directoryList->getRoot(); $currentDirArr = explode('\\', $currentDir); - $countDir = count($currentDirArr); + $countDir = count($currentDirArr); if ($countDir === 1) { $currentDirArr = explode('/', $currentDir); - $countDir = count($currentDirArr); + $countDir = count($currentDirArr); } $rootPathArr = explode('/', $rootPath); - $countPath = count($rootPathArr); + $countPath = count($rootPathArr); if ($countPath === 1) { $rootPathArr = explode('\\', $rootPath); - $countPath = count($rootPathArr); + $countPath = count($rootPathArr); } $basePath = ''; From df9a8999fa3f1bdae42fa57732b677f5a1c17771 Mon Sep 17 00:00:00 2001 From: Duong Huy Toan Date: Mon, 10 May 2021 19:43:18 +0700 Subject: [PATCH 10/11] Clean code --- composer.json | 2 +- view/frontend/web/css/source/_module.less | 1134 ++++++++++----------- 2 files changed, 568 insertions(+), 568 deletions(-) diff --git a/composer.json b/composer.json index 8dca74e..b66e662 100644 --- a/composer.json +++ b/composer.json @@ -5,7 +5,7 @@ "mageplaza/module-core": "^1.4.5" }, "type": "magento2-module", - "version": "4.0.0", + "version": "4.0.1", "license": "proprietary", "authors": [ { diff --git a/view/frontend/web/css/source/_module.less b/view/frontend/web/css/source/_module.less index d0c6702..3d268ec 100644 --- a/view/frontend/web/css/source/_module.less +++ b/view/frontend/web/css/source/_module.less @@ -1,567 +1,567 @@ -/** - * Mageplaza - * - * NOTICE OF LICENSE - * - * This source file is subject to the Mageplaza.com license that is - * available through the world-wide-web at this URL: - * https://www.mageplaza.com/LICENSE.txt - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade this extension to newer - * version in the future. - * - * @category Mageplaza - * @package Mageplaza_BetterPopup - * @copyright Copyright (c) Mageplaza (https://www.mageplaza.com/) - * @license https://www.mageplaza.com/LICENSE.txt - */ - -#mageplaza-betterpopup-block { - position: relative; -} - -.mp-better-popup-click-trigger { - position: fixed; - bottom: 0; - z-index: 999; -} - -.click-trigger { - background-color: #31B0D5; - color: white; - padding: 10px 25px; - border-top-right-radius: 5px; - border-top-left-radius: 5px; - border-color: #46b8da; -} - -.click-trigger:hover { - background-color: #31B0D5; - color: white; - border: 1px solid #31B0D5; -} - -div#bio_ep_close { - position: absolute; - right: 8px; - top: 0px; - z-index: 99; - color: #fff; - font-size: 20px; - font-weight: bold; - cursor: pointer; -} - -#bio_ep { - text-align: center; - box-shadow: none !important; -} - -.child-label { - display: block; - font-size: 25px; - margin: 20px; -} - -#bio_ep_content { - position: relative; - width: 100%; - display: table-cell; - vertical-align: middle; -} - -.better-popup-input-email { - width: 70% !important; - height: 35px !important; -} - -input.better-popup-input-email::placeholder { - opacity: 0.5; -} - -.better-popup-btn-submit { - width: 70%; - margin: 10px 0 0 0; - -webkit-appearance: none; - -moz-appearance: none; - height: 35px; -} - -.mageplaza-betterpopup-content { - width: 100%; - height: 100%; - display: table; -} - -.success-title { - font-size: 22px; -} - -.mp-popup-coupon-code { - width: 70%; - margin: 0 auto; -} - -#mp-coupon-code { - text-align: center; - max-width: 100%; - border: 1px dashed #c1bebe; - background: 0 0; - font-size: 25px; - color: #FFF; - margin-top: 15px; - height: 50px; -} - -button.btn-copy.primary { - width: 100%; - margin: 5px 0 15px 0; - color: #fff; - background-color: #006bb4; - border: none; - height: 35px; -} - -button.btn-copy.primary:hover { - background: #006bb4; - border: 1px solid #006bb4; - color: #ffffff; -} - -#status { - color: #e02b27; - visibility: visible; - font-size: 13px !important; -} - -span.success-lable { - border: none !important; - font-size: 16px !important; -} - - - - -canvas { - position: fixed; - z-index: 10002; - opacity: 0.5; - display: none; - top: 0px; - left: 0px; -} - -.popup-loader { - display: none; - position: absolute; - width: 100%; - padding-top: 15px; -} - -img.loader { - width: 3%; -} - -//css Template 3 -.tmp3-img-content { - float: left; -} - -.tmp3-text-content { - background-color: #FFFFFF; - font-family: sans-serif; - float: left; - width: calc(~"100% - 460px"); - height: 321px; -} - -.tmp3-title { - color: #0083d0; - font-size: 50px; - margin-top: 30px; -} - -.tmp3-sub-title { - color: #000000; - font-size: 14px; - font-weight: bold; - margin-top: -12px; -} - -.tmp3-text { - color: #000000; - font-size: 14px; - width: 80%; - margin: 0 auto; - line-height: 1.714; - margin-top: 30px; -} - -.tmp3-form { - position: relative; - margin-top: 30px; -} - -.tmp3-input { - border: none !important; - border-radius: 17.5px !important; - background-color: #e5e5e5 !important; - height: 35px !important; - font-family: sans-serif !important; -} - -.tmp3_field_newsletter { - width: 75%; - margin: 0 auto; -} - -.tmp3-button { - position: absolute; - top: 0; - right: 40px; - border-radius: 17.5px; - height: 35px; -} - -::-webkit-input-placeholder { /* WebKit, Blink, Edge */ - color: #a2a2a2 !important; - font-size: 12px !important; - font-style: italic; - padding-left: 5px; -} - -.tm1-popup-loader { - margin-top: 10px; -} - -.tm1-loader { - width: 7%; -} - - - -//Template 4 -#mp-popup-template4 { - width: 105%; - height: 105%; - background-repeat: no-repeat; -} - -.tmp4-text-content { - width: 50%; - background-color: #FFFFFF; - font-family: sans-serif; - float: left; - margin: 25px 0 0 35px; -} - -.tmp4-img-content { - position: absolute; - top: 40px; - right: 10px; -} - -.tmp4-title { - font-size: 50px; - color: rgb(0, 131, 208); - line-height: 1.066; - text-align: left; -} - -.tmp4-sub-title { - font-size: 14px; - color: rgb(34, 34, 34); - font-weight: bold; - text-transform: uppercase; - line-height: 1.8; - text-align: left; -} - -.tmp4-text { - font-size: 14px; - color: rgb(34, 34, 34); - line-height: 1.714; - text-align: left; - width: 75%; - margin-top: 20px; -} - -.tmp4-form { - width: 75%; - margin-left: 9px; - text-align: left; -} - -.tmp4-input { - background-color: #e5e5e5 !important; - margin-top: 30px; - border: none !important; - height: 35px !important; - font-family: sans-serif !important; -} - -.tmp4-input::-webkit-input-placeholder { - font-size: 14px !important; - font-style: italic; - padding-left: 15px; - color: rgb(162, 162, 162) !important; - line-height: 1.714; - text-align: left; -} - -.tmp4-button { - background-color: #ff5a15 !important; - width: 130px; - height: 20px; - border-radius: 10px; - border: none !important; - font-size: 10px !important; - font-weight: bold !important; - padding: 0 !important; - margin: 15px 0 0 25px; -} - - - -//template 5 -.tmp5-img-content { - position: absolute; - z-index: 20; - bottom: 0; - left: 35px; -} - -.tmp5-img-cap { - position: absolute; - z-index: 10; - bottom: 0; - left: 0; -} - -#mp-popup-template5 img { - max-height: initial; -} - -.tmp5-text-content { - font-family: sans-serif; - position: absolute; - z-index: 40; - top: -55px; - left: 65px; - width: 65%; -} - -.tmp5-title { - font-size: 40px; - color: rgb(0, 131, 208); - line-height: 1.2; - text-align: center; -} - -.tmp5-sub-title { - font-size: 12px; - color: rgb(34, 34, 34); - font-weight: bold; - text-align: center; -} - -.tmp5-text { - font-size: 14px; - color: rgb(34, 34, 34); - line-height: 1.286; - text-align: center; - margin-top: 15px; -} - -.tmp5-form { - width: 100%; - position: absolute; - z-index: 30; - left: 0; - bottom: 0; -} - -.tmp5-img-email { - position: absolute; - z-index: 20; - bottom: 0; - left: 0; - pointer-events: none; -} - -.tmp5_field_newsletter { - position: absolute; - z-index: 10; - top: -158px; - left: 80px; -} - -.tmp5-input { - background-color: #e5e5e5 !important; - width: 200px !important; - height: 35px !important; - border: none !important; - font-family: sans-serif !important; - padding-left: 30px !important; -} - -.tmp5-input::-webkit-input-placeholder { - font-size: 14px !important; - font-style: italic; - color: rgb(162, 162, 162) !important; - line-height: 1.714; - text-align: center; - padding-right: 25px; -} - -.tmp5-button { - position: absolute; - z-index: 30; - background-color: #ff5a15 !important; - width: 130px; - height: 20px; - border-radius: 10px; - border: none !important; - font-size: 10px !important; - font-weight: bold !important; - padding: 0 !important; - margin-top: 10px; - top: -125px; - left: 115px; -} - -.tmp5-msg-error { - margin-top: 30px; - position: absolute; - z-index: 60; - width: 100%; -} - -.tmp5_field_newsletter #mp-newsletter-error { - position: absolute; -} - -.tmp5-form .popup-loader { - position: absolute; - width: 100%; - padding-top: 15px; - top: -100px; - left: 0; - z-index: 100; -} - -.tmp5-form .popup-loader .loader { - width: 6%; -} - - - -//template 6 -#mp-popup-template6 { - font-family: sans-serif; - height: fit-content; - width: fit-content; - margin: auto; -} - -.tmp6-left-title { - width: 350px; - background-color: #0083d0; - height: 250px; - float: left; -} - -.tmp6-left-title ul { - list-style-type: none; - margin-top: 35px; -} - -.tmp6-left-title ul li { - margin-bottom: -5px; -} - -.tmp6-left-title ul li:nth-child(1) { - font-size: 36px; - color: rgb(255, 255, 255); - font-weight: bold; - text-align: left; -} - -.tmp6-left-title ul li:nth-child(2) { - font-size: 36px; - color: rgb(255, 255, 255); - text-align: left; -} - -.tmp6-left-title ul li:nth-child(3) { - font-size: 36px; - color: rgb(81, 245, 255); - text-align: left; -} - -.tmp6-text-content { - background-color: #FFFFFF; - width: 450px; - height: 250px; - float: left; -} - -.tmp6-text { - padding-top: 35px; - width: 85%; - margin: 0 auto; - font-size: 20px; - color: rgb(34, 34, 34); - line-height: 1.4; - text-align: center; -} - -.tmp6-form { - width: 85%; - margin: 0 auto; - padding-top: 20px; - position: relative; -} - -.tmp6-input { - background: #e5e5e5 !important; - height: 42px !important; -} - -.tmp6-input::-webkit-input-placeholder { - font-size: 14px !important; - font-style: italic; - color: rgb(162, 162, 162) !important; - line-height: 1.714; - text-align: center; -} - -.tmp6-button { - background-color: #ff5a15 !important; - width: 130px; - height: 20px; - border-radius: 10px; - border: none !important; - font-size: 10px !important; - font-weight: bold !important; - padding: 0 !important; - margin-top: 20px; -} - - - -.tmp6_field_newsletter #mp-newsletter-error { - position: absolute; - top: 57px; - display: block; - width: 100%; -} - -.tmp6-text-content .popup-loader { - position: absolute; - width: 100%; - padding-top: 15px; - bottom: 18px; -} \ No newline at end of file +/** + * Mageplaza + * + * NOTICE OF LICENSE + * + * This source file is subject to the Mageplaza.com license that is + * available through the world-wide-web at this URL: + * https://www.mageplaza.com/LICENSE.txt + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade this extension to newer + * version in the future. + * + * @category Mageplaza + * @package Mageplaza_BetterPopup + * @copyright Copyright (c) Mageplaza (https://www.mageplaza.com/) + * @license https://www.mageplaza.com/LICENSE.txt + */ + +#mageplaza-betterpopup-block { + position: relative; +} + +.mp-better-popup-click-trigger { + position: fixed; + bottom: 0; + z-index: 999; +} + +.click-trigger { + background-color: #31B0D5; + color: white; + padding: 10px 25px; + border-top-right-radius: 5px; + border-top-left-radius: 5px; + border-color: #46b8da; +} + +.click-trigger:hover { + background-color: #31B0D5; + color: white; + border: 1px solid #31B0D5; +} + +div#bio_ep_close { + position: absolute; + right: 8px; + top: 0; + z-index: 99; + color: #fff; + font-size: 20px; + font-weight: bold; + cursor: pointer; +} + +#bio_ep { + text-align: center; + box-shadow: none !important; +} + +.child-label { + display: block; + font-size: 25px; + margin: 20px; +} + +#bio_ep_content { + position: relative; + width: 100%; + display: table-cell; + vertical-align: middle; +} + +.better-popup-input-email { + width: 70% !important; + height: 35px !important; +} + +input.better-popup-input-email::placeholder { + opacity: 0.5; +} + +.better-popup-btn-submit { + width: 70%; + margin: 10px 0 0 0; + -webkit-appearance: none; + -moz-appearance: none; + height: 35px; +} + +.mageplaza-betterpopup-content { + width: 100%; + height: 100%; + display: table; +} + +.success-title { + font-size: 22px; +} + +.mp-popup-coupon-code { + width: 70%; + margin: 0 auto; +} + +#mp-coupon-code { + text-align: center; + max-width: 100%; + border: 1px dashed #c1bebe; + background: 0 0; + font-size: 25px; + color: #FFF; + margin-top: 15px; + height: 50px; +} + +button.btn-copy.primary { + width: 100%; + margin: 5px 0 15px 0; + color: #fff; + background-color: #006bb4; + border: none; + height: 35px; +} + +button.btn-copy.primary:hover { + background: #006bb4; + border: 1px solid #006bb4; + color: #ffffff; +} + +#status { + color: #e02b27; + visibility: visible; + font-size: 13px !important; +} + +span.success-lable { + border: none !important; + font-size: 16px !important; +} + + + + +canvas { + position: fixed; + z-index: 10002; + opacity: 0.5; + display: none; + top: 0; + left: 0; +} + +.popup-loader { + display: none; + position: absolute; + width: 100%; + padding-top: 15px; +} + +img.loader { + width: 3%; +} + +//css Template 3 +.tmp3-img-content { + float: left; +} + +.tmp3-text-content { + background-color: #FFFFFF; + font-family: sans-serif; + float: left; + width: calc(~"100% - 460px"); + height: 321px; +} + +.tmp3-title { + color: #0083d0; + font-size: 50px; + margin-top: 30px; +} + +.tmp3-sub-title { + color: #000000; + font-size: 14px; + font-weight: bold; + margin-top: -12px; +} + +.tmp3-text { + color: #000000; + font-size: 14px; + width: 80%; + margin: 0 auto; + line-height: 1.714; + margin-top: 30px; +} + +.tmp3-form { + position: relative; + margin-top: 30px; +} + +.tmp3-input { + border: none !important; + border-radius: 17.5px !important; + background-color: #e5e5e5 !important; + height: 35px !important; + font-family: sans-serif !important; +} + +.tmp3_field_newsletter { + width: 75%; + margin: 0 auto; +} + +.tmp3-button { + position: absolute; + top: 0; + right: 40px; + border-radius: 17.5px; + height: 35px; +} + +::-webkit-input-placeholder { /* WebKit, Blink, Edge */ + color: #a2a2a2 !important; + font-size: 12px !important; + font-style: italic; + padding-left: 5px; +} + +.tm1-popup-loader { + margin-top: 10px; +} + +.tm1-loader { + width: 7%; +} + + + +//Template 4 +#mp-popup-template4 { + width: 105%; + height: 105%; + background-repeat: no-repeat; +} + +.tmp4-text-content { + width: 50%; + background-color: #FFFFFF; + font-family: sans-serif; + float: left; + margin: 25px 0 0 35px; +} + +.tmp4-img-content { + position: absolute; + top: 40px; + right: 10px; +} + +.tmp4-title { + font-size: 50px; + color: rgb(0, 131, 208); + line-height: 1.066; + text-align: left; +} + +.tmp4-sub-title { + font-size: 14px; + color: rgb(34, 34, 34); + font-weight: bold; + text-transform: uppercase; + line-height: 1.8; + text-align: left; +} + +.tmp4-text { + font-size: 14px; + color: rgb(34, 34, 34); + line-height: 1.714; + text-align: left; + width: 75%; + margin-top: 20px; +} + +.tmp4-form { + width: 75%; + margin-left: 9px; + text-align: left; +} + +.tmp4-input { + background-color: #e5e5e5 !important; + margin-top: 30px; + border: none !important; + height: 35px !important; + font-family: sans-serif !important; +} + +.tmp4-input::-webkit-input-placeholder { + font-size: 14px !important; + font-style: italic; + padding-left: 15px; + color: rgb(162, 162, 162) !important; + line-height: 1.714; + text-align: left; +} + +.tmp4-button { + background-color: #ff5a15 !important; + width: 130px; + height: 20px; + border-radius: 10px; + border: none !important; + font-size: 10px !important; + font-weight: bold !important; + padding: 0 !important; + margin: 15px 0 0 25px; +} + + + +//template 5 +.tmp5-img-content { + position: absolute; + z-index: 20; + bottom: 0; + left: 35px; +} + +.tmp5-img-cap { + position: absolute; + z-index: 10; + bottom: 0; + left: 0; +} + +#mp-popup-template5 img { + max-height: initial; +} + +.tmp5-text-content { + font-family: sans-serif; + position: absolute; + z-index: 40; + top: -55px; + left: 65px; + width: 65%; +} + +.tmp5-title { + font-size: 40px; + color: rgb(0, 131, 208); + line-height: 1.2; + text-align: center; +} + +.tmp5-sub-title { + font-size: 12px; + color: rgb(34, 34, 34); + font-weight: bold; + text-align: center; +} + +.tmp5-text { + font-size: 14px; + color: rgb(34, 34, 34); + line-height: 1.286; + text-align: center; + margin-top: 15px; +} + +.tmp5-form { + width: 100%; + position: absolute; + z-index: 30; + left: 0; + bottom: 0; +} + +.tmp5-img-email { + position: absolute; + z-index: 20; + bottom: 0; + left: 0; + pointer-events: none; +} + +.tmp5_field_newsletter { + position: absolute; + z-index: 10; + top: -158px; + left: 80px; +} + +.tmp5-input { + background-color: #e5e5e5 !important; + width: 200px !important; + height: 35px !important; + border: none !important; + font-family: sans-serif !important; + padding-left: 30px !important; +} + +.tmp5-input::-webkit-input-placeholder { + font-size: 14px !important; + font-style: italic; + color: rgb(162, 162, 162) !important; + line-height: 1.714; + text-align: center; + padding-right: 25px; +} + +.tmp5-button { + position: absolute; + z-index: 30; + background-color: #ff5a15 !important; + width: 130px; + height: 20px; + border-radius: 10px; + border: none !important; + font-size: 10px !important; + font-weight: bold !important; + padding: 0 !important; + margin-top: 10px; + top: -125px; + left: 115px; +} + +.tmp5-msg-error { + margin-top: 30px; + position: absolute; + z-index: 60; + width: 100%; +} + +.tmp5_field_newsletter #mp-newsletter-error { + position: absolute; +} + +.tmp5-form .popup-loader { + position: absolute; + width: 100%; + padding-top: 15px; + top: -100px; + left: 0; + z-index: 100; +} + +.tmp5-form .popup-loader .loader { + width: 6%; +} + + + +//template 6 +#mp-popup-template6 { + font-family: sans-serif; + height: fit-content; + width: fit-content; + margin: auto; +} + +.tmp6-left-title { + width: 350px; + background-color: #0083d0; + height: 250px; + float: left; +} + +.tmp6-left-title ul { + list-style-type: none; + margin-top: 35px; +} + +.tmp6-left-title ul li { + margin-bottom: -5px; +} + +.tmp6-left-title ul li:nth-child(1) { + font-size: 36px; + color: rgb(255, 255, 255); + font-weight: bold; + text-align: left; +} + +.tmp6-left-title ul li:nth-child(2) { + font-size: 36px; + color: rgb(255, 255, 255); + text-align: left; +} + +.tmp6-left-title ul li:nth-child(3) { + font-size: 36px; + color: rgb(81, 245, 255); + text-align: left; +} + +.tmp6-text-content { + background-color: #FFFFFF; + width: 450px; + height: 250px; + float: left; +} + +.tmp6-text { + padding-top: 35px; + width: 85%; + margin: 0 auto; + font-size: 20px; + color: rgb(34, 34, 34); + line-height: 1.4; + text-align: center; +} + +.tmp6-form { + width: 85%; + margin: 0 auto; + padding-top: 20px; + position: relative; +} + +.tmp6-input { + background: #e5e5e5 !important; + height: 42px !important; +} + +.tmp6-input::-webkit-input-placeholder { + font-size: 14px !important; + font-style: italic; + color: rgb(162, 162, 162) !important; + line-height: 1.714; + text-align: center; +} + +.tmp6-button { + background-color: #ff5a15 !important; + width: 130px; + height: 20px; + border-radius: 10px; + border: none !important; + font-size: 10px !important; + font-weight: bold !important; + padding: 0 !important; + margin-top: 20px; +} + + + +.tmp6_field_newsletter #mp-newsletter-error { + position: absolute; + top: 57px; + display: block; + width: 100%; +} + +.tmp6-text-content .popup-loader { + position: absolute; + width: 100%; + padding-top: 15px; + bottom: 18px; +} From fb41118ca4190f1e4829e362f3c439d6372d8929 Mon Sep 17 00:00:00 2001 From: Duong Huy Toan Date: Mon, 10 May 2021 19:48:50 +0700 Subject: [PATCH 11/11] Clean code. --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index b66e662..c7cde71 100644 --- a/composer.json +++ b/composer.json @@ -5,7 +5,7 @@ "mageplaza/module-core": "^1.4.5" }, "type": "magento2-module", - "version": "4.0.1", + "version": "4.1.0", "license": "proprietary", "authors": [ {