From a3362019acadbfa24dee5596dfbfa2de24c09bba Mon Sep 17 00:00:00 2001 From: gitfreeking Date: Wed, 23 Apr 2025 18:16:12 +0200 Subject: [PATCH 01/13] Finish, ohne Code kommentierug --- public/404.html | 22 ++-- public/header_footer/footer.html | 10 +- public/header_footer/header.html | 48 +++---- public/login/login.html | 46 +++---- public/registrieren/registrieren.html | 79 ++++++------ public/shop/shop.html | 62 ++++----- public/shop/shop_lkw.html | 85 ++++++------ public/shop/shop_motorrad.html | 88 ++++++------- public/shop/shop_oldtimer.html | 91 ++++++------- public/shop/shop_sportwagen.html | 83 ++++++------ public/startseite/startseite.html | 136 ++++++++++---------- static/Styles/login/login.css | 7 - static/Styles/registrieren/registrieren.css | 32 +++-- static/Styles/styles-main.css | 28 +++- 14 files changed, 420 insertions(+), 397 deletions(-) diff --git a/public/404.html b/public/404.html index 4b776da..0d4597b 100644 --- a/public/404.html +++ b/public/404.html @@ -1,27 +1,27 @@ - - - Seite nicht gefunden - - - + + + Seite nicht gefunden + + + -
+
-

đźš§ Seite nicht gefunden đźš§

-

Diese Seite existiert nicht oder befindet sich noch in Arbeit.

- Zur Startseite +

đźš§ Seite nicht gefunden đźš§

+

Diese Seite existiert nicht oder befindet sich noch in Arbeit.

+ Zur Startseite
-
+
\ No newline at end of file diff --git a/public/header_footer/footer.html b/public/header_footer/footer.html index 8178fca..4ab756a 100644 --- a/public/header_footer/footer.html +++ b/public/header_footer/footer.html @@ -1,8 +1,8 @@ diff --git a/public/header_footer/header.html b/public/header_footer/header.html index 7d69b84..fe6ad02 100644 --- a/public/header_footer/header.html +++ b/public/header_footer/header.html @@ -1,31 +1,31 @@
-
- Modellauto-Shop Logo -

Modellauto - Shop

-
-
- -
- - 0 + + Modellauto-Shop Logo +

Modellauto - Shop

+
+
+ +
+ + 0 +
-
diff --git a/public/login/login.html b/public/login/login.html index 441ef8f..189bf4f 100644 --- a/public/login/login.html +++ b/public/login/login.html @@ -10,31 +10,31 @@ Login - -
+ +
-
- -
+
+ +
- - + + diff --git a/public/registrieren/registrieren.html b/public/registrieren/registrieren.html index e5dbf8e..a66bfa3 100644 --- a/public/registrieren/registrieren.html +++ b/public/registrieren/registrieren.html @@ -1,61 +1,62 @@ - - - - - - - Registrieren + + + + + + + Registrieren -
+
-
-
-

Registrieren

+
+ +

Registrieren

-
- - -
-
- - -
-
- - -
-
- - -
+
+ + +
+
+ + +
+
+ + +
+
+ + +
-
- - -
+
+ + +
- + - - -
+ + +
-
+
diff --git a/public/shop/shop.html b/public/shop/shop.html index 9e97320..fd2bcb6 100644 --- a/public/shop/shop.html +++ b/public/shop/shop.html @@ -1,36 +1,36 @@ - - - Shop - - - + + + Shop + + + - -
+ +
- -
+ +

Willkommen im Webshop

-
+
-
+
- +
-
+
- + }); + - - + + \ No newline at end of file diff --git a/public/shop/shop_lkw.html b/public/shop/shop_lkw.html index 2c1af94..6638048 100644 --- a/public/shop/shop_lkw.html +++ b/public/shop/shop_lkw.html @@ -1,59 +1,64 @@ - - - Shop - LKW's - - - + + + Shop - LKW's + + + - -
+
+ +
- -
-

