added Debug Code
This commit is contained in:
parent
dbca141488
commit
a8534a9e67
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "slinicraftet204/notifyifavail",
|
||||
"description": "benachrichtigt Kunden, sobald ein Produkt wieder verfügbar ist",
|
||||
"version": "0.1.501",
|
||||
"version": "0.1.507",
|
||||
"type": "shopware-platform-plugin",
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
|
@ -7,9 +7,11 @@ export default class NotifyMe extends Plugin {
|
||||
this.submitButton = document.getElementById('submit-notify');
|
||||
|
||||
this.registerEvents();
|
||||
console.log("Hello this is NotifyMe Plugin JS init");
|
||||
}
|
||||
|
||||
registerEvents() {
|
||||
console.log("Hello this is NotifyMe Plugin JS registerevents");
|
||||
if (this.notifyButton) {
|
||||
this.notifyButton.addEventListener('click', () => this.submitForm(true));
|
||||
}
|
||||
@ -20,11 +22,13 @@ export default class NotifyMe extends Plugin {
|
||||
}
|
||||
|
||||
validateEmail(email) {
|
||||
console.log("Hello this is NotifyMe Plugin JS validateEmail");
|
||||
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
||||
return emailRegex.test(email);
|
||||
}
|
||||
|
||||
submitForm(isLoggedIn) {
|
||||
console.log("Hello this is NotifyMe Plugin JS submitForm");
|
||||
let email;
|
||||
const productId = this.notifyButton.dataset.productId;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"NotifyIfAvail": {
|
||||
"notify_me": "Benachrichtigen, wenn verfügbar",
|
||||
"notify_me": "Benachrichtigen, wenn wieder verfügbar",
|
||||
"email_placeholder": "Geben Sie Ihre E-Mail-Adresse ein",
|
||||
"success_message": "Sie werden benachrichtigt, sobald der Artikel verfügbar ist."
|
||||
}
|
||||
|
@ -1,26 +1,30 @@
|
||||
{% sw_extends '@Storefront/storefront/component/buy-widget/buy-widget.html.twig' %}
|
||||
|
||||
{% block buy_widget_price %}
|
||||
<div class="product-detail-price-container">
|
||||
{% sw_include '@Storefront/storefront/component/buy-widget/buy-widget-price.html.twig' %}
|
||||
{{ parent() }}
|
||||
|
||||
{% if not product.available or product.stock <= 0 %}
|
||||
<div class="product-notify-container mt-3">
|
||||
<h3>{{ "NotifyIfAvail.notify_me"|trans }}</h3>
|
||||
<!-- Debugging: Zeigt an, ob das Produkt als verfügbar gilt -->
|
||||
<p>Produkt verfügbar? {{ product.available ? 'Ja' : 'Nein' }}</p>
|
||||
<p>Lagerbestand: {{ product.stock }}</p>
|
||||
|
||||
{% if app.customer %}
|
||||
<!-- Eingeloggter Benutzer -->
|
||||
<button class="btn btn-primary w-100" id="notify-me-button" data-product-id="{{ product.id }}" data-customer-email="{{ app.customer.email }}">
|
||||
{{ "NotifyIfAvail.notify_me"|trans }}
|
||||
</button>
|
||||
{% else %}
|
||||
<!-- Gast/ Nicht eingeloggter Benutzer -->
|
||||
<input type="email" id="notify-me-email" class="form-control mb-2"
|
||||
placeholder="{{ 'NotifyIfAvail.email_placeholder'|trans }}" required>
|
||||
<button class="btn btn-primary w-100" id="submit-notify" data-product-id="{{ product.id }}">
|
||||
{{ "NotifyIfAvail.notify_me"|trans }}
|
||||
</button>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% if not product.available or product.stock <= 0 %}
|
||||
<div class="product-notify-container mt-3">
|
||||
<h3>{{ "NotifyIfAvail.notify_me"|trans }}</h3>
|
||||
|
||||
{% if app.customer %}
|
||||
<button class="btn btn-primary w-100" id="notify-me-button"
|
||||
data-product-id="{{ product.id }}"
|
||||
data-customer-email="{{ app.customer.email }}">
|
||||
{{ "NotifyIfAvail.notify_me"|trans }}
|
||||
</button>
|
||||
{% else %}
|
||||
<input type="email" id="notify-me-email" class="form-control mb-2"
|
||||
placeholder="{{ 'NotifyIfAvail.email_placeholder'|trans }}" required>
|
||||
<button class="btn btn-primary w-100" id="submit-notify"
|
||||
data-product-id="{{ product.id }}">
|
||||
{{ "NotifyIfAvail.notify_me"|trans }}
|
||||
</button>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user