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