diff --git a/src/components/CartItem.js b/src/components/CartItem.js
index e00e90b..84c0066 100644
--- a/src/components/CartItem.js
+++ b/src/components/CartItem.js
@@ -75,10 +75,24 @@ class CartItem extends Component {
component="div"
sx={{ fontWeight: 'bold', mb: 0.5 }}
>
-
- {item.name}
-
+ {item.seoName ? (
+
+ {item.name}
+
+ ) : (
+ item.name
+ )}
+
+ {item.komponenten && Array.isArray(item.komponenten) && (
+
+ {item.komponenten.map((comp, index) => (
+
+ {comp.name}
+
+ ))}
+
+ )}
- {this.props.id.toString().endsWith("steckling") ?
+ {this.props.id?.toString().endsWith("steckling") ?
(this.props.t ? this.props.t('delivery.times.cutting14Days') : "Lieferzeit: 14 Tage") :
item.available == 1 ?
(this.props.t ? this.props.t('delivery.times.standard2to3Days') : "Lieferzeit: 2-3 Tage") :
@@ -162,4 +176,4 @@ class CartItem extends Component {
}
}
-export default withI18n()(CartItem);
\ No newline at end of file
+export default withI18n()(CartItem);
diff --git a/src/pages/GrowTentKonfigurator.js b/src/pages/GrowTentKonfigurator.js
index a96f8fb..e1ec35e 100644
--- a/src/pages/GrowTentKonfigurator.js
+++ b/src/pages/GrowTentKonfigurator.js
@@ -93,6 +93,7 @@ class GrowTentKonfigurator extends Component {
this.calculateTotalPrice = this.calculateTotalPrice.bind(this);
this.saveStateToWindow = this.saveStateToWindow.bind(this);
this.checkCacheValidity = this.checkCacheValidity.bind(this);
+ this.handleAddToCart = this.handleAddToCart.bind(this);
}
saveStateToWindow() {
@@ -237,6 +238,71 @@ class GrowTentKonfigurator extends Component {
this.setState({ selectedExtras: newSelectedExtras });
}
+ handleAddToCart() {
+ if (!window.cart) window.cart = [];
+
+ // Collect components
+ const setComponents = [];
+
+ // Tent
+ let selectedTent = null;
+ const allShapes = ['60x60', '80x80', '100x100', '120x60'];
+ for (const shape of allShapes) {
+ const tents = this.getTentsForShape(shape);
+ selectedTent = tents.find(t => t.id === this.state.selectedTentSize);
+ if (selectedTent) {
+ setComponents.push(selectedTent);
+ break;
+ }
+ }
+
+ // Light
+ if (this.state.selectedLightType) {
+ const availableLamps = this.getLampsForTentShape(this.state.selectedTentShape);
+ const light = availableLamps.find(l => l.id === this.state.selectedLightType);
+ if (light) setComponents.push(light);
+ }
+
+ // Ventilation
+ if (this.state.selectedVentilationType) {
+ const availableVentilation = this.getVentilationForTentShape(this.state.selectedTentShape);
+ const ventilation = availableVentilation.find(v => v.id === this.state.selectedVentilationType);
+ if (ventilation) setComponents.push(ventilation);
+ }
+
+ // Extras
+ const extrasData = getCachedCategoryData('Set-zubehoer');
+ if (extrasData && Array.isArray(extrasData.products)) {
+ this.state.selectedExtras.forEach(extraId => {
+ const extra = extrasData.products.find(e => e.id === extraId);
+ if (extra) setComponents.push(extra);
+ });
+ }
+
+ // Now push to cart
+ const totalPrice = this.state.totalPrice;
+ const setName = `Growbox Set - ${this.state.selectedTentShape}`;
+
+ window.cart.push({
+ id: null,
+ name: setName,
+ seoName: null,
+ pictureList: null,
+ price: totalPrice,
+ fGrundPreis: null,
+ cGrundEinheit: null,
+ quantity: 1,
+ weight: null,
+ vat: 19,
+ versandklasse: null,
+ availableSupplier: 0,
+ komponenten: setComponents,
+ available: 1
+ });
+
+ window.dispatchEvent(new CustomEvent("cart"));
+ }
+
// Helper function to filter real tent products by shape
@@ -1233,6 +1299,7 @@ class GrowTentKonfigurator extends Component {
}
sx={{
bgcolor: '#2e7d32',
@@ -1246,7 +1313,24 @@ class GrowTentKonfigurator extends Component {
);
}
-
+/*
+ window.cart.push({
+ id: null,
+ name: "Set 80x80",
+ seoName: nnull,
+ pictureList: null,
+ price: total,
+ fGrundPreis: null,
+ cGrundEinheit: null,
+ quantity: 1,
+ weight: null,
+ vat: vat,
+ versandklasse: null,
+ availableSupplier: null,
+ komponenten: setComponents,
+ available: null
+ });
+*/
render() {
@@ -1333,4 +1417,4 @@ class GrowTentKonfigurator extends Component {
}
}
-export default GrowTentKonfigurator;
\ No newline at end of file
+export default GrowTentKonfigurator;