Skip to content

Commit

Permalink
Merge pull request #804 from abhishek-webkul/gli-996
Browse files Browse the repository at this point in the history
Updated flow of blocknewsletter module
  • Loading branch information
rohit053 authored Mar 15, 2024
2 parents 07e50d2 + 20549bf commit 83604ff
Show file tree
Hide file tree
Showing 26 changed files with 1,489 additions and 586 deletions.
2 changes: 1 addition & 1 deletion controllers/admin/AdminCustomerPreferencesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public function __construct()
),
'PS_CUSTOMER_OPTIN' => array(
'title' => $this->l('Enable opt-in'),
'hint' => $this->l('Display or not the opt-in tick box, to receive offers from the store\'s partners.'),
'hint' => $this->l('Display or not the opt-in tick box, to receive offers from your hotel partners.'),
'validation' => 'isBool',
'cast' => 'intval',
'type' => 'bool'
Expand Down
9 changes: 5 additions & 4 deletions controllers/admin/AdminCustomersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ class AdminCustomersControllerCore extends AdminController
public function __construct()
{
$this->bootstrap = true;
$this->required_database = true;
$this->required_fields = array('newsletter','optin');
// $this->required_database = true;
// $this->required_fields = array('newsletter','optin');
$this->table = 'customer';
$this->className = 'Customer';
$this->lang = false;
Expand Down Expand Up @@ -458,8 +458,9 @@ public function renderForm()
'label' => $this->l('Disabled')
)
),
'disabled' => (bool)!Configuration::get('PS_CUSTOMER_NWSL'),
'hint' => $this->l('This customer will receive your newsletter via email.')
'disabled' => (bool)!Configuration::get('PS_CUSTOMER_NWSL'),
'hint' => $this->l('This customer will receive your newsletter via email.'),
'desc' => (bool)!Configuration::get('PS_CUSTOMER_NWSL') ? sprintf($this->l('This field is disabled as option \'Enable newsletter registration\' is disabled. You can change it from %sPreferences > Customers%s page.'), '<a href="'.$this->context->link->getAdminLink('AdminCustomerPreferences').'" target="_blank">', '</a>') : '',
),
array(
'type' => 'switch',
Expand Down
2 changes: 1 addition & 1 deletion controllers/front/OrderOpcController.php
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ public function initContent()
}
Tools::safePostVars();

$newsletter = Configuration::get('PS_CUSTOMER_NWSL') || (Module::isInstalled('blocknewsletter') && Module::getInstanceByName('blocknewsletter')->active);
$newsletter = Module::isInstalled('blocknewsletter') && Module::getInstanceByName('blocknewsletter')->active && Configuration::get('PS_CUSTOMER_NWSL');
$this->context->smarty->assign('birthday', (bool) Configuration::get('PS_CUSTOMER_BIRTHDATE'));
$this->context->smarty->assign('newsletter', $newsletter);
$this->context->smarty->assign('optin', (bool)Configuration::get('PS_CUSTOMER_OPTIN'));
Expand Down
241 changes: 187 additions & 54 deletions modules/blocknewsletter/blocknewsletter.css
Original file line number Diff line number Diff line change
@@ -1,56 +1,189 @@
/* Block newsletter */
#newsletter_block_left {
padding:7px;
border:1px solid #ccc;
background:#eee;
}
#newsletter_block_left .title_block, #newsletter_block_left h4 {
padding:0 0 12px 28px;
color:#666;
text-shadow:0 1px 0 #fff;
background:url(img/icon/newsletter.png) no-repeat 0 0 transparent;
}
#newsletter_block_left p {padding:0;}

#newsletter_block_left p.success_inline {
color: #418B19;
text-align: center;
font-weight: bold;
}
#newsletter_block_left p.warning_inline {
color: #DA0F00;
text-align: center;
font-weight: bold;
}

#newsletter_block_left input.inputNew {
position: relative;
top: -1px;
padding:0 5px;
height:20px;
width:148px;
border:1px solid #ccc;
border-right:none;
-moz-border-radius-topleft: 3px;
-moz-border-radius-bottomleft: 3px;
-webkit-border-radius-topleft: 3px;
-webkit-border-radius-bottomleft: 3px;
border-top-left-radius: 3px;
border-bottom-left-radius: 3px;
font-size:10px;
color:#999;
}
*:first-child+html #newsletter_block_left input.inputNew {position:static;}/* hack ie 7 */

#newsletter_block_left input.button_mini {
position:relative;
left:-2px;
height:23px;
width:24px;
border:0;
text-indent:-5000px;
background:url(img/bg_bt_newsletter_ok.png) no-repeat 0 0;
cursor:pointer
}
*:first-child+html #newsletter_block_left input.button_mini {padding-left:24px !important;}/* hack ie 7 */
#columns #newsletter_block_left .form-group {
margin-bottom: 0; }
#columns #newsletter_block_left .form-group .form-control {
max-width: 222px;
display: inline-block;
margin-right: 6px; }
@media (min-width: 768px) and (max-width: 1199px) {
#columns #newsletter_block_left .form-group .form-control {
margin-bottom: 10px;
margin-right: 0; } }
#columns #newsletter_block_left .success_inline, #columns #newsletter_block_left .warning_inline {
text-align: left;
padding: 1px 0 0 0;
margin-bottom: -19px; }
#columns #newsletter_block_left .success_inline {
color: #418B19; }
#columns #newsletter_block_left .warning_inline {
color: #f13340; }