Unsere LKW Produkte

-
-
- -
+ +
+
+

Unsere LKW Produkte

+
+ +
+ +
+
+ + + +
- - - \ No newline at end of file diff --git a/public/shop/shop_motorrad.html b/public/shop/shop_motorrad.html index eacf581..1f3d233 100644 --- a/public/shop/shop_motorrad.html +++ b/public/shop/shop_motorrad.html @@ -1,60 +1,62 @@ - - - Shop - Motorräder - - - + + + Shop - Motorräder + + + - -
+
+ +
- -
-

Unsere Motorrad Produkte

-
-
- -
+ +
+
+

Unsere Motorrad Produkte

+
+
+ +
+
+ + + +
- - - - - \ No newline at end of file + diff --git a/public/shop/shop_oldtimer.html b/public/shop/shop_oldtimer.html index df7bb22..b86aee5 100644 --- a/public/shop/shop_oldtimer.html +++ b/public/shop/shop_oldtimer.html @@ -1,59 +1,62 @@ - - - Shop - Oldtimer - - - + + + Shop - Oldtimer + + + - -
+
+ +
- -
-

Unsere Oldtimer Produkte

-
-
- -
+ +
+
+

Unsere Oldtimer Produkte

+
- - - - - + }) + .catch(err => { + console.error('Fehler beim Laden der Oldtimer_Produkte:', err); + const container = document.getElementById('products_oldtimer'); + container.innerHTML = ` +
+

Fehler beim Laden der Produkte

+

Es gab ein Problem beim Abrufen der Produktdaten.
Wir arbeiten bereits daran – bitte versuchen Sie es später erneut.

+
`; + }); + - \ No newline at end of file + diff --git a/public/shop/shop_sportwagen.html b/public/shop/shop_sportwagen.html index e2ee0ae..445088a 100644 --- a/public/shop/shop_sportwagen.html +++ b/public/shop/shop_sportwagen.html @@ -1,63 +1,64 @@ - - - Shop - Sportwagen - - - + + + Shop - Sportwagen + + +
- -
+ +
- -
-

Unsere Sportwagen Produkte

-
+ +
+
+

Unsere Sportwagen Produkte

+
-
- -
+
+ +
+
- - + +
diff --git a/public/startseite/startseite.html b/public/startseite/startseite.html index 143ff0e..52e8f2c 100644 --- a/public/startseite/startseite.html +++ b/public/startseite/startseite.html @@ -9,92 +9,92 @@ -
- -
+
+ +
-
- -
-

Willkommen beim Modellauto-Shop

-

Bei uns finden Sie hochwertige Modellautos – ob Oldtimer, Sportwagen, Lkw's oder Motorräder. - Perfekt für Sammler, Bastler und Fans. -

-
+
+ +
+

Willkommen beim Modellauto-Shop

+

Bei uns finden Sie hochwertige Modellautos – ob Oldtimer, Sportwagen, Lkw's oder Motorräder. + Perfekt für Sammler, Bastler und Fans. +

+
- -

Unsere Neusten Produkte:

-
- -
+ +

Unsere Neusten Produkte:

+
+ +
- - + }); + - -
-
- -

Versandkostenfrei ab 50€

-

Schneller & sicherer Versand mit Sendungsverfolgung.

-
-
- -

Flexible Zahlungsmethoden

-

PayPal, Kreditkarte, Klarna, Vorkasse – Sie haben die Wahl.

-
-
- -

14 Tage RĂĽckgaberecht

-

Unzufrieden? Kein Problem – Rückgabe einfach & unkompliziert.

-
-
- -

Top-Bewertungen

-

Unsere Kunden lieben uns – überzeugen Sie sich selbst!

-
-
-
+ +
+
+ +

Versandkostenfrei ab 50€

+

Schneller & sicherer Versand mit Sendungsverfolgung.

+
+
+ +

Flexible Zahlungsmethoden

+

PayPal, Kreditkarte, Klarna, Vorkasse – Sie haben die Wahl.

