صفحة المنتج على موقع Marvel (Next.js). تجمع SKU واحداً أو عدة Variants تحت اسم واحد. Is visible = on شرط النشر على الموقع.
Product = SKU للمخزون. Storefront Product = واجهة العميل على الموقع. نمطان للربط:
product_id على Storefront Product → SKU واحد بلا variants.product_id ويحمل attributes_json.is_visible (inventory) ≠ Storefront.is_visible (website). كلاهما مطلوب لظهور صحيح.راجع خريطة إنشاء المنتج.
| المورد | الحقل | الأثر |
|---|---|---|
| Categories | category_id — مطلوب |
يحدد الفئة والمواصفات المتاحة للـ Variants. |
| Products | product_id أو Variants |
SKU للسعر والمخزون. Variant يمنع ربط نفس Product مرتين. |
| Comparison Groups | comparison_group_id |
مجموعة المقارنة على الموقع. |
| Suppliers | supplier_id |
مورد افتراضي للعرض. |
| Category Specs | attributes_json |
مفاتيح Variant تُتحقق من specs حيث is_variant_attribute = true. |
| الموقع V2 | /api/v2/storefront/products | القائمة، التفاصيل، البحث، المقارنة. |
| القسم | الحقول الرئيسية | ملاحظات |
|---|---|---|
| Basic Information | Category، product_id، comparison_group_id، supplier_id، name، name_ar، slug | product_id يظهر منتجات الفئة غير المربوطة بvariant. |
| Content | short_description، description (RichEditor) | short_description_ar و description_ar موجودان في DB. |
| Media | main_image، gallery_json | Gallery = JSON array of URLs. |
| Storefront Settings | is_visible، is_featured، sort_order | is_visible = شرط ظهور /products/… |
| SEO | seo_title، seo_description | اختياري. |
في صفحة التعديل — تبويب Variants. كل variant = SKU منفصل على الموقع.
| الحقل | التقني | ملاحظات |
|---|---|---|
| Product | product_id | SKU مرتبط. مطلوب للسعر والمخزون. |
| Variant Label | variant_label | مطلوب — مثل «18W Warm White». |
| SKU | sku | اختياري — مرجع إضافي. |
| Attributes JSON | attributes_json | مفاتيح = spec keys. يُتحقق من Category Specs (variant attribute + active). |
| Availability | availability_status | available / unavailable / coming_soon / discontinued. |
| Replacement | replacement_storefront_product_id | بديل عند discontinued. |
| Is Default | is_default | variant افتراضي للسعر. واحد فقط — يُلغى الآخر تلقائياً. |
| Is Visible / Sort | is_visible, sort_order | ترتيب العرض. |
ترتيب الأولوية في getDisplayPrice():
product_id)| API | الاستخدام |
|---|---|
| GET /api/v2/storefront/home | Featured products. |
| GET /api/v2/storefront/products | قائمة + فلاتر. |
| GET /api/v2/storefront/products/{slug} | صفحة التفاصيل + variants. |
| POST /api/v2/storefront/products/compare | مقارنة منتجات في نفس المجموعة. |
| المشكلة | السبب | الحل |
|---|---|---|
| 404 على الموقع | is_visible off أو slug خاطئ | فعّل Visible وتحقق من slug. |
| لا سعر | Variant بلا product_id أو بلا Product Prices | اربط SKU وأضف أسعاراً. |
| attributes_json مرفوض | مفتاح غير معرّف أو spec مطلوب ناقص | راجع Category Specs (is_variant_attribute). |
| Product غير ظاهر في القائمة | مرتبط بvariant آخر | whereDoesntHave storefrontVariants. |