Add coupons, newsletter, country-based shipping, sale prices, USP bar
Deploy to Production (witstore.wende.it) / deploy (push) Successful in 8s
Deploy to Production (witstore.wende.it) / deploy (push) Successful in 8s
- Gutscheincodes: DB-Verwaltung (%, €-Rabatt, Mindestbestellwert, Ablauf), Eingabefeld im Checkout, Admin unter Marketing → Gutscheine - Newsletter: Double-Opt-In per E-Mail, Formular im Footer, Admin-Liste mit CSV-Export - Länderzonen-Versand: DE / DACH / EU / WORLD, Versandkosten nach Lieferland dynamisch berechnet, Coupon-Rabatt in Bestellung gespeichert - Sale-Preise: sale_price auf Produkten, durchgestrichener UVP auf Produktkarte, Sonderangebote-Sektion auf Startseite - USP-Leiste auf Startseite: Versand, Zahlung, Rückgabe, Service Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -10,9 +10,32 @@ class ShippingRate extends Model
|
||||
|
||||
protected $casts = ['active' => 'boolean', 'price' => 'decimal:2', 'free_from' => 'decimal:2'];
|
||||
|
||||
public static function forCart(float $total, string $zone = 'DE'): ?self
|
||||
// Länder → Zonen-Mapping
|
||||
public static array $countryZones = [
|
||||
'DE' => 'DE',
|
||||
'AT' => 'DACH',
|
||||
'CH' => 'DACH',
|
||||
'LI' => 'DACH',
|
||||
'FR' => 'EU', 'NL' => 'EU', 'BE' => 'EU', 'LU' => 'EU',
|
||||
'IT' => 'EU', 'ES' => 'EU', 'PT' => 'EU', 'PL' => 'EU',
|
||||
'CZ' => 'EU', 'SK' => 'EU', 'HU' => 'EU', 'RO' => 'EU',
|
||||
'BG' => 'EU', 'HR' => 'EU', 'SI' => 'EU', 'GR' => 'EU',
|
||||
'DK' => 'EU', 'SE' => 'EU', 'FI' => 'EU', 'EE' => 'EU',
|
||||
'LV' => 'EU', 'LT' => 'EU', 'IE' => 'EU', 'MT' => 'EU',
|
||||
'CY' => 'EU',
|
||||
];
|
||||
|
||||
public static function zoneForCountry(string $country): string
|
||||
{
|
||||
return self::where('zone', $zone)->where('active', true)->first();
|
||||
return self::$countryZones[strtoupper($country)] ?? 'WORLD';
|
||||
}
|
||||
|
||||
public static function forCart(float $total, string $country = 'DE'): ?self
|
||||
{
|
||||
$zone = self::zoneForCountry($country);
|
||||
$rate = self::where('zone', $zone)->where('active', true)->first();
|
||||
// Fallback auf DE wenn keine Zone gefunden
|
||||
return $rate ?? self::where('zone', 'DE')->where('active', true)->first();
|
||||
}
|
||||
|
||||
public function getCostForTotal(float $total): float
|
||||
|
||||
Reference in New Issue
Block a user