+
+
+ +

14 Tage RĂĽckgaberecht

+

Unzufrieden? Kein Problem – Rückgabe einfach & unkompliziert.

+
+
+ +

Top-Bewertungen

+

Unsere Kunden lieben uns – überzeugen Sie sich selbst!

+
+
+
- - + + -
+
diff --git a/static/Styles/login/login.css b/static/Styles/login/login.css index d5072e2..8eae58a 100644 --- a/static/Styles/login/login.css +++ b/static/Styles/login/login.css @@ -9,13 +9,6 @@ margin: 50px auto; /* Zentriert das Formular */ } -.login-title { - font-size: 26px; - font-weight: 600; - margin-bottom: 25px; - color: #333; -} - .login-form .input-group { position: relative; margin-bottom: 20px; diff --git a/static/Styles/registrieren/registrieren.css b/static/Styles/registrieren/registrieren.css index ab7b9c0..de4ccbb 100644 --- a/static/Styles/registrieren/registrieren.css +++ b/static/Styles/registrieren/registrieren.css @@ -4,7 +4,7 @@ min-height: 100vh; } -.wrapper { +.register-wrapper { max-width: 400px; width: 100%; padding: 30px; @@ -21,6 +21,7 @@ align-items: center; padding: 40px 20px; } + .registration-container { max-width: 400px; margin: 60px auto; @@ -49,22 +50,6 @@ box-sizing: border-box; } -.registration-container button[type="submit"] { - width: 100%; - padding: 10px; - background-color: #007bff; - color: white; - border: none; - border-radius: 8px; - font-size: 1em; - cursor: pointer; - transition: background-color 0.3s ease; -} - -.registration-container button[type="submit"]:hover { - background-color: #0056b3; -} - .register-link { text-align: center; font-size: 14px; @@ -81,3 +66,16 @@ text-decoration: underline; } +.register-btn { + width: 100%; + padding: 12px; + background: #ff6600; + color: white; + border: none; + border-radius: 25px; + font-size: 16px; + font-weight: 600; + cursor: pointer; + transition: background 0.3s ease; +} + diff --git a/static/Styles/styles-main.css b/static/Styles/styles-main.css index a62ee29..6af9077 100644 --- a/static/Styles/styles-main.css +++ b/static/Styles/styles-main.css @@ -41,7 +41,13 @@ header { .logo-container { display: flex; align-items: center; - gap: 15px; + text-decoration: none; + color: inherit; +} + +.logo-container h1 { + margin-left: 10px; + font-size: 1.8rem; } .logo-img { @@ -283,6 +289,14 @@ main { margin-bottom: 20px; } +.title { + font-size: 26px; + font-weight: 600; + margin-bottom: 25px; + color: #333; + text-align: center; +} + .input-box input { width: 100%; padding: 12px 40px 12px 15px; @@ -377,7 +391,7 @@ h1 { color: #b00020; border: 1px solid #ffcccc; border-radius: 12px; - box-shadow: 0 4px 12px rgba(0,0,0,0.1); + box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1); text-align: center; font-family: inherit; animation: fadeIn 0.6s ease-in-out; @@ -395,8 +409,14 @@ h1 { /* Optional: weiche Animation beim Einblenden */ @keyframes fadeIn { - from { opacity: 0; transform: translateY(20px); } - to { opacity: 1; transform: translateY(0); } + from { + opacity: 0; + transform: translateY(20px); + } + to { + opacity: 1; + transform: translateY(0); + } } From e2a1fb9151f0fb8b3965ba0f7119a9a96284feb8 Mon Sep 17 00:00:00 2001 From: vextv Date: Sat, 26 Apr 2025 18:16:34 +0200 Subject: [PATCH 02/13] - changed the categories of the products to fit the theme --- database/db_scripts/webshop_test-data.sql | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/database/db_scripts/webshop_test-data.sql b/database/db_scripts/webshop_test-data.sql index 2e4bd83..d94c6b2 100644 --- a/database/db_scripts/webshop_test-data.sql +++ b/database/db_scripts/webshop_test-data.sql @@ -2,15 +2,15 @@ USE webshop; -- Product Categories INSERT INTO product_category (id, name) -VALUES (1, 'Electronics'); +VALUES (1, 'Motorräder'); INSERT INTO product_category (id, name) -VALUES (2, 'Home Appliances'); +VALUES (2, 'Oldtimer'); INSERT INTO product_category (id, name) -VALUES (3, 'Clothing'); +VALUES (3, 'Sportwägen'); INSERT INTO product_category (id, name) -VALUES (4, 'Sports'); +VALUES (4, 'LKWs'); INSERT INTO product_category (id, name) -VALUES (5, 'Books'); +VALUES (5, 'Kleinwägen'); -- Discounts INSERT INTO discount (id, name, description, discount_percent, active) From 6fbf988c38c5bef8997bac590a3e653f42fb0183 Mon Sep 17 00:00:00 2001 From: gitfreeking Date: Sat, 26 Apr 2025 18:29:27 +0200 Subject: [PATCH 03/13] Finish, ohne Code kommentierug --- public/shop/shop.html | 7 +++---- public/shop/shop_sportwagen.html | 1 - 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/public/shop/shop.html b/public/shop/shop.html index fd2bcb6..98d8e76 100644 --- a/public/shop/shop.html +++ b/public/shop/shop.html @@ -23,6 +23,9 @@
+ + + - - - - \ No newline at end of file diff --git a/public/shop/shop_sportwagen.html b/public/shop/shop_sportwagen.html index 445088a..4bad795 100644 --- a/public/shop/shop_sportwagen.html +++ b/public/shop/shop_sportwagen.html @@ -60,6 +60,5 @@
`; }); - From c3636b0166e97a0259c9139e0dec068c8d6b9410 Mon Sep 17 00:00:00 2001 From: vextv Date: Sun, 27 Apr 2025 12:04:56 +0200 Subject: [PATCH 04/13] - added npm start script - modified packages --- package-lock.json | 36 +++++++++++++++++++++++++++++++++--- package.json | 10 +++++----- 2 files changed, 38 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index d926216..b3c988d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { - "name": "sniper", + "name": "webshop", "version": "1.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "sniper", + "name": "webshop", "version": "1.0.0", "license": "ISC", "dependencies": { @@ -15,7 +15,9 @@ "express-session": "^1.18.1", "mysql": "^2.18.1", "mysql2": "^3.12.0", - "path": "^0.12.7" + "node": "^22.15.0", + "path": "^0.12.7", + "server.js": "^1.0.0" } }, "node_modules/accepts": { @@ -674,6 +676,28 @@ "node": ">= 0.6" } }, + "node_modules/node": { + "version": "22.15.0", + "resolved": "https://registry.npmjs.org/node/-/node-22.15.0.tgz", + "integrity": "sha512-qrOEL83lNt+Jbh9pekl5xQrZK+QRJz51m2IGGCu2NENgbG6Go0D1QUBvjbejP8jB2eokQpX1AorDLbKQ/FxuYA==", + "hasInstallScript": true, + "license": "ISC", + "dependencies": { + "node-bin-setup": "^1.0.0" + }, + "bin": { + "node": "bin/node" + }, + "engines": { + "npm": ">=5.0.0" + } + }, + "node_modules/node-bin-setup": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/node-bin-setup/-/node-bin-setup-1.1.3.tgz", + "integrity": "sha512-opgw9iSCAzT2+6wJOETCpeRYAQxSopqQ2z+N6BXwIMsQQ7Zj5M8MaafQY8JMlolRR6R1UXg2WmhKp0p9lSOivg==", + "license": "ISC" + }, "node_modules/object-inspect": { "version": "1.13.2", "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.2.tgz", @@ -894,6 +918,12 @@ "node": ">= 0.8.0" } }, + "node_modules/server.js": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/server.js/-/server.js-1.0.0.tgz", + "integrity": "sha512-fO4IvzkZ09bBB++XU/gWGuzxJs0OpghSd/34mlW8coMoakLzj/+W5d1pHX+I+7H52GkBKu96UQU0K5vptNjaqg==", + "license": "ISC" + }, "node_modules/set-function-length": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", diff --git a/package.json b/package.json index a95f1e3..f34f8f5 100644 --- a/package.json +++ b/package.json @@ -1,10 +1,10 @@ { - "name": "sniper", + "name": "webshop", "version": "1.0.0", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", - "start": "node server.js" + "start": "npm install && node server.js" }, "keywords": [], "author": "", @@ -12,13 +12,13 @@ "description": "Webshop Autohändler", "dependencies": { "app-root-path": "^3.1.0", - "dotenv": "^16.4.5", - "express": "^4.21.1", "dotenv": "^16.4.7", "express": "^4.21.2", "express-session": "^1.18.1", "mysql": "^2.18.1", "mysql2": "^3.12.0", - "path": "^0.12.7" + "node": "^22.15.0", + "path": "^0.12.7", + "server.js": "^1.0.0" } } From 34907bbdb5b17fc661fb40377fd71649aef2436d Mon Sep 17 00:00:00 2001 From: vextv Date: Sun, 27 Apr 2025 13:37:15 +0200 Subject: [PATCH 05/13] - added redirect after registration - WIP: order system to save orders and display them to the buyer --- public/bestellformular/bestellformular.html | 20 +++++++++----------- public/bestellung/bestellung.html | 2 ++ public/registrieren/registrieren.html | 1 + server.js | 19 ++++++++++++------- 4 files changed, 24 insertions(+), 18 deletions(-) diff --git a/public/bestellformular/bestellformular.html b/public/bestellformular/bestellformular.html index 4c81016..8f02250 100644 --- a/public/bestellformular/bestellformular.html +++ b/public/bestellformular/bestellformular.html @@ -39,36 +39,34 @@ - Bestellung absenden + Bestellung absenden + + + Ihre Bestellung + + +
-
+

Ihre Bestellung:

- -
-

Kundennummer:

-

Produkt-ID:

-

Produktname:

-

Preis:

-
+ +
+

Kundennummer:

+

Produkt-ID:

+

Produktname:

+

Preis:

+
-
+
diff --git a/server.js b/server.js index 899f6c2..388aba4 100644 --- a/server.js +++ b/server.js @@ -130,7 +130,7 @@ app.get('/api/products/sportwagen', async (req, res) => { app.post('/api/user/registration', (req, res) => { // SQL-Query fĂĽr Nutzerregistration const {name, lower_name, email, passwd} = req.body; - const sql = "INSERT INTO user (name, lower_name, email, passwd, passwd_hash_algo) VALUES (?, ?, ?, ?, 'none')" + const sql = "INSERT INTO webshop.user (name, lower_name, email, passwd, passwd_hash_algo) VALUES (?, ?, ?, ?, 'none')" // Query abschicken db.query(sql, [name, lower_name, email, passwd], (err, results) => { @@ -172,8 +172,8 @@ app.post('/api/bestellung', (req, res) => { const {user_id, product_id} = req.body; - const sql1 = 'INSERT INTO order_details (, user_id, payment_id, total) VALUES (?, null, null)' - const sql2 = 'INSERT INTO order_items (user_id, product_id, quantity, order_id) VALUES (?, ?, 1, ?)'; + const sql1 = 'INSERT INTO webshop.order_details (user_id, payment_id, total) VALUES (?, 1, 0)' + const sql2 = 'INSERT INTO webshop.order_items (user_id, product_id, quantity, order_id) VALUES (?, ?, 1, ?)'; db.query(sql1, [user_id, 1, 100.00], (err1, result1) => { if (err1) { @@ -190,11 +190,11 @@ app.post('/api/bestellung', (req, res) => { }); }); -app.get('/api/bestellung/daten', (req, res) => { +app.post('/api/bestellung/daten', (req, res) => { const user_id = req.body; - const sql = 'SELECT oi.user_id, oi.product_id, p.product_name, p.price FROM order_items oi INNER JOIN product p ON oi.product_id = p.id WHERE user_id = ? ' + const sql = 'SELECT oi.user_id, oi.product_id, p.name AS product_name, p.price FROM order_items oi INNER JOIN product p ON oi.product_id = p.id WHERE oi.user_id = ? ' db.query(sql, [user_id], (err, results) => { if (err) { console.error('Fehler beim Abrufen der Bestellung: ', err); From 39c5e58af4bdf80a10294ae781eb30c99cde4c97 Mon Sep 17 00:00:00 2001 From: gitfreeking Date: Mon, 28 Apr 2025 09:05:28 +0200 Subject: [PATCH 08/13] Code Kommentierung, Bestellformular angepasst. Code Anpassung. --- public/404.html | 13 ++- public/bestellformular/bestellformular.html | 3 +- public/header_footer/footer.html | 8 +- public/header_footer/header.html | 56 ++++++++---- public/login/login.html | 29 +++++-- public/registrieren/registrieren.html | 87 +++++++++++-------- public/shop/shop.html | 22 ++++- public/shop/shop_lkw.html | 18 +++- public/shop/shop_motorrad.html | 20 ++++- public/shop/shop_oldtimer.html | 24 ++++- public/shop/shop_sportwagen.html | 21 ++++- public/startseite/startseite.html | 17 +++- scripts/einfĂĽgenHeaderFooter.js | 18 +++- scripts/routes/other/route-index.js | 6 +- server.js | 8 ++ .../bestellformular/bestellformular.css | 1 - 16 files changed, 272 insertions(+), 79 deletions(-) diff --git a/public/404.html b/public/404.html index 0d4597b..69a558c 100644 --- a/public/404.html +++ b/public/404.html @@ -1,21 +1,32 @@ + + Seite nicht gefunden + + +
-
+ +

đźš§ Seite nicht gefunden đźš§

Diese Seite existiert nicht oder befindet sich noch in Arbeit.

+ Zur Startseite
diff --git a/public/bestellformular/bestellformular.html b/public/bestellformular/bestellformular.html index 3f353e3..f3f07e4 100644 --- a/public/bestellformular/bestellformular.html +++ b/public/bestellformular/bestellformular.html @@ -6,12 +6,13 @@ Bestellformular +
-
+
diff --git a/public/header_footer/footer.html b/public/header_footer/footer.html index 4ab756a..521d90b 100644 --- a/public/header_footer/footer.html +++ b/public/header_footer/footer.html @@ -1,6 +1,12 @@ - + +
+

© 2025 Autohändler Webshop – Alle Rechte vorbehalten

+

Impressum | Datenschutz diff --git a/public/header_footer/header.html b/public/header_footer/header.html index b3968a6..496800d 100644 --- a/public/header_footer/header.html +++ b/public/header_footer/header.html @@ -1,34 +1,56 @@ - +

+
Modellauto-Shop Logo

Modellauto - Shop

+
+ + diff --git a/public/login/login.html b/public/login/login.html index 189bf4f..6e128de 100644 --- a/public/login/login.html +++ b/public/login/login.html @@ -1,31 +1,50 @@ + + - - - - Login + + + + + + + + -
+
diff --git a/public/header_footer/header.html b/public/header_footer/header.html index 20ec0f6..c2db739 100644 --- a/public/header_footer/header.html +++ b/public/header_footer/header.html @@ -10,7 +10,7 @@ - 0 + 0
diff --git a/public/login/login.html b/public/login/login.html index 52d9e7a..bcc3c12 100644 --- a/public/login/login.html +++ b/public/login/login.html @@ -51,6 +51,8 @@ if (response.ok) { const data = await response.json(); sessionStorage.setItem("user_id", data.id) + sessionStorage.setItem("vorname", data.name) + sessionStorage.setItem("nachname", data.lower_name) alert('Login erfolgreich!'); window.location.href = '/'; // Redirect to home page after login } else { diff --git a/public/registrieren/registrieren.html b/public/registrieren/registrieren.html index e2a34b5..d28221b 100644 --- a/public/registrieren/registrieren.html +++ b/public/registrieren/registrieren.html @@ -76,6 +76,8 @@ if (response.ok) { const data = await response.json(); sessionStorage.setItem("user_id", data.id) + sessionStorage.setItem("vorname", data.name) + sessionStorage.setItem("nachname", data.lower_name) alert('Nutzer erfolgreich hinzugefĂĽgt! Ihre Kundennummer: ' + data.id) window.location.href= '/' } else { diff --git a/public/shop/shop.html b/public/shop/shop.html index 37ae415..d24e94f 100644 --- a/public/shop/shop.html +++ b/public/shop/shop.html @@ -27,35 +27,65 @@ diff --git a/public/shop/shop_lkw.html b/public/shop/shop_lkw.html index a8b105e..1ded1b7 100644 --- a/public/shop/shop_lkw.html +++ b/public/shop/shop_lkw.html @@ -29,36 +29,65 @@
diff --git a/public/shop/shop_motorrad.html b/public/shop/shop_motorrad.html index 1570ecf..43f6382 100644 --- a/public/shop/shop_motorrad.html +++ b/public/shop/shop_motorrad.html @@ -26,34 +26,65 @@ diff --git a/public/shop/shop_oldtimer.html b/public/shop/shop_oldtimer.html index 15f6f1f..c659798 100644 --- a/public/shop/shop_oldtimer.html +++ b/public/shop/shop_oldtimer.html @@ -29,34 +29,65 @@ diff --git a/public/shop/shop_sportwagen.html b/public/shop/shop_sportwagen.html index 97d720c..a87fde4 100644 --- a/public/shop/shop_sportwagen.html +++ b/public/shop/shop_sportwagen.html @@ -29,38 +29,67 @@ - + \ No newline at end of file diff --git a/public/startseite/startseite.html b/public/startseite/startseite.html index 93f859d..171b85f 100644 --- a/public/startseite/startseite.html +++ b/public/startseite/startseite.html @@ -30,40 +30,66 @@ diff --git a/scripts/einfügenHeaderFooter.js b/scripts/einfügenHeaderFooter.js index 08ad09d..a48657a 100644 --- a/scripts/einfügenHeaderFooter.js +++ b/scripts/einfügenHeaderFooter.js @@ -9,6 +9,9 @@ document.addEventListener("DOMContentLoaded", () => { }) .then(data => { headerTarget.innerHTML = data; + + // 🚀 WICHTIG: Jetzt den Warenkorb zählen, nachdem der Header geladen ist! + zeigeWarenkorbAnzahl(); }) .catch(error => { headerTarget.innerHTML = ` @@ -38,4 +41,19 @@ document.addEventListener("DOMContentLoaded", () => { console.error(error); }); } -}); + + window.zeigeWarenkorbAnzahl = function() { + const warenkorb = JSON.parse(localStorage.getItem('warenkorb')) || []; + let anzahl = 0; + + warenkorb.forEach(produkt => { + anzahl += produkt.quantity; + }); + + const anzahlElement = document.getElementById('cart-count'); + if (anzahlElement) { + anzahlElement.textContent = anzahl; + } + console.log('Warenkorb-Anzahl:', anzahl); + } +}); \ No newline at end of file diff --git a/server.js b/server.js index 59b3e21..7b339bf 100644 --- a/server.js +++ b/server.js @@ -163,8 +163,10 @@ app.post('/api/user/login', (req, res) => { req.session.userId = user.id; req.session.email = user.email; + req.session.vorname = user.name; + req.session.nachname = user.lower_name; - res.json({message: 'Login erfolgreich', id: user.id}) + res.json({message: 'Login erfolgreich', id: user.id, name: user.name, lower_name: user.lower_name}) }) })