Refactor code structure for improved readability and maintainability

This commit is contained in:
2025-04-18 00:02:27 +02:00
parent a1703a9702
commit 8b79a8399d
8 changed files with 16316 additions and 16601 deletions

View File

@@ -164,8 +164,8 @@
<tbody>
<tr>
<td style="border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; direction: ltr; font-size: 0px; padding: 0 0 30px; text-align: center;" align="center">
<!--[if mso | IE]><table role="presentation" border="0" cellpadding="0" cellspacing="0"><![endif]-->
<!--[if mso | IE]><table role="presentation" border="0" cellpadding="0" cellspacing="0"><![endif]-->
<!-- LOGO BEGINING -->
<!--[if mso | IE]><tr><td class="" width="604px" ><table align="center" border="0" cellpadding="0" cellspacing="0" class="" role="presentation" style="width:604px;" width="604" ><tr><td style="line-height:0px;font-size:0px;mso-line-height-rule:exactly;"><![endif]-->
<div style="margin:0px auto;max-width:604px;">
@@ -203,8 +203,8 @@
</div>
<!--[if mso | IE]></td></tr></table></td></tr><![endif]-->
<!-- LOGO ENDING -->
<!--[if mso | IE]><tr><td class="" width="604px" ><table align="center" border="0" cellpadding="0" cellspacing="0" class="" role="presentation" style="width:604px;" width="604" ><tr><td style="line-height:0px;font-size:0px;mso-line-height-rule:exactly;"><![endif]-->
<div style="margin:0px auto;max-width:604px;">
<table align="center" border="0" cellpadding="0" cellspacing="0" role="presentation" style="border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: 100%;" width="100%">
@@ -287,7 +287,11 @@
<tbody>
<tr>
<td align="left" style="border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; font-size: 0px; padding: 10px 25px; word-break: break-word;">
<div style="font-family:Open sans, arial, sans-serif;font-size:14px;font-weight:600;line-height:25px;text-align:left;color:#363A41;" align="left">Dziękujemy za zapisanie się do naszego newslettera</div>
<div style="font-family:Open sans, arial, sans-serif;font-size:14px;font-weight:600;line-height:25px;text-align:left;color:#363A41;" align="left">
Dziękujemy za zapisanie się do newslettera <b>Lulandii!</b> Teraz będziesz na bieżąco z najlepszymi ofertami, nowościami i poradami dotyczącymi zdrowego snu.<br><br>
🎁 Oto Twój kod rabatowy na pierwsze zakupy: <b>{discount}</b><br><br>
Wykorzystaj go na <b>lulandia.pl</b> i ciesz się komfortowym snem!
</div>
</td>
</tr>
</tbody>
@@ -305,18 +309,18 @@
</div>
<!--[if mso | IE]></td></tr></table></td></tr><![endif]-->
<!-- MESSAGE BOX ENDING -->
<!--[if mso | IE]></table><![endif]-->
</td>
</tr>
</tbody>
</table>
</div>
<!--[if mso | IE]></td></tr></table><![endif]-->
<!--[if mso | IE]></td></tr></table><![endif]-->
<!-- SHOP NAME BEGINING -->
<!--[if mso | IE]><table align="center" border="0" cellpadding="0" cellspacing="0" class="" role="presentation" style="width:604px;" width="604" ><tr><td style="line-height:0px;font-size:0px;mso-line-height-rule:exactly;"><![endif]-->
<div style="margin:0px auto;max-width:604px;">
@@ -350,8 +354,8 @@
</div>
<!--[if mso | IE]></td></tr></table><![endif]-->
<!-- SHOP NAME ENDING -->
</div>
</body>

View File

@@ -479,11 +479,11 @@ class Ps_Emailsubscription extends Module implements WidgetInterface
}
if ($code = Configuration::get('NW_VOUCHER_CODE')) {
$this->sendVoucher($email, $code);
// $this->sendVoucher($email, $code);
}
if (Configuration::get('NW_CONFIRMATION_EMAIL')) {
$this->sendConfirmationEmail($email);
$this->sendConfirmationEmail($email, $code);
}
}
}
@@ -819,20 +819,17 @@ class Ps_Emailsubscription extends Module implements WidgetInterface
*
* @return bool
*/
protected function sendConfirmationEmail($email)
protected function sendConfirmationEmail($email, $code)
{
$language = new Language($this->context->language->id);
return Mail::send(
$this->context->language->id,
'newsletter_conf',
$this->trans(
'Newsletter confirmation',
[],
'Emails.Subject',
$language->locale
),
[],
'Potwierdzenie zapisu do newslettera',
[
'{discount}' => $code,
],
pSQL($email),
null,
null,

View File

@@ -23,29 +23,29 @@
* International Registered Trademark & Property of PrestaShop SA
*/
$(document).ready(function () {
$('.block_newsletter form').on('submit', function () {
var psemailsubscriptionForm = $(this);
if (typeof psemailsubscription_subscription === 'undefined') {
return true;
}
$('.block_newsletter_alert').remove();
$.ajax({
type: 'POST',
dataType: 'JSON',
url: psemailsubscription_subscription,
cache: false,
data: $(this).serialize(),
success: function (data) {
if (data.nw_error) {
psemailsubscriptionForm.prepend('<p class="alert alert-danger block_newsletter_alert">' + data.msg + '</p>');
} else {
psemailsubscriptionForm.prepend('<p class="alert alert-success block_newsletter_alert">' + data.msg + '</p>');
}
},
error: function (err) {
console.log(err);
}
});
return false;
});
$('.my_row.newsletter form').on('submit', function () {
var psemailsubscriptionForm = $(this);
if (typeof psemailsubscription_subscription === 'undefined') {
return true;
}
$('.block_newsletter_alert').remove();
$.ajax({
type: 'POST',
dataType: 'JSON',
url: psemailsubscription_subscription,
cache: false,
data: $(this).serialize(),
success: function (data) {
if (data.nw_error) {
psemailsubscriptionForm.prepend('<p class="alert alert-danger block_newsletter_alert">' + data.msg + '</p>');
} else {
psemailsubscriptionForm.prepend('<p class="alert alert-success block_newsletter_alert">' + data.msg + '</p>');
}
},
error: function (err) {
console.log(err);
}
});
return false;
});
});