feat: normalize delivery methods in CartTab and DeliveryMethodSelector components

This commit is contained in:
sebseb7
2026-03-18 06:59:20 +01:00
parent 1e1a0c7320
commit f0e4a94dfc
4 changed files with 47 additions and 14 deletions

View File

@@ -345,10 +345,45 @@ class Footer extends Component {
</Stack>
{/* Copyright Section */}
<Box sx={{ pb:'20px',textAlign: 'center', filter: 'drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3))', opacity: 0.7 }}>
<Box sx={{ pb: 0, textAlign: 'center', filter: 'drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3))', opacity: 0.7 }}>
<Typography variant="body2" sx={{ mb: 1, fontSize: { xs: '11px', md: '14px' }, lineHeight: 1.5 }}>
{this.props.t ? this.props.t('footer.allPricesIncl') : '* Alle Preise inkl. gesetzlicher USt., zzgl. Versand'}
</Typography>
<Typography
variant="body2"
sx={{
mb: 1,
fontSize: { xs: '11px', md: '14px' },
lineHeight: 1.5,
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
gap: 0.75,
}}
>
Made with
<Box
component="span"
sx={{
backgroundColor: '#1976d2',
color: '#ffffff',
borderRadius: '3px',
px: 0.6,
py: 0.15,
fontWeight: 700,
lineHeight: 1,
fontSize: { xs: '10px', md: '12px' },
letterSpacing: '0.3px',
display: 'inline-flex',
alignItems: 'center',
}}
>
jB
</Box>
<StyledDomainLink href="https://jbuddy.de" target="_blank" rel="noopener noreferrer">
jBuddy.de
</StyledDomainLink>
</Typography>
<Typography variant="body2" sx={{ fontSize: { xs: '11px', md: '14px' }, lineHeight: 1.5 }}>
© {new Date().getFullYear()} <StyledDomainLink href="https://growheads.de" target="_blank" rel="noopener noreferrer">GrowHeads.de</StyledDomainLink>
</Typography>

View File

@@ -8,6 +8,8 @@ import CheckoutValidation from "./CheckoutValidation.js";
import { withI18n } from "../../i18n/index.js";
class CartTab extends Component {
normalizeDeliveryMethod = (deliveryMethod) => (deliveryMethod === "DPD" ? "DHL" : deliveryMethod);
constructor(props) {
super(props);
@@ -107,10 +109,12 @@ class CartTab extends Component {
// Map delivery method values if needed
const deliveryMethodMap = {
"standard": "DHL",
"express": "DPD",
"express": "DHL",
"pickup": "Abholung"
};
prefillDeliveryMethod = deliveryMethodMap[prefillDeliveryMethod] || prefillDeliveryMethod;
prefillDeliveryMethod = this.normalizeDeliveryMethod(
deliveryMethodMap[prefillDeliveryMethod] || prefillDeliveryMethod
);
// Determine payment method - respect constraints
let prefillPaymentMethod = template.payment_method || "wire";
@@ -168,7 +172,9 @@ class CartTab extends Component {
const cartItems = Array.isArray(window.cart) ? window.cart : [];
const shouldForcePickup = CheckoutValidation.shouldForcePickupDelivery(cartItems);
const newDeliveryMethod = shouldForcePickup ? "Abholung" : this.state.deliveryMethod;
const newDeliveryMethod = shouldForcePickup
? "Abholung"
: this.normalizeDeliveryMethod(this.state.deliveryMethod);
const deliveryCost = this.orderService.getDeliveryCost();
// Get optimal payment method for the current state
@@ -215,7 +221,7 @@ class CartTab extends Component {
};
handleDeliveryMethodChange = (event) => {
const newDeliveryMethod = event.target.value;
const newDeliveryMethod = this.normalizeDeliveryMethod(event.target.value);
const deliveryCost = this.orderService.getDeliveryCost();
// Get optimal payment method for the new delivery method

View File

@@ -96,7 +96,7 @@ class CheckoutForm extends Component {
cartItems={cartItems}
/>
{(deliveryMethod === "DHL" || deliveryMethod === "DPD") && (
{deliveryMethod === "DHL" && (
<>
<FormControlLabel
control={

View File

@@ -20,14 +20,6 @@ const DeliveryMethodSelector = ({ deliveryMethod, onChange, isPickupOnly, cartIt
price: isFreeShipping ? (t ? t('delivery.prices.free') : 'kostenlos') : (t ? t('delivery.prices.dhl') : '5,90 €'),
disabled: isPickupOnly
},
{
id: 'DPD',
name: 'DPD',
description: isPickupOnly ? (t ? t('delivery.descriptions.notAvailable') : "nicht auswählbar weil ein oder mehrere Artikel nur abgeholt werden können") :
isFreeShipping ? (t ? t('delivery.descriptions.standardFree') : 'Standardversand - KOSTENLOS ab 100€ Warenwert!') : (t ? t('delivery.descriptions.standard') : 'Standardversand'),
price: isFreeShipping ? (t ? t('delivery.prices.free') : 'kostenlos') : (t ? t('delivery.prices.dpd') : '4,90 €'),
disabled: isPickupOnly
},
{
id: 'Sperrgut',
name: t ? t('delivery.methods.sperrgutName') : 'Sperrgut',