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:
+12
-2
@@ -8,9 +8,19 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
class Product extends Model
|
||||
{
|
||||
protected $fillable = ['category_id','name','slug','description','base_price','tax_rate','weight','active','featured','track_stock','sort_order'];
|
||||
protected $fillable = ['category_id','name','slug','description','base_price','sale_price','tax_rate','weight','active','featured','track_stock','sort_order'];
|
||||
|
||||
protected $casts = ['active' => 'boolean', 'featured' => 'boolean', 'track_stock' => 'boolean', 'base_price' => 'decimal:2', 'tax_rate' => 'decimal:2'];
|
||||
protected $casts = ['active' => 'boolean', 'featured' => 'boolean', 'track_stock' => 'boolean', 'base_price' => 'decimal:2', 'sale_price' => 'decimal:2', 'tax_rate' => 'decimal:2'];
|
||||
|
||||
public function isOnSale(): bool
|
||||
{
|
||||
return $this->sale_price !== null && (float)$this->sale_price < (float)$this->base_price;
|
||||
}
|
||||
|
||||
public function getEffectivePriceAttribute(): float
|
||||
{
|
||||
return $this->isOnSale() ? (float)$this->sale_price : (float)$this->base_price;
|
||||
}
|
||||
|
||||
public function category(): BelongsTo
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user