/* Block newsletter footer */
#footer #newsletter_block_left {
overflow: hidden;
/*width: 50%;*//*by webkul*/
float: left;
padding: 13px 15px 7px 15px;
height: 70px;/*by webkul*/
margin-bottom: 0; }
@media (max-width: 992px) {
#footer #newsletter_block_left {
height: 100px; }
#newsletter_block_left .block_content
{
width: 350px;
margin: 10px auto 0px;
}}
@media (max-width: 400px) {
#newsletter_block_left .block_content
{
width: 273px;
}}
@media (max-width: 767px) {
#footer #newsletter_block_left {
/*width: 100%;*/
height: auto; } }
#footer #newsletter_block_left h4 {
background: none;
float: left;
padding: 7px 16px 5px 0;
text-transform: none;
font-size: 21px;
line-height: 25px;
border: none; }
#footer #newsletter_block_left h4:after {
display: none; }
#footer #newsletter_block_left .block_content {
overflow: hidden; }
#footer #newsletter_block_left .form-group {
margin-bottom: 0; }
#footer #newsletter_block_left .form-group .form-control {
height: 45px;
max-width: 267px;
background: #3c3c3c;
border-color: #515151;
color: #fff;
padding: 10px 43px 10px 12px;
display: inline-block;
float: left; }
@media (max-width: 400px) {
#footer #newsletter_block_left .form-group .form-control{
padding: 7px 43px 7px 6px;
height: 37px;
}
}
#footer #newsletter_block_left .form-group .form-control:focus {
-moz-box-shadow: black 0px 0px 0px;
-webkit-box-shadow: black 0px 0px 0px;
box-shadow: black 0px 0px 0px; }
#footer #newsletter_block_left .form-group .button-small {
margin-left: -43px;
border: none;
background: none;
text-align: center;
color: #908f8f;
padding: 8px; }
#footer #newsletter_block_left .form-group .button-small:before {
content: "\f138";
font-family: "FontAwesome";
font-size: 28px;
line-height: 28px; }
#footer #newsletter_block_left .form-group .button-small:hover {
color: #fff !important; }
#footer #newsletter_block_left .form-group .button-small span {
display: none; }
#footer #newsletter_block_left .warning_inline {
display: block;
color: #f13340;
font-size: 13px;
line-height: 26px;
clear: both; }
@media (min-width: 1200px) {
#footer #newsletter_block_left .warning_inline {
display: inline-block;
position: relative;
top: -35px;
margin-bottom: -35px;
left: 15px;
clear: none; } }
#footer #newsletter_block_left .newsletter-input {
max-width: 230px !important; }/*by webkul original 300px*/
@media (max-width: 400px) {
#footer #newsletter_block_left .newsletter-input {
max-width: 190px !important;
}
}

#newsletter-input::-webkit-input-placeholder {
color: #bfbfbf;
}

#newsletter-input:-moz-placeholder { /* Firefox 18- */
color: #bfbfbf;
}

#newsletter-input::-moz-placeholder { /* Firefox 19+ */
color: #bfbfbf;
}

#newsletter-input:-ms-input-placeholder {
color: #bfbfbf;
}

#blocknewsletter .message-block .alert {
position: relative;
}

#blocknewsletter .message-block .alert.alert-dismissable .close {
position: absolute;
top: 0;
right: 0;
padding: 5px 10px;
opacity: 0.5;
color: #000;
text-shadow: none;
}

#blocknewsletter .message-block .alert.alert-dismissable .close:hover {
color: #000;
}

#blocknewsletter .loader {
margin-left: 10px;
position: relative;
top: 10px;
}

#blocknewsletter .loader.loading {
display: inline-flex;
justify-content: center;
}

#blocknewsletter .loader.loading::after {
content: '';
width: 30px;
height: 30px;
border: 4px solid #dddddd;
border-top-color: transparent;
border-radius: 50%;
animation: loading 0.5s linear infinite;
}

@-webkit-keyframes loading { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@-moz-keyframes loading { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes loading { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/*# sourceMappingURL=blocknewsletter.css.map */
.button.button-medium.newsletter-btn {
position: relative;
padding: 0px 20px;
}
#newsletter-input
{
background-color: #3a3a3a;
border: 1px solid #868686;
color: #bfbfbf;
font-size: 13px;
height: 42px;
margin-bottom: 10px;
}
29 changes: 29 additions & 0 deletions modules/blocknewsletter/blocknewsletter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
$(document).on('click', '#blocknewsletter .newsletter-btn', function (e) {
e.preventDefault();

$.ajax({
url: url_newsletter_subscription,
type: 'POST',
dataType: 'JSON',
cache: false,
data: $(this).closest('form').serialize(),
beforeSend: function () {
let messageBlock = $('#blocknewsletter .message-block');
$(messageBlock).fadeOut('fast');

$('#blocknewsletter .loader').show();
},
success: function (response) {
let messageBlock = $('#blocknewsletter .message-block');
$(messageBlock).html(response.message_html).stop(true, true).fadeIn('fast');
},
error: function (jqXHR) {
if (jqXHR.readyState == 0) {
showErrorMessage(no_internet_txt);
}
},
complete: function () {
$('#blocknewsletter .loader').hide();
}
});
});
Loading

0 comments on commit 83604ff

Please sign in to comment.