Each size row in the product form now shows a Shopify status badge (green ✓ Shopify / gray Lokal). For saved variants, an action button appears: 'Zu Shopify' for local-only variants (creates via Shopify API and stores the returned variant ID), 'Shopify sync' for linked variants (pushes price/SKU/GTIN to Shopify). Also fixes: - gtin missing from ProductSize::$fillable (was silently not saved) - shopify_product_id added to products table and stored on import - sizes afterStateHydrated now loads ProductSize directly instead of via the belongsToMany pivot (gets product_size_id, shopify_variant_id) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
e187465553
commit
3ebd9845b0
7 files changed
+189
-20
No files matched your search
@@ -7,7 +7,7 @@ use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Product extends Model
|
||||
{
|
||||
protected $fillable = ['title', 'description', 'images', 'package_content', 'recipes_id'];
|
||||
protected $fillable = ['title', 'description', 'images', 'package_content', 'recipes_id', 'shopify_product_id'];
|
||||
|
||||
protected $casts = [
|
||||
'images' => 'array',
|
||||
|
||||
@@ -9,7 +9,7 @@ class ProductSize extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $table = 'products_sizes';
|
||||
protected $fillable = ['product_id', 'packing_id', 'sku', 'shopify_variant_id', 'price', 'description'];
|
||||
protected $fillable = ['product_id', 'packing_id', 'sku', 'shopify_variant_id', 'gtin', 'price', 'description'];
|
||||
|
||||
public function product() {
|
||||
return $this->belongsTo(Product::class);
|
||||
|
||||
Reference in new issue
Block